Compare commits

..

21 Commits

Author SHA1 Message Date
slawkens
8af9186098 Update CHANGELOG.md 2019-05-04 08:19:01 +02:00
slawkens
2d427601ee * release 0.7.11 2019-05-04 00:20:37 +02:00
slawkens
454d4b088d * Update CHANGELOG.md 2019-04-27 17:39:41 +02:00
slawkens
738bfbfa5c Fixed guilds "Add new rank function"
Exception thrown in OTS_GuildRank::__toString() method

https://otland.net/threads/myaac-bug-guild-new-rank.263953/

(cherry picked from commit 4d56650)
2019-04-09 00:50:56 +02:00
slawkens
03223c1c30 Fix something that Open Tibia developers don't think about 2018-11-07 21:15:47 +01:00
slawkens
3c6f44d6ee Fix database_name in Usage_Statistics 2018-10-31 07:46:35 +01:00
slawkens
dacc5b9dab Fix bug where server_config table does not exist (OTHire as an example)
Happened in Usage_Statistics class
Thanks for reporting the OtLand user - Olddies
2018-10-31 07:45:50 +01:00
slawkens
a4bccbaa34 * change config.lua.ownerEmail to config.mail_address 2018-10-22 09:27:46 +02:00
slawkens
174054237b * fixed the mystical defect where "Create Account" button was not highlighted (on the account/manage page) 2018-10-22 09:16:53 +02:00
slawkens
bcc81fa34f (Nothing important) just remove a minus in a word "re-install"
(cherry picked from commit a81824a)
2018-10-18 08:25:20 +02:00
slawkens
ba1c5e9b2e * add fatal error message when myaac tables in database do not exist 2018-10-18 08:22:37 +02:00
slawkens
0129c79580 * add an additional text to the install page informing that user can reinstall MyAAC by deleting config.local.php 2018-10-18 08:20:13 +02:00
slawkens
c863ad460a * fixed multiple mail recipients when using admin mailer function
It resulted in mail being sent to all users multiple times..
2018-06-08 21:08:31 +02:00
slawkens
cb08e53103 * fix XSS in forum show_thread 2018-06-01 20:27:34 +02:00
slawkens
d5cc2a1090 * Fixed missing prefix for cache get() and delete() functions
Cause those functions to not work correctly..

(cherry picked from commit b3625df)
2018-06-01 15:06:30 +02:00
slawkens
6ba8d2c9cb * forgot to open <head> in install template
(cherry picked from commit 050f596)
2018-05-29 20:33:15 +02:00
slawkens
668e4688c4 * remove whitespaces (IDE formatting) 2018-05-29 20:18:19 +02:00
slawkens
bd19b8665a * do not display software version 2018-05-29 20:17:39 +02:00
slawkens
c5980f2350 * add .gitattributes
(cherry picked from commit 15da31d)
2018-05-29 20:05:21 +02:00
slawkens1
6c03984f53 * support for some old servers, where arrays are used in config.lua 2018-04-16 20:52:50 +02:00
slawkens1
ecd865f275 * fix #47 2018-03-24 01:25:24 +01:00
20 changed files with 561 additions and 484 deletions

4
.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
* text=auto
.gitattributes export-ignore
.gitignore export-ignore
_config.yml export-ignore

View File

@@ -1,5 +1,25 @@
# Changelog # Changelog
## [0.7.11 - 04.05.2019]
### Added:
* support for some old servers, where arrays are used in config.lua
* an additional text to the install page informing that user can reinstall MyAAC by deleting config.local.php
### Fixed:
* XSS in forum show_thread
* guilds - "Add new rank" function
* multiple mail recipients when using admin mailer function
* Admin Panel - MyAAC logs not shown if servers logs directory doesn't exist (#47)
* missing prefix for cache get() and delete() functions
* add fatal error message when myaac tables in database do not exist
* the mystical defect where "Create Account" button was not highlighted (on the account/manage page)
* bug where server_config table does not exist (OTHire as an example)
* database_name in Usage_Statistics
* forgot to open <head> in install template
### Changed:
* do not display software version
## [0.7.10 - 03.03.2018] ## [0.7.10 - 03.03.2018]
### Added: ### Added:
* new configurable: smtp_secure * new configurable: smtp_secure
@@ -94,7 +114,7 @@
* fixed account.login redirect not working on tibiacom template * fixed account.login redirect not working on tibiacom template
* installation: warn about wrong admin account name/id and password * installation: warn about wrong admin account name/id and password
* fixed last menu closing in tibiacom template * fixed last menu closing in tibiacom template
* updated polish locale (translation) on install * updated polish locale (translation) on install
* (internal) removed some duplicated code on install finish * (internal) removed some duplicated code on install finish
* (internal) renamed installation step files to be in correct order * (internal) renamed installation step files to be in correct order
* added TODO file * added TODO file
@@ -143,7 +163,7 @@
* (internal) added some compat functions that are used by shop system * (internal) added some compat functions that are used by shop system
* (internal) renamed constant TICKET -> TICKER * (internal) renamed constant TICKET -> TICKER
* (internal) shortened message functions * (internal) shortened message functions
## [0.6.6 - 22.10.2017] ## [0.6.6 - 22.10.2017]
* fixed some php fatal error on spells page * fixed some php fatal error on spells page
* changed spells.vocations field in db size to 300 * changed spells.vocations field in db size to 300
@@ -152,15 +172,15 @@
## [0.6.5 - 21.10.2017] ## [0.6.5 - 21.10.2017]
* fixed displaying custom pages * fixed displaying custom pages
* fixed adding new group forum board * fixed adding new group forum board
## [0.6.4 - 20.10.2017] ## [0.6.4 - 20.10.2017]
* reverted OTS_Account::getLastLogin() cause its used by tibia11-login plugin * reverted OTS_Account::getLastLogin() cause its used by tibia11-login plugin
## [0.6.3 - 20.10.2017] ## [0.6.3 - 20.10.2017]
* fixed creating account * fixed creating account
* fixed viewing thread without being logged * fixed viewing thread without being logged
* fixed showing premium account status * fixed showing premium account status
## [0.6.2 - 20.10.2017] ## [0.6.2 - 20.10.2017]
* added forums for guilds and groups * added forums for guilds and groups
* added nice looking menu for my account page in default template * added nice looking menu for my account page in default template
@@ -193,7 +213,7 @@
* (internal) optimized Spells class * (internal) optimized Spells class
* (internal) new function: OTS_Guild::hasMember(OTS_Player $player) * (internal) new function: OTS_Guild::hasMember(OTS_Player $player)
* (internal) new function: Forum::hasAccess($board_id) * (internal) new function: Forum::hasAccess($board_id)
## [0.6.1 - 17.10.2017] ## [0.6.1 - 17.10.2017]
* fixed signatures loading * fixed signatures loading
* new configurable: session_prefix, to allow more websites on one machine (must be unique for every website on your dedicated server!) * new configurable: session_prefix, to allow more websites on one machine (must be unique for every website on your dedicated server!)
@@ -412,7 +432,7 @@
* fixed bug when creating character (not showing errors) (one more time) * fixed bug when creating character (not showing errors) (one more time)
* fixed support for TFS 0.2 series * fixed support for TFS 0.2 series
* added FAQ link * added FAQ link
## [0.0.5 - 05.05.2017] ## [0.0.5 - 05.05.2017]
* fixed bug when creating character (not showing errors) * fixed bug when creating character (not showing errors)
* Fixed characters loading with names that has been created with other AAC * Fixed characters loading with names that has been created with other AAC

View File

@@ -26,7 +26,7 @@
session_start(); session_start();
define('MYAAC', true); define('MYAAC', true);
define('MYAAC_VERSION', '0.7.10'); define('MYAAC_VERSION', '0.7.11');
define('DATABASE_VERSION', 22); define('DATABASE_VERSION', 22);
define('TABLE_PREFIX', 'myaac_'); define('TABLE_PREFIX', 'myaac_');
define('START_TIME', microtime(true)); define('START_TIME', microtime(true));
@@ -99,10 +99,10 @@ if(isset($_SERVER['HTTP_HOST'])) {
define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']); define('SERVER_URL', 'https://' . $_SERVER['HTTP_HOST']);
else else
define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']); define('SERVER_URL', 'http://' . $_SERVER['HTTP_HOST']);
define('BASE_URL', SERVER_URL . BASE_DIR . '/'); define('BASE_URL', SERVER_URL . BASE_DIR . '/');
define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/'); define('ADMIN_URL', SERVER_URL . BASE_DIR . '/admin/');
//define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']); //define('CURRENT_URL', BASE_URL . $_SERVER['REQUEST_URI']);
} }
?> ?>

867
index.php
View File

@@ -1,431 +1,436 @@
<?php <?php
/** /**
* Project: MyAAC * Project: MyAAC
* Automatic Account Creator for Open Tibia Servers * Automatic Account Creator for Open Tibia Servers
* File: index.php * File: index.php
* *
* This is free software; you can redistribute it and/or * This is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version. * version 2.1 of the License, or (at your option) any later version.
* *
* This software is distributed in the hope that it will be useful, * This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* @package MyAAC * @package MyAAC
* @author Slawkens <slawkens@gmail.com> * @author Slawkens <slawkens@gmail.com>
* @copyright 2017 MyAAC * @copyright 2017 MyAAC
* @link http://my-aac.org * @link http://my-aac.org
*/ */
// uncomment if your php.ini have display_errors disabled and you want to see errors // uncomment if your php.ini have display_errors disabled and you want to see errors
// ini_set('display_errors', 1); // ini_set('display_errors', 1);
// ini_set('display_startup_errors', 1); // ini_set('display_startup_errors', 1);
// error_reporting(E_ALL); // error_reporting(E_ALL);
require_once('common.php'); require_once('common.php');
require_once(SYSTEM . 'functions.php'); require_once(SYSTEM . 'functions.php');
$uri = $_SERVER['REQUEST_URI']; $uri = $_SERVER['REQUEST_URI'];
$tmp = BASE_DIR; $tmp = BASE_DIR;
if(!empty($tmp)) if(!empty($tmp))
$uri = str_replace(BASE_DIR . '/', '', $uri); $uri = str_replace(BASE_DIR . '/', '', $uri);
else else
$uri = str_replace_first('/', '', $uri); $uri = str_replace_first('/', '', $uri);
$uri = str_replace(array('index.php/', '?'), '', $uri); $uri = str_replace(array('index.php/', '?'), '', $uri);
define('URI', $uri); define('URI', $uri);
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) { if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
$tmp = explode('.', $uri); $tmp = explode('.', $uri);
$_REQUEST['name'] = urldecode($tmp[0]); $_REQUEST['name'] = urldecode($tmp[0]);
chdir(TOOLS . 'signature'); chdir(TOOLS . 'signature');
include(TOOLS . 'signature/index.php'); include(TOOLS . 'signature/index.php');
exit(); exit();
} }
else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) { else if(preg_match("/^(.*)\.(gif|jpg|png|jpeg|tiff|bmp|css|js|less|map|html|php|zip|rar|gz|ttf|woff|ico)$/i", $_SERVER['REQUEST_URI'])) {
header("HTTP/1.0 404 Not Found"); header("HTTP/1.0 404 Not Found");
exit; exit;
} }
require_once(BASE . 'config.local.php'); require_once(BASE . 'config.local.php');
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed'])) if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
{ {
header('Location: ' . BASE_URL . 'install/'); header('Location: ' . BASE_URL . 'install/');
die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!'); die('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
} }
$found = false; $found = false;
if(empty($uri) || isset($_REQUEST['template'])) { if(empty($uri) || isset($_REQUEST['template'])) {
$_REQUEST['p'] = 'news'; $_REQUEST['p'] = 'news';
$found = true; $found = true;
} }
else { else {
$tmp = strtolower($uri); $tmp = strtolower($uri);
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) { if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
$_REQUEST['p'] = $uri; $_REQUEST['p'] = $uri;
$found = true; $found = true;
} }
else { else {
$rules = array( $rules = array(
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'), '/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'), '/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'), '/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'), '/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'), '/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'), '/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'), '/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'), '/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'), '/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'), '/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'), '/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'), '/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
'/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'), '/^account\/character\/delete\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'delete_character'),
'/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'), '/^account\/character\/comment\/[A-Za-z0-9-_%+\']+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment', 'name' => '$3'),
'/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'), '/^account\/character\/comment\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
'/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'), '/^account\/confirm_email\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'confirm_email', 'v' => '$2'),
'/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'), '/^characters\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'characters', 'name' => '$1'),
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'), '/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'), '/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'), '/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'), '/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'), '/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),# '/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_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]+\/?$/' => 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\/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]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'), '/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'), '/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'), '/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'), '/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
'/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'), '/^guilds\/[A-Za-z0-9-_%+\']+$/' => array('subtopic' => 'guilds', 'action' => 'show', 'guild' => '$1'),
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2', 'page' => '$3'), '/^highscores\/[A-Za-z0-9-_]+\/[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-_]+\/[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-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'), '/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'), '/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'), '/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'), '/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'), '/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'), '/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'), '/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2'),
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'), '/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
); );
foreach($rules as $rule => $redirect) { foreach($rules as $rule => $redirect) {
if (preg_match($rule, $uri)) { if (preg_match($rule, $uri)) {
$tmp = explode('/', $uri); $tmp = explode('/', $uri);
foreach($redirect as $key => $value) { foreach($redirect as $key => $value) {
if(strpos($value, '$') !== false) { if(strpos($value, '$') !== false) {
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value); $value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
} }
$_REQUEST[$key] = $value; $_REQUEST[$key] = $value;
$_GET[$key] = $value; $_GET[$key] = $value;
} }
$found = true; $found = true;
break; break;
} }
} }
} }
} }
// 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($_REQUEST['p']) ? $_REQUEST['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)) {
$tmp = URI; $tmp = URI;
if(!empty($tmp)) { if(!empty($tmp)) {
$page = $tmp; $page = $tmp;
} }
else { else {
if(!$found) if(!$found)
$page = '404'; $page = '404';
else 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 . 'init.php'); require_once(SYSTEM . 'init.php');
require_once(SYSTEM . 'template.php'); require_once(SYSTEM . 'template.php');
require_once(SYSTEM . 'login.php'); require_once(SYSTEM . 'login.php');
require_once(SYSTEM . 'status.php'); require_once(SYSTEM . 'status.php');
$twig->addGlobal('config', $config); $twig->addGlobal('config', $config);
$twig->addGlobal('status', $status); $twig->addGlobal('status', $status);
// database migrations // verify myaac tables exists in database
$tmp = ''; if(!tableExist('myaac_account_actions')) {
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version die('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
$tmp = (int)$tmp; }
if($tmp < DATABASE_VERSION) { // import if older
for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) { // database migrations
require(SYSTEM . 'migrations/' . $i . '.php'); $tmp = '';
updateDatabaseConfig('database_version', $i); if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
} $tmp = (int)$tmp;
} if($tmp < DATABASE_VERSION) { // import if older
} for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) {
else { // register first version require(SYSTEM . 'migrations/' . $i . '.php');
registerDatabaseConfig('database_version', 0); updateDatabaseConfig('database_version', $i);
for($i = 1; $i <= DATABASE_VERSION; $i++) { }
require(SYSTEM . 'migrations/' . $i . '.php'); }
updateDatabaseConfig('database_version', $i); }
} else { // register first version
} registerDatabaseConfig('database_version', 0);
for($i = 1; $i <= DATABASE_VERSION; $i++) {
// event system require(SYSTEM . 'migrations/' . $i . '.php');
require_once(SYSTEM . 'hooks.php'); updateDatabaseConfig('database_version', $i);
$hooks = new Hooks(); }
$hooks->load(); }
$hooks->trigger(HOOK_STARTUP);
// event system
// anonymous usage statistics require_once(SYSTEM . 'hooks.php');
// sent only when user agrees $hooks = new Hooks();
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) { $hooks->load();
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days $hooks->trigger(HOOK_STARTUP);
$should_report = true;
// anonymous usage statistics
$value = ''; // sent only when user agrees
if($cache->enabled() && $cache->fetch('last_usage_report', $value)) { if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
$should_report = time() > (int)$value + $report_time; $report_time = 30 * 24 * 60 * 60; // report one time per 30 days
} $should_report = true;
else {
$value = ''; $value = '';
if(fetchDatabaseConfig('last_usage_report', $value)) { if($cache->enabled() && $cache->fetch('last_usage_report', $value)) {
$should_report = time() > (int)$value + $report_time; $should_report = time() > (int)$value + $report_time;
if($cache->enabled()) { }
$cache->set('last_usage_report', $value); else {
} $value = '';
} if(fetchDatabaseConfig('last_usage_report', $value)) {
else { $should_report = time() > (int)$value + $report_time;
registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week if($cache->enabled()) {
$should_report = false; $cache->set('last_usage_report', $value);
} }
} }
else {
if($should_report) { registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week
require_once(LIBS . 'usage_statistics.php'); $should_report = false;
Usage_Statistics::report(); }
}
updateDatabaseConfig('last_usage_report', time());
if($cache->enabled()) { if($should_report) {
$cache->set('last_usage_report', time()); require_once(LIBS . 'usage_statistics.php');
} Usage_Statistics::report();
}
} updateDatabaseConfig('last_usage_report', time());
if($cache->enabled()) {
if($config['views_counter']) $cache->set('last_usage_report', time());
require_once(SYSTEM . 'counter.php'); }
}
if($config['visitors_counter']) }
{
require_once(SYSTEM . 'libs/visitors.php'); if($config['views_counter'])
$visitors = new Visitors($config['visitors_counter_ttl']); require_once(SYSTEM . 'counter.php');
}
if($config['visitors_counter'])
// page content loading {
if(!isset($content[0])) require_once(SYSTEM . 'libs/visitors.php');
$content = ''; $visitors = new Visitors($config['visitors_counter_ttl']);
$load_it = true; }
// check if site has been closed // page content loading
$site_closed = false; if(!isset($content[0]))
if(fetchDatabaseConfig('site_closed', $site_closed)) { $content = '';
$site_closed = ($site_closed == 1); $load_it = true;
if($site_closed) {
if(!admin()) // check if site has been closed
{ $site_closed = false;
$title = getDatabaseConfig('site_closed_title'); if(fetchDatabaseConfig('site_closed', $site_closed)) {
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>'; $site_closed = ($site_closed == 1);
$load_it = false; if($site_closed) {
} if(!admin())
{
if(!$logged) $title = getDatabaseConfig('site_closed_title');
{ $content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
ob_start(); $load_it = false;
require(SYSTEM . 'pages/accountmanagement.php'); }
$content .= ob_get_contents();
ob_end_clean(); if(!$logged)
$load_it = false; {
} ob_start();
} require(SYSTEM . 'pages/accountmanagement.php');
} $content .= ob_get_contents();
define('SITE_CLOSED', $site_closed); ob_end_clean();
$load_it = false;
// backward support for gesior }
if($config['backward_support']) { }
define('INITIALIZED', true); }
$SQL = $db; define('SITE_CLOSED', $site_closed);
$layout_header = template_header();
$layout_name = $template_path; // backward support for gesior
$news_content = ''; if($config['backward_support']) {
$tickers_content = ''; define('INITIALIZED', true);
$subtopic = PAGE; $SQL = $db;
$main_content = ''; $layout_header = template_header();
$layout_name = $template_path;
$config['access_admin_panel'] = 2; $news_content = '';
$group_id_of_acc_logged = 0; $tickers_content = '';
if($logged && $account_logged) $subtopic = PAGE;
$group_id_of_acc_logged = $account_logged->getGroupId(); $main_content = '';
$config['site'] = &$config; $config['access_admin_panel'] = 2;
$config['server'] = &$config['lua']; $group_id_of_acc_logged = 0;
$config['site']['shop_system'] = $config['gifts_system']; if($logged && $account_logged)
$group_id_of_acc_logged = $account_logged->getGroupId();
if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050'; $config['site'] = &$config;
if(!isset($config['darkborder'])) $config['server'] = &$config['lua'];
$config['darkborder'] = '#D4C0A1'; $config['site']['shop_system'] = $config['gifts_system'];
if(!isset($config['lightborder']))
$config['lightborder'] = '#F1E0C6'; if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050';
$config['site']['download_page'] = true; if(!isset($config['darkborder']))
$config['site']['serverinfo_page'] = true; $config['darkborder'] = '#D4C0A1';
$config['site']['screenshot_page'] = true; if(!isset($config['lightborder']))
$config['lightborder'] = '#F1E0C6';
if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']); $config['site']['download_page'] = true;
$config['site']['serverinfo_page'] = true;
foreach($status as $key => $value) $config['site']['screenshot_page'] = true;
$config['status']['serverStatus_' . $key] = $value;
} if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? getLink('forum') : $config['forum']);
if($load_it)
{ foreach($status as $key => $value)
if(SITE_CLOSED && admin()) $config['status']['serverStatus_' . $key] = $value;
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>'; }
if($config['backward_support']) if($load_it)
require(SYSTEM . 'compat_pages.php'); {
if(SITE_CLOSED && admin())
$ignore = false; $content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
$logged_access = 1; if($config['backward_support'])
if($logged && $account_logged && $account_logged->isLoaded()) { require(SYSTEM . 'compat_pages.php');
$logged_access = $account_logged->getAccess();
} $ignore = false;
$query = $logged_access = 1;
$db->query( if($logged && $account_logged && $account_logged->isLoaded()) {
'SELECT `id`, `title`, `body`, `php`, `hidden`' . $logged_access = $account_logged->getAccess();
' 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 $query =
{ $db->query(
$ignore = true; 'SELECT `id`, `title`, `body`, `php`, `hidden`' .
$query = $query->fetch(); ' FROM `' . TABLE_PREFIX . 'pages`' .
$title = $query['title']; ' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
if($query->rowCount() > 0) // found page
if($query['php'] == '1') // execute it as php code {
{ $ignore = true;
$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) {
else $tmp = preg_replace('/<\?php/', '', $query['body'], 1);
$tmp = $query['body']; }
else if(($pos = strpos($tmp, '<?')) !== false) {
$php_errors = array(); $tmp = preg_replace('/<\?/', '', $query['body'], 1);
function error_handler($errno, $errstr) { }
global $php_errors; else
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr); $tmp = $query['body'];
}
set_error_handler('error_handler'); $php_errors = array();
function error_handler($errno, $errstr) {
ob_start(); global $php_errors;
eval($tmp); $php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
$content .= ob_get_contents(); }
ob_end_clean(); set_error_handler('error_handler');
restore_error_handler(); ob_start();
if(isset($php_errors[0]) && superAdmin()) { eval($tmp);
var_dump($php_errors); $content .= ob_get_contents();
} ob_end_clean();
}
else restore_error_handler();
$content .= $query['body']; // plain html if(isset($php_errors[0]) && superAdmin()) {
var_dump($php_errors);
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) { }
$content = $twig->render('admin.pages.links.html.twig', array( }
'page' => array('id' => $query['id'], 'hidden' => $query['hidden']) else
)) . $content; $content .= $query['body']; // plain html
}
} if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
else $content = $twig->render('admin.pages.links.html.twig', array(
{ 'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
$file = SYSTEM . 'pages/' . $page . '.php'; )) . $content;
if(!@file_exists($file)) }
{ }
$page = '404'; else
$file = SYSTEM . 'pages/404.php'; {
} $file = SYSTEM . 'pages/' . $page . '.php';
} if(!@file_exists($file))
{
ob_start(); $page = '404';
if($hooks->trigger(HOOK_BEFORE_PAGE)) { $file = SYSTEM . 'pages/404.php';
if(!$ignore) }
require($file); }
}
ob_start();
if($config['backward_support'] && isset($main_content[0])) if($hooks->trigger(HOOK_BEFORE_PAGE)) {
$content .= $main_content; if(!$ignore)
require($file);
$content .= ob_get_contents(); }
ob_end_clean();
$hooks->trigger(HOOK_AFTER_PAGE); if($config['backward_support'] && isset($main_content[0]))
} $content .= $main_content;
if($config['backward_support']) { $content .= ob_get_contents();
$main_content = $content; ob_end_clean();
if(!isset($title)) $hooks->trigger(HOOK_AFTER_PAGE);
$title = ucfirst($page); }
$topic = $title; if($config['backward_support']) {
} $main_content = $content;
if(!isset($title))
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName']; $title = ucfirst($page);
if(file_exists($template_path . '/index.php'))
require($template_path . '/index.php'); $topic = $title;
else if(file_exists($template_path . '/template.php')) // deprecated }
require($template_path . '/template.php');
else if($config['backward_support'] && file_exists($template_path . '/layout.php')) $title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
{ if(file_exists($template_path . '/index.php'))
require($template_path . '/layout.php'); require($template_path . '/index.php');
} else if(file_exists($template_path . '/template.php')) // deprecated
else require($template_path . '/template.php');
{ else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
// TODO: save more info to log file {
die('ERROR: Cannot load template.'); require($template_path . '/layout.php');
} }
else
echo '<!-- MyAAC ' . MYAAC_VERSION . ' :: http://www.my-aac.org/ -->' . "\n"; {
if(($config['debug_level'] & 1) == 1) // TODO: save more info to log file
echo '<!-- Generated in :: ' . round(microtime(true) - START_TIME, 4) . ' -->'; die('ERROR: Cannot load template.');
}
if(($config['debug_level'] & 2) == 2)
echo "\n" . '<!-- Queries done :: ' . $db->queries() . ' -->'; echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
if(($config['debug_level'] & 1) == 1)
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage')) echo '<!-- Generated in :: ' . round(microtime(true) - START_TIME, 4) . ' -->';
echo "\n" . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
if(($config['debug_level'] & 2) == 2)
$hooks->trigger(HOOK_FINISH); echo "\n" . '<!-- Queries done :: ' . $db->queries() . ' -->';
?>
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
$hooks->trigger(HOOK_FINISH);
?>

View File

@@ -174,6 +174,11 @@ if(!$error) {
success($locale['step_database_adding_field'] . ' accounts.premium_points...'); success($locale['step_database_adding_field'] . ' accounts.premium_points...');
} }
if(fieldExist('motd', 'guilds')) {
if(query("ALTER TABLE `guilds` MODIFY `motd` VARCHAR(255) NOT NULL DEFAULT '';"))
success($locale['step_database_modifying_field'] . ' guilds.motd...');
}
if(!fieldExist('description', 'guilds')) { if(!fieldExist('description', 'guilds')) {
if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL;")) if(query("ALTER TABLE `guilds` ADD `description` TEXT NOT NULL;"))
success($locale['step_database_adding_field'] . ' guilds.description...'); success($locale['step_database_adding_field'] . ' guilds.description...');

View File

@@ -1,5 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>"> <html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $locale['direction']; ?>" lang="<?php echo $locale['lang']; ?>" xml:lang="<?php echo $locale['lang']; ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $locale['encoding']; ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $locale['encoding']; ?>" />
<title>MyAAC - <?php echo $locale['installation']; ?></title> <title>MyAAC - <?php echo $locale['installation']; ?></title>
<link rel="stylesheet" type="text/css" href="template/style.css" /> <link rel="stylesheet" type="text/css" href="template/style.css" />
@@ -8,7 +9,7 @@
<div id="wrapper"> <div id="wrapper">
<!--div class="buffer"--> <!--div class="buffer"-->
<div id="header"> <div id="header">
<h1>MyAAC v<?php echo MYAAC_VERSION . ' ' . $locale['installation']; ?></h1> <h1>MyAAC <?php echo $locale['installation']; ?></h1>
</div> </div>
<div id="body"> <div id="body">

View File

@@ -473,7 +473,7 @@ function template_header($is_admin = false)
$ret .= ' $ret .= '
<meta name="description" content="' . $config['meta_description'] . '" /> <meta name="description" content="' . $config['meta_description'] . '" />
<meta name="keywords" content="' . $config['meta_keywords'] . ', myaac, wodzaac" /> <meta name="keywords" content="' . $config['meta_keywords'] . ', myaac, wodzaac" />
<meta name="generator" content="MyAAC ' . MYAAC_VERSION . '" /> <meta name="generator" content="MyAAC" />
<link rel="stylesheet" type="text/css" href="' . BASE_URL . 'tools/messages.css" /> <link rel="stylesheet" type="text/css" href="' . BASE_URL . 'tools/messages.css" />
<script type="text/javascript" src="' . BASE_URL . 'tools/jquery.js"></script> <script type="text/javascript" src="' . BASE_URL . 'tools/jquery.js"></script>
<noscript> <noscript>
@@ -810,6 +810,7 @@ function getWorldName($id)
*/ */
function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true) function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
{ {
/** @var PHPMailer $mailer */
global $mailer, $config; global $mailer, $config;
if(!$mailer) if(!$mailer)
{ {
@@ -817,6 +818,9 @@ function _mail($to, $subject, $body, $altBody = '', $add_html_tags = true)
$mailer = new PHPMailer(); $mailer = new PHPMailer();
$mailer->setLanguage('en', LIBS . 'phpmailer/language/'); $mailer->setLanguage('en', LIBS . 'phpmailer/language/');
} }
else {
$mailer->clearAllRecipients();
}
$signature_html = ''; $signature_html = '';
if(isset($config['mail_signature']['html'])) if(isset($config['mail_signature']['html']))
@@ -917,6 +921,10 @@ function load_config_lua($filename)
$result[$key] = (string) substr(substr($value, 1), 0, -1); $result[$key] = (string) substr(substr($value, 1), 0, -1);
elseif(in_array($value, array('true', 'false'))) elseif(in_array($value, array('true', 'false')))
$result[$key] = ($value == 'true') ? true : false; $result[$key] = ($value == 'true') ? true : false;
elseif(substr($value, 0 , 1) == '{' && substr($value, -1 , 1) == '}') {
// arrays are not supported yet
// just ignore the error
}
else else
{ {
foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull foreach($result as $tmp_key => $tmp_value) // load values definied by other keys, like: dailyFragsToBlackSkull = dailyFragsToRedSkull

View File

@@ -31,7 +31,7 @@ class Cache_APC
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -42,7 +42,7 @@ class Cache_APC
} }
public function delete($key) { public function delete($key) {
apc_delete($key); apc_delete($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -30,7 +30,7 @@ class Cache_eAccelerator
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -41,7 +41,7 @@ class Cache_eAccelerator
} }
public function delete($key) { public function delete($key) {
eaccelerator_rm($key); eaccelerator_rm($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -30,7 +30,7 @@ class Cache_XCache
public function get($key) public function get($key)
{ {
$tmp = ''; $tmp = '';
if($this->fetch($key, $tmp)) if($this->fetch($this->prefix . $key, $tmp))
return $tmp; return $tmp;
return ''; return '';
@@ -47,7 +47,7 @@ class Cache_XCache
} }
public function delete($key) { public function delete($key) {
xcache_unset($key); xcache_unset($this->prefix . $key);
} }
public function enabled() { public function enabled() {

View File

@@ -39,11 +39,13 @@ class Usage_Statistics {
$ret['myaac_version'] = MYAAC_VERSION; $ret['myaac_version'] = MYAAC_VERSION;
$ret['myaac_db_version'] = DATABASE_VERSION; $ret['myaac_db_version'] = DATABASE_VERSION;
$query = $db->query('SELECT `value` FROM `server_config` WHERE `config` = ' . $db->quote('database_version')); if(tableExist('server_config')) {
if($query->rowCount() == 1) { $query = $db->query('SELECT `value` FROM `server_config` WHERE `config` = ' . $db->quote('database_version'));
$query = $query->fetch(); if($query->rowCount() == 1) {
$ret['otserv_db_version'] = $query['value']; $query = $query->fetch();
$ret['otserv_db_version'] = $query['value'];
}
} }
$ret['client_version'] = $config['client']; $ret['client_version'] = $config['client'];
@@ -58,8 +60,8 @@ class Usage_Statistics {
$query = $db->query('SELECT SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 ), 0)) AS "size" $query = $db->query('SELECT SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 ), 0)) AS "size"
FROM INFORMATION_SCHEMA.TABLES FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = "forgottenserver";'); WHERE TABLE_SCHEMA = "' . $config['database_name'] . '";');
if($query->rowCount() == 1) { if($query->rowCount() == 1) {
$query = $query->fetch(); $query = $query->fetch();
$ret['database_size'] = $query['size']; $ret['database_size'] = $query['size'];

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Loaded';
$locale['not_loaded'] = 'Not loaded'; $locale['not_loaded'] = 'Not loaded';
$locale['please_fill_all'] = 'Please fill all inputs!'; $locale['please_fill_all'] = 'Please fill all inputs!';
$locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/<b/> directory.'; $locale['already_installed'] = 'MyAAC has been already installed. Please delete <b>install/<b/> directory. If you want to reinstall MyAAC - please delete <strong>config.local.php</strong> file from the main directory and refresh the page.';
// welcome // welcome
$locale['step_welcome'] = 'Welcome'; $locale['step_welcome'] = 'Welcome';

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Załadowane';
$locale['not_loaded'] = 'Nie załadowane'; $locale['not_loaded'] = 'Nie załadowane';
$locale['please_fill_all'] = 'Proszę wypełnić wszystkie pola!'; $locale['please_fill_all'] = 'Proszę wypełnić wszystkie pola!';
$locale['already_installed'] = 'MyAAC został już zainstalowany. Proszę usunąć katalog <b>install/</b>.'; $locale['already_installed'] = 'MyAAC został już zainstalowany. Proszę usunąć katalog <b>install/</b>. Jeśli chcesz zainstalować MyAAC od nowa - proszę usuń plik <strong>config.local.php</strong> z katalogu głównego i odśwież stronę.';
// welcome // welcome
$locale['step_welcome'] = 'Witamy'; $locale['step_welcome'] = 'Witamy';

View File

@@ -18,7 +18,7 @@ $locale['loaded'] = 'Laddad';
$locale['not_loaded'] = 'Inte Laddad'; $locale['not_loaded'] = 'Inte Laddad';
$locale['please_fill_all'] = 'Vänligen fyll i allt!'; $locale['please_fill_all'] = 'Vänligen fyll i allt!';
$locale['already_installed'] = 'MyAAC är redan installerat. Vänligen ta bort <b>install/<b/> mappen.'; $locale['already_installed'] = 'MyAAC är redan installerat. Vänligen ta bort <b>install/<b/> mappen. Om du vill installera MyAAC igen - ta bort filen <strong>config.local.php</strong> från huvudkatalogen och uppdatera sidan.';
// welcome // welcome
$locale['step_welcome'] = 'Välkommen'; $locale['step_welcome'] = 'Välkommen';

View File

@@ -28,29 +28,27 @@ foreach(scandir($aac_path_logs) as $f) {
} }
$server_path_logs = $config['server_path'] . 'logs/'; $server_path_logs = $config['server_path'] . 'logs/';
if(!file_exists($server_path_logs))
$server_path_logs = $config['data_path'] . 'logs/';
if(!file_exists($server_path_logs)) { if(!file_exists($server_path_logs)) {
echo '</table>Logs are not available on this server.'; $server_path_logs = $config['data_path'] . 'logs/';
return;
} }
foreach(scandir($server_path_logs) as $f) { if(file_exists($server_path_logs)) {
if($f[0] == '.' || $f == '..') foreach(scandir($server_path_logs) as $f) {
continue; if($f[0] == '.' || $f == '..')
continue;
if(is_dir($server_path_logs . $f)) { if(is_dir($server_path_logs . $f)) {
foreach(scandir($server_path_logs . $f) as $f2) { foreach(scandir($server_path_logs . $f) as $f2) {
if($f2[0] == '.' || $f2 == '..') if($f2[0] == '.' || $f2 == '..')
continue; continue;
$files[] = array($f . '/' . $f2, $server_path_logs); $files[] = array($f . '/' . $f2, $server_path_logs);
}
continue;
} }
continue; $files[] = array($f, $server_path_logs);
} }
$files[] = array($f, $server_path_logs);
} }
$i = 0; $i = 0;

View File

@@ -13,7 +13,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$links_to_pages = ''; $links_to_pages = '';
$thread_id = (int) $_REQUEST['id']; $thread_id = (int) $_REQUEST['id'];
$_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0); $_page = (int) (isset($_REQUEST['page']) ? $_REQUEST['page'] : 0);
$thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`section` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch(); $thread_name = $db->query("SELECT `players`.`name`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`section`, `" . TABLE_PREFIX . "forum`.`post_html` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." AND `" . TABLE_PREFIX . "forum`.`id` = `" . TABLE_PREFIX . "forum`.`first_post` AND `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` LIMIT 1")->fetch();
if(empty($thread_name['name'])) { if(empty($thread_name['name'])) {
echo 'Thread with this ID does not exits.'; echo 'Thread with this ID does not exits.';
@@ -36,8 +36,8 @@ for($i = 0; $i < $posts_count['posts_count'] / $config['forum_threads_per_page']
$threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`post_html`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll(); $threads = $db->query("SELECT `players`.`id` as `player_id`, `players`.`name`, `players`.`account_id`, `players`.`vocation`" . (fieldExist('promotion', 'players') ? ", `players`.`promotion`" : "") . ", `players`.`level`, `" . TABLE_PREFIX . "forum`.`id`,`" . TABLE_PREFIX . "forum`.`first_post`, `" . TABLE_PREFIX . "forum`.`section`,`" . TABLE_PREFIX . "forum`.`post_text`, `" . TABLE_PREFIX . "forum`.`post_topic`, `" . TABLE_PREFIX . "forum`.`post_date`, `" . TABLE_PREFIX . "forum`.`post_smile`, `" . TABLE_PREFIX . "forum`.`post_html`, `" . TABLE_PREFIX . "forum`.`author_aid`, `" . TABLE_PREFIX . "forum`.`author_guid`, `" . TABLE_PREFIX . "forum`.`last_edit_aid`, `" . TABLE_PREFIX . "forum`.`edit_date` FROM `players`, `" . TABLE_PREFIX . "forum` WHERE `players`.`id` = `" . TABLE_PREFIX . "forum`.`author_guid` AND `" . TABLE_PREFIX . "forum`.`first_post` = ".(int) $thread_id." ORDER BY `" . TABLE_PREFIX . "forum`.`post_date` LIMIT ".$config['forum_posts_per_page']." OFFSET ".($_page * $config['forum_posts_per_page']))->fetchAll();
if(isset($threads[0]['name'])) if(isset($threads[0]['name']))
$db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id); $db->query("UPDATE `" . TABLE_PREFIX . "forum` SET `views`=`views`+1 WHERE `id` = ".(int) $thread_id);
echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.$thread_name['post_topic'].'</b>'; echo '<a href="' . getLink('forum') . '">Boards</a> >> <a href="' . getForumBoardLink($threads[0]['section']) . '">'.$sections[$threads[0]['section']]['name'].'</a> >> <b>'.($thread_name['post_html'] ? $thread_name['post_topic'] : htmlspecialchars($thread_name['post_topic'])).'</b>';
echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.htmlspecialchars($thread_name['post_topic']).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td>&nbsp;</td></tr>'; echo '<br /><br /><a href="?subtopic=forum&action=new_post&thread_id='.$thread_id.'"><img src="images/forum/post.gif" border="0" /></a><br /><br />Page: '.$links_to_pages.'<br /><table width="100%"><tr bgcolor="'.$config['lightborder'].'" width="100%"><td colspan="2"><font size="4"><b>'.($thread_name['post_html'] ? $thread_name['post_topic'] : htmlspecialchars($thread_name['post_topic'])).'</b></font><font size="1"><br />by ' . getPlayerLink($thread_name['name']) . '</font></td></tr><tr bgcolor="'.$config['vdarkborder'].'"><td width="200"><font color="white" size="1"><b>Author</b></font></td><td>&nbsp;</td></tr>';
$player = $ots->createObject('Player'); $player = $ots->createObject('Player');
foreach($threads as $thread) foreach($threads as $thread)
{ {

View File

@@ -11,13 +11,13 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null; $guild_name = isset($_REQUEST['guild']) ? urldecode($_REQUEST['guild']) : null;
$new_rank = isset($_REQUEST['rank_name']) ? $_REQUEST['rank_name'] : null; $rank_name = isset($_REQUEST['rank_name']) ? $_REQUEST['rank_name'] : null;
if(!Validator::guildName($guild_name)) { if(!Validator::guildName($guild_name)) {
$errors[] = Validator::getLastError(); $errors[] = Validator::getLastError();
} }
if(empty($errors)) { if(empty($errors)) {
if(!Validator::rankName($new_rank)) { if(!Validator::rankName($rank_name)) {
$errors[] = 'Invalid rank name format.'; $errors[] = 'Invalid rank name format.';
} }
if(!$logged) { if(!$logged) {
@@ -45,7 +45,7 @@ if(empty($errors)) {
$new_rank = new OTS_GuildRank(); $new_rank = new OTS_GuildRank();
$new_rank->setGuild($guild); $new_rank->setGuild($guild);
$new_rank->setLevel(1); $new_rank->setLevel(1);
$new_rank->setName($new_rank); $new_rank->setName($rank_name);
$new_rank->save(); $new_rank->save();
header("Location: ?subtopic=guilds&guild=".$guild->getName()."&action=manager"); header("Location: ?subtopic=guilds&guild=".$guild->getName()."&action=manager");
echo 'New rank added. Redirecting...'; echo 'New rank added. Redirecting...';

View File

@@ -108,11 +108,14 @@
<tr> <tr>
<td > <td >
<div style="float: right; margin-top: 20px;" > <div style="float: right; margin-top: 20px;" >
{% spaceless %}
<form class="MediumButtonForm" action="{{ getLink('account/create') }}" method="post" > <form class="MediumButtonForm" action="{{ getLink('account/create') }}" method="post" >
<div class="MediumButtonBackground" style="background-image:url({{ template_path }}/images/global/buttons/mediumbutton.gif)" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="MediumButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/mediumbutton-over.gif)" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ></div> <div class="MediumButtonBackground" style="background-image:url({{ template_path }}/images/global/buttons/mediumbutton.gif)" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);">
<div class="MediumButtonOver" style="background-image:url({{ template_path }}/images/global/buttons/mediumbutton-over.gif)" onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);"></div>
<input class="MediumButtonText" type="image" name="Create Account" alt="Create Account" src="{{ template_path }}/images/global/buttons/mediumbutton_createaccount.png" /> <input class="MediumButtonText" type="image" name="Create Account" alt="Create Account" src="{{ template_path }}/images/global/buttons/mediumbutton_createaccount.png" />
</div> </div>
</form> </form>
{% endspaceless %}
</div> </div>
<div id="LoginCreateAccountBox" > <div id="LoginCreateAccountBox" >
<p><b>{{ config.lua.serverName }}...</b></p> <p><b>{{ config.lua.serverName }}...</b></p>

View File

@@ -1785,6 +1785,37 @@ img {
color: white; color: white;
} }
/* BUTTONS */
.MediumButtonText {
position: absolute;
top: 0;
left: 0;
height: 37px;
width: 150px;
z-index: 20;
}
.MediumButtonBackground {
position: relative;
top: 0;
left: 0;
width: 150px;
height: 37px;
z-index: 10;
}
.MediumButtonOver {
position: relative;
top: 0;
left: 0;
width: 150px;
height: 37px;
visibility: hidden;
z-index: 15;
}
.MediumButtonForm {
margin: 0;
padding: 0;
}
.moduleRow { } .moduleRow { }
.moduleRowOver { .moduleRowOver {

View File

@@ -279,7 +279,7 @@ if(isset($config['boxes']))
<img id="TibiaLogoArtworkTop" src="<?php echo $template_path; ?>/images/header/<?php echo $config['logo_image']; ?>" onClick="window.location = '<?php echo getLink('news')?>';" alt="logoartwork" /> <img id="TibiaLogoArtworkTop" src="<?php echo $template_path; ?>/images/header/<?php echo $config['logo_image']; ?>" onClick="window.location = '<?php echo getLink('news')?>';" alt="logoartwork" />
<img id="TibiaLogoArtworkBottom" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-bottom.gif" alt="logoartwork" /> <img id="TibiaLogoArtworkBottom" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-bottom.gif" alt="logoartwork" />
<img id="Statue_2" src="<?php echo $template_path; ?>/images/header/animated-statue.gif" alt="logoartwork" /> <img id="Statue_2" src="<?php echo $template_path; ?>/images/header/animated-statue.gif" alt="logoartwork" />
<img id="LogoLink" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-string.gif" onClick="window.location = 'mailto:<?php echo $config['lua']['ownerEmail']; ?>';" alt="logoartwork" /> <img id="LogoLink" src="<?php echo $template_path; ?>/images/header/tibia-logo-artwork-string.gif" onClick="window.location = 'mailto:<?php echo $config['mail_address']; ?>';" alt="logoartwork" />
</div> </div>
<div id="Loginbox" > <div id="Loginbox" >