mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 01:09:21 +02:00
* remove unnecessary parentheses in include/require
This commit is contained in:
parent
e1ddf58119
commit
42d23e9b37
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
// few things we'll need
|
||||
require('../common.php');
|
||||
require_once(BASE . 'config.local.php');
|
||||
require '../common.php';
|
||||
require_once BASE . 'config.local.php';
|
||||
|
||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||
{
|
||||
@ -21,17 +21,17 @@ if(empty($page) || preg_match("/[^a-zA-Z0-9_\-]/", $page))
|
||||
$page = strtolower($page);
|
||||
define('PAGE', $page);
|
||||
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(SYSTEM . 'init.php');
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
|
||||
// event system
|
||||
require_once(SYSTEM . 'hooks.php');
|
||||
require_once SYSTEM . 'hooks.php';
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
|
||||
require(SYSTEM . 'status.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require(ADMIN . 'includes/functions.php');
|
||||
require SYSTEM . 'status.php';
|
||||
require SYSTEM . 'login.php';
|
||||
require ADMIN . 'includes/functions.php';
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
@ -41,7 +41,7 @@ if(!$logged || !admin()) {
|
||||
$page = 'login';
|
||||
}
|
||||
|
||||
// include our page
|
||||
// include our page
|
||||
$file = SYSTEM . 'pages/admin/' . $page . '.php';
|
||||
if(!@file_exists($file)) {
|
||||
$page = '404';
|
||||
@ -56,5 +56,5 @@ ob_end_clean();
|
||||
|
||||
// template
|
||||
$template_path = 'template/';
|
||||
require(ADMIN . $template_path . 'template.php');
|
||||
require ADMIN . $template_path . 'template.php';
|
||||
?>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
require('../../common.php');
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(SYSTEM . 'init.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require '../../common.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
if(!admin())
|
||||
die('Access denied.');
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
require('../../common.php');
|
||||
require(SYSTEM . 'init.php');
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(SYSTEM . 'status.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require '../../common.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'status.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
if(!admin())
|
||||
die('Access denied.');
|
||||
|
876
index.php
876
index.php
@ -1,438 +1,438 @@
|
||||
<?php
|
||||
/**
|
||||
* Project: MyAAC
|
||||
* Automatic Account Creator for Open Tibia Servers
|
||||
* File: index.php
|
||||
*
|
||||
* This is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
// uncomment if your php.ini have display_errors disabled and you want to see errors
|
||||
// ini_set('display_errors', 1);
|
||||
// ini_set('display_startup_errors', 1);
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
require_once 'common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$tmp = BASE_DIR;
|
||||
if(!empty($tmp))
|
||||
$uri = str_replace(BASE_DIR . '/', '', $uri);
|
||||
else
|
||||
$uri = str_replace_first('/', '', $uri);
|
||||
|
||||
$uri = str_replace(array('index.php/', '?'), '', $uri);
|
||||
define('URI', $uri);
|
||||
|
||||
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
||||
$tmp = explode('.', $uri);
|
||||
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||
|
||||
chdir(TOOLS . 'signature');
|
||||
include TOOLS . 'signature/index.php';
|
||||
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'])) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(file_exists(BASE . 'config.local.php'))
|
||||
require_once BASE . 'config.local.php';
|
||||
|
||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||
{
|
||||
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!');
|
||||
}
|
||||
|
||||
$found = false;
|
||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||
$_REQUEST['p'] = 'news';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$tmp = strtolower($uri);
|
||||
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
||||
$_REQUEST['p'] = $uri;
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$rules = array(
|
||||
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
|
||||
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
|
||||
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
|
||||
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
|
||||
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
|
||||
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
|
||||
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
|
||||
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
|
||||
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
|
||||
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
|
||||
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
|
||||
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
|
||||
'/^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\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
||||
'/^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'),
|
||||
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
||||
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
||||
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'),
|
||||
'/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'),
|
||||
'/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'),
|
||||
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
|
||||
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
|
||||
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
|
||||
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
|
||||
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
|
||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||
'/^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-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
|
||||
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
|
||||
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
|
||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2')
|
||||
);
|
||||
|
||||
foreach($rules as $rule => $redirect) {
|
||||
if (preg_match($rule, $uri)) {
|
||||
$tmp = explode('/', $uri);
|
||||
foreach($redirect as $key => $value) {
|
||||
|
||||
if(strpos($value, '$') !== false) {
|
||||
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
||||
}
|
||||
|
||||
$_REQUEST[$key] = $value;
|
||||
$_GET[$key] = $value;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// define page visited, so it can be used within events system
|
||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
||||
$tmp = URI;
|
||||
if(!empty($tmp)) {
|
||||
$page = $tmp;
|
||||
}
|
||||
else {
|
||||
if(!$found)
|
||||
$page = '404';
|
||||
else
|
||||
$page = 'news';
|
||||
}
|
||||
}
|
||||
|
||||
$page = strtolower($page);
|
||||
define('PAGE', $page);
|
||||
|
||||
$template_place_holders = array();
|
||||
|
||||
require_once SYSTEM . 'init.php';
|
||||
|
||||
// event system
|
||||
require_once SYSTEM . 'hooks.php';
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
require_once SYSTEM . 'template.php';
|
||||
require_once SYSTEM . 'login.php';
|
||||
require_once SYSTEM . 'status.php';
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
// database migrations
|
||||
$tmp = '';
|
||||
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
|
||||
$tmp = (int)$tmp;
|
||||
if($tmp < DATABASE_VERSION) { // import if older
|
||||
$db->revalidateCache();
|
||||
for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) {
|
||||
require(SYSTEM . 'migrations/' . $i . '.php');
|
||||
updateDatabaseConfig('database_version', $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // register first version
|
||||
registerDatabaseConfig('database_version', 0);
|
||||
$db->revalidateCache();
|
||||
for($i = 1; $i <= DATABASE_VERSION; $i++) {
|
||||
require(SYSTEM . 'migrations/' . $i . '.php');
|
||||
updateDatabaseConfig('database_version', $i);
|
||||
}
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_STARTUP);
|
||||
|
||||
// anonymous usage statistics
|
||||
// sent only when user agrees
|
||||
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
|
||||
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days
|
||||
$should_report = true;
|
||||
|
||||
$value = '';
|
||||
if($cache->enabled() && $cache->fetch('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
}
|
||||
else {
|
||||
$value = '';
|
||||
if(fetchDatabaseConfig('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', $value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week
|
||||
$should_report = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($should_report) {
|
||||
require_once(LIBS . 'usage_statistics.php');
|
||||
Usage_Statistics::report();
|
||||
|
||||
updateDatabaseConfig('last_usage_report', time());
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', time());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($config['views_counter'])
|
||||
require_once SYSTEM . 'counter.php';
|
||||
|
||||
if($config['visitors_counter'])
|
||||
{
|
||||
require_once SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
}
|
||||
|
||||
// page content loading
|
||||
if(!isset($content[0]))
|
||||
$content = '';
|
||||
$load_it = true;
|
||||
|
||||
// check if site has been closed
|
||||
$site_closed = false;
|
||||
if(fetchDatabaseConfig('site_closed', $site_closed)) {
|
||||
$site_closed = ($site_closed == 1);
|
||||
if($site_closed) {
|
||||
if(!admin())
|
||||
{
|
||||
$title = getDatabaseConfig('site_closed_title');
|
||||
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
|
||||
$load_it = false;
|
||||
}
|
||||
|
||||
if(!$logged)
|
||||
{
|
||||
ob_start();
|
||||
require SYSTEM . 'pages/accountmanagement.php';
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$load_it = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
define('SITE_CLOSED', $site_closed);
|
||||
|
||||
// backward support for gesior
|
||||
if($config['backward_support']) {
|
||||
define('INITIALIZED', true);
|
||||
$SQL = $db;
|
||||
$layout_header = template_header();
|
||||
$layout_name = $template_path;
|
||||
$news_content = '';
|
||||
$tickers_content = '';
|
||||
$subtopic = PAGE;
|
||||
$main_content = '';
|
||||
|
||||
$config['access_admin_panel'] = 2;
|
||||
$group_id_of_acc_logged = 0;
|
||||
if($logged && $account_logged)
|
||||
$group_id_of_acc_logged = $account_logged->getGroupId();
|
||||
|
||||
$config['site'] = &$config;
|
||||
$config['server'] = &$config['lua'];
|
||||
$config['site']['shop_system'] = $config['gifts_system'];
|
||||
|
||||
if(!isset($config['vdarkborder']))
|
||||
$config['vdarkborder'] = '#505050';
|
||||
if(!isset($config['darkborder']))
|
||||
$config['darkborder'] = '#D4C0A1';
|
||||
if(!isset($config['lightborder']))
|
||||
$config['lightborder'] = '#F1E0C6';
|
||||
|
||||
$config['site']['download_page'] = true;
|
||||
$config['site']['serverinfo_page'] = true;
|
||||
$config['site']['screenshot_page'] = true;
|
||||
|
||||
if($config['forum'] != '')
|
||||
$config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']);
|
||||
|
||||
foreach($status as $key => $value)
|
||||
$config['status']['serverStatus_' . $key] = $value;
|
||||
}
|
||||
|
||||
if($load_it)
|
||||
{
|
||||
if(SITE_CLOSED && admin())
|
||||
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
|
||||
|
||||
if($config['backward_support'])
|
||||
require SYSTEM . 'compat_pages.php';
|
||||
|
||||
$ignore = false;
|
||||
|
||||
$logged_access = 1;
|
||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||
$logged_access = $account_logged->getAccess();
|
||||
}
|
||||
|
||||
$query =
|
||||
$db->query(
|
||||
'SELECT `id`, `title`, `body`, `php`, `hidden`' .
|
||||
' FROM `' . TABLE_PREFIX . 'pages`' .
|
||||
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
|
||||
if($query->rowCount() > 0) // found page
|
||||
{
|
||||
$ignore = true;
|
||||
$query = $query->fetch();
|
||||
$title = $query['title'];
|
||||
|
||||
if($query['php'] == '1') // execute it as php code
|
||||
{
|
||||
$tmp = substr($query['body'], 0, 10);
|
||||
if(($pos = strpos($tmp, '<?php')) !== false) {
|
||||
$tmp = preg_replace('/<\?php/', '', $query['body'], 1);
|
||||
}
|
||||
else if(($pos = strpos($tmp, '<?')) !== false) {
|
||||
$tmp = preg_replace('/<\?/', '', $query['body'], 1);
|
||||
}
|
||||
else
|
||||
$tmp = $query['body'];
|
||||
|
||||
$php_errors = array();
|
||||
function error_handler($errno, $errstr) {
|
||||
global $php_errors;
|
||||
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
|
||||
}
|
||||
set_error_handler('error_handler');
|
||||
|
||||
ob_start();
|
||||
eval($tmp);
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
restore_error_handler();
|
||||
if(isset($php_errors[0]) && superAdmin()) {
|
||||
var_dump($php_errors);
|
||||
}
|
||||
}
|
||||
else
|
||||
$content .= $query['body']; // plain html
|
||||
|
||||
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
|
||||
$content = $twig->render('admin.pages.links.html.twig', array(
|
||||
'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
|
||||
)) . $content;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
||||
if(!@file_exists($file))
|
||||
{
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
if($hooks->trigger(HOOK_BEFORE_PAGE)) {
|
||||
if(!$ignore)
|
||||
require $file;
|
||||
}
|
||||
|
||||
if($config['backward_support'] && isset($main_content[0]))
|
||||
$content .= $main_content;
|
||||
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$hooks->trigger(HOOK_AFTER_PAGE);
|
||||
}
|
||||
|
||||
if($config['backward_support']) {
|
||||
$main_content = $content;
|
||||
if(!isset($title))
|
||||
$title = ucfirst($page);
|
||||
|
||||
$topic = $title;
|
||||
}
|
||||
|
||||
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
||||
if(file_exists($template_path . '/index.php'))
|
||||
require($template_path . '/index.php');
|
||||
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'))
|
||||
{
|
||||
require($template_path . '/layout.php');
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: save more info to log file
|
||||
die('ERROR: Cannot load template.');
|
||||
}
|
||||
|
||||
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
|
||||
if(superAdmin()) {
|
||||
echo '<!-- Generated in: ' . round(microtime(true) - START_TIME, 4) . 'ms -->';
|
||||
echo PHP_EOL . '<!-- Queries done: ' . $db->queries() . ' -->';
|
||||
if(function_exists('memory_get_peak_usage')) {
|
||||
echo PHP_EOL . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
|
||||
}
|
||||
|
||||
if($config['database_log']) {
|
||||
echo PHP_EOL . '<!-- Database Queries Done by MyAAC:' . PHP_EOL . $db->getLog() . '-->';
|
||||
}
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_FINISH);
|
||||
?>
|
||||
<?php
|
||||
/**
|
||||
* Project: MyAAC
|
||||
* Automatic Account Creator for Open Tibia Servers
|
||||
* File: index.php
|
||||
*
|
||||
* This is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* 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,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* @package MyAAC
|
||||
* @author Slawkens <slawkens@gmail.com>
|
||||
* @copyright 2017 MyAAC
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
|
||||
// uncomment if your php.ini have display_errors disabled and you want to see errors
|
||||
// ini_set('display_errors', 1);
|
||||
// ini_set('display_startup_errors', 1);
|
||||
// error_reporting(E_ALL);
|
||||
|
||||
require_once 'common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
|
||||
$tmp = BASE_DIR;
|
||||
if(!empty($tmp))
|
||||
$uri = str_replace(BASE_DIR . '/', '', $uri);
|
||||
else
|
||||
$uri = str_replace_first('/', '', $uri);
|
||||
|
||||
$uri = str_replace(array('index.php/', '?'), '', $uri);
|
||||
define('URI', $uri);
|
||||
|
||||
if(preg_match("/^[A-Za-z0-9-_%\'+]+\.png$/i", $uri)) {
|
||||
$tmp = explode('.', $uri);
|
||||
$_REQUEST['name'] = urldecode($tmp[0]);
|
||||
|
||||
chdir(TOOLS . 'signature');
|
||||
include TOOLS . 'signature/index.php';
|
||||
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'])) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit;
|
||||
}
|
||||
|
||||
if(file_exists(BASE . 'config.local.php'))
|
||||
require_once BASE . 'config.local.php';
|
||||
|
||||
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
||||
{
|
||||
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!');
|
||||
}
|
||||
|
||||
$found = false;
|
||||
if(empty($uri) || isset($_REQUEST['template'])) {
|
||||
$_REQUEST['p'] = 'news';
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$tmp = strtolower($uri);
|
||||
if(!preg_match('/[^A-z0-9_\-]/', $uri) && file_exists(SYSTEM . 'pages/' . $tmp . '.php')) {
|
||||
$_REQUEST['p'] = $uri;
|
||||
$found = true;
|
||||
}
|
||||
else {
|
||||
$rules = array(
|
||||
'/^account\/manage\/?$/' => array('subtopic' => 'accountmanagement'),
|
||||
'/^account\/create\/?$/' => array('subtopic' => 'createaccount'),
|
||||
'/^account\/lost\/?$/' => array('subtopic' => 'lostaccount'),
|
||||
'/^account\/logout\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'logout'),
|
||||
'/^account\/password\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_password'),
|
||||
'/^account\/register\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register'),
|
||||
'/^account\/register\/new\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'register_new'),
|
||||
'/^account\/email\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_email'),
|
||||
'/^account\/info\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_info'),
|
||||
'/^account\/character\/create\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'create_character'),
|
||||
'/^account\/character\/name\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_name'),
|
||||
'/^account\/character\/sex\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_sex'),
|
||||
'/^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\/?$/' => array('subtopic' => 'accountmanagement', 'action' => 'change_comment'),
|
||||
'/^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'),
|
||||
'/^changelog\/[0-9]+\/?$/' => array('subtopic' => 'changelog', 'page' => '$1'),
|
||||
'/^commands\/add\/?$/' => array('subtopic' => 'commands', 'action' => 'add'),
|
||||
'/^commands\/edit\/?$/' => array('subtopic' => 'commands', 'action' => 'edit'),
|
||||
'/^faq\/add\/?$/' => array('subtopic' => 'faq', 'action' => 'add'),
|
||||
'/^faq\/edit\/?$/' => array('subtopic' => 'faq', 'action' => 'edit'),
|
||||
'/^forum\/add_board\/?$/' => array('subtopic' => 'forum', 'action' => 'add_board'),#
|
||||
'/^forum\/edit_board\/?$/' => array('subtopic' => 'forum', 'action' => 'edit_board'),
|
||||
'/^forum\/board\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2'),
|
||||
'/^forum\/board\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_board', 'id' => '$2', 'page' => '$3'),
|
||||
'/^forum\/thread\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2'),
|
||||
'/^forum\/thread\/[0-9]+\/[0-9]+\/?$/' => array('subtopic' => 'forum', 'action' => 'show_thread', 'id' => '$2', 'page' => '$3'),
|
||||
'/^gallery\/add\/?$/' => array('subtopic' => 'gallery', 'action' => 'add'),
|
||||
'/^gallery\/edit\/?$/' => array('subtopic' => 'gallery', 'action' => 'edit'),
|
||||
'/^gallery\/[0-9]+\/?$/' => array('subtopic' => 'gallery', 'image' => '$1'),
|
||||
'/^gifts\/history\/?$/' => array('subtopic' => 'gifts', 'action' => 'show_history'),
|
||||
'/^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-_]+\/[0-9]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'page' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1', 'vocation' => '$2'),
|
||||
'/^highscores\/[A-Za-z0-9-_\']+\/?$/' => array('subtopic' => 'highscores', 'list' => '$1'),
|
||||
'/^news\/add\/?$/' => array('subtopic' => 'news', 'action' => 'add'),
|
||||
'/^news\/edit\/?$/' => array('subtopic' => 'news', 'action' => 'edit'),
|
||||
'/^news\/archive\/?$/' => array('subtopic' => 'newsarchive'),
|
||||
'/^news\/archive\/[0-9]+\/?$/' => array('subtopic' => 'newsarchive', 'id' => '$2'),
|
||||
'/^polls\/[0-9]+\/?$/' => array('subtopic' => 'polls', 'id' => '$1'),
|
||||
'/^spells\/[A-Za-z0-9-_%]+\/[A-Za-z0-9-_]+\/?$/' => array('subtopic' => 'spells', 'vocation' => '$1', 'order' => '$2')
|
||||
);
|
||||
|
||||
foreach($rules as $rule => $redirect) {
|
||||
if (preg_match($rule, $uri)) {
|
||||
$tmp = explode('/', $uri);
|
||||
foreach($redirect as $key => $value) {
|
||||
|
||||
if(strpos($value, '$') !== false) {
|
||||
$value = str_replace('$' . $value[1], $tmp[$value[1]], $value);
|
||||
}
|
||||
|
||||
$_REQUEST[$key] = $value;
|
||||
$_GET[$key] = $value;
|
||||
}
|
||||
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// define page visited, so it can be used within events system
|
||||
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_REQUEST['p']) ? $_REQUEST['p'] : '');
|
||||
if(empty($page) || !preg_match('/^[A-z0-9\_\-]+$/', $page)) {
|
||||
$tmp = URI;
|
||||
if(!empty($tmp)) {
|
||||
$page = $tmp;
|
||||
}
|
||||
else {
|
||||
if(!$found)
|
||||
$page = '404';
|
||||
else
|
||||
$page = 'news';
|
||||
}
|
||||
}
|
||||
|
||||
$page = strtolower($page);
|
||||
define('PAGE', $page);
|
||||
|
||||
$template_place_holders = array();
|
||||
|
||||
require_once SYSTEM . 'init.php';
|
||||
|
||||
// event system
|
||||
require_once SYSTEM . 'hooks.php';
|
||||
$hooks = new Hooks();
|
||||
$hooks->load();
|
||||
require_once SYSTEM . 'template.php';
|
||||
require_once SYSTEM . 'login.php';
|
||||
require_once SYSTEM . 'status.php';
|
||||
|
||||
$twig->addGlobal('config', $config);
|
||||
$twig->addGlobal('status', $status);
|
||||
|
||||
// database migrations
|
||||
$tmp = '';
|
||||
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
|
||||
$tmp = (int)$tmp;
|
||||
if($tmp < DATABASE_VERSION) { // import if older
|
||||
$db->revalidateCache();
|
||||
for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) {
|
||||
require SYSTEM . 'migrations/' . $i . '.php';
|
||||
updateDatabaseConfig('database_version', $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // register first version
|
||||
registerDatabaseConfig('database_version', 0);
|
||||
$db->revalidateCache();
|
||||
for($i = 1; $i <= DATABASE_VERSION; $i++) {
|
||||
require SYSTEM . 'migrations/' . $i . '.php';
|
||||
updateDatabaseConfig('database_version', $i);
|
||||
}
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_STARTUP);
|
||||
|
||||
// anonymous usage statistics
|
||||
// sent only when user agrees
|
||||
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
|
||||
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days
|
||||
$should_report = true;
|
||||
|
||||
$value = '';
|
||||
if($cache->enabled() && $cache->fetch('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
}
|
||||
else {
|
||||
$value = '';
|
||||
if(fetchDatabaseConfig('last_usage_report', $value)) {
|
||||
$should_report = time() > (int)$value + $report_time;
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', $value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week
|
||||
$should_report = false;
|
||||
}
|
||||
}
|
||||
|
||||
if($should_report) {
|
||||
require_once(LIBS . 'usage_statistics.php');
|
||||
Usage_Statistics::report();
|
||||
|
||||
updateDatabaseConfig('last_usage_report', time());
|
||||
if($cache->enabled()) {
|
||||
$cache->set('last_usage_report', time());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($config['views_counter'])
|
||||
require_once SYSTEM . 'counter.php';
|
||||
|
||||
if($config['visitors_counter'])
|
||||
{
|
||||
require_once SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
}
|
||||
|
||||
// page content loading
|
||||
if(!isset($content[0]))
|
||||
$content = '';
|
||||
$load_it = true;
|
||||
|
||||
// check if site has been closed
|
||||
$site_closed = false;
|
||||
if(fetchDatabaseConfig('site_closed', $site_closed)) {
|
||||
$site_closed = ($site_closed == 1);
|
||||
if($site_closed) {
|
||||
if(!admin())
|
||||
{
|
||||
$title = getDatabaseConfig('site_closed_title');
|
||||
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
|
||||
$load_it = false;
|
||||
}
|
||||
|
||||
if(!$logged)
|
||||
{
|
||||
ob_start();
|
||||
require SYSTEM . 'pages/accountmanagement.php';
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$load_it = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
define('SITE_CLOSED', $site_closed);
|
||||
|
||||
// backward support for gesior
|
||||
if($config['backward_support']) {
|
||||
define('INITIALIZED', true);
|
||||
$SQL = $db;
|
||||
$layout_header = template_header();
|
||||
$layout_name = $template_path;
|
||||
$news_content = '';
|
||||
$tickers_content = '';
|
||||
$subtopic = PAGE;
|
||||
$main_content = '';
|
||||
|
||||
$config['access_admin_panel'] = 2;
|
||||
$group_id_of_acc_logged = 0;
|
||||
if($logged && $account_logged)
|
||||
$group_id_of_acc_logged = $account_logged->getGroupId();
|
||||
|
||||
$config['site'] = &$config;
|
||||
$config['server'] = &$config['lua'];
|
||||
$config['site']['shop_system'] = $config['gifts_system'];
|
||||
|
||||
if(!isset($config['vdarkborder']))
|
||||
$config['vdarkborder'] = '#505050';
|
||||
if(!isset($config['darkborder']))
|
||||
$config['darkborder'] = '#D4C0A1';
|
||||
if(!isset($config['lightborder']))
|
||||
$config['lightborder'] = '#F1E0C6';
|
||||
|
||||
$config['site']['download_page'] = true;
|
||||
$config['site']['serverinfo_page'] = true;
|
||||
$config['site']['screenshot_page'] = true;
|
||||
|
||||
if($config['forum'] != '')
|
||||
$config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']);
|
||||
|
||||
foreach($status as $key => $value)
|
||||
$config['status']['serverStatus_' . $key] = $value;
|
||||
}
|
||||
|
||||
if($load_it)
|
||||
{
|
||||
if(SITE_CLOSED && admin())
|
||||
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
|
||||
|
||||
if($config['backward_support'])
|
||||
require SYSTEM . 'compat_pages.php';
|
||||
|
||||
$ignore = false;
|
||||
|
||||
$logged_access = 1;
|
||||
if($logged && $account_logged && $account_logged->isLoaded()) {
|
||||
$logged_access = $account_logged->getAccess();
|
||||
}
|
||||
|
||||
$query =
|
||||
$db->query(
|
||||
'SELECT `id`, `title`, `body`, `php`, `hidden`' .
|
||||
' FROM `' . TABLE_PREFIX . 'pages`' .
|
||||
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
|
||||
if($query->rowCount() > 0) // found page
|
||||
{
|
||||
$ignore = true;
|
||||
$query = $query->fetch();
|
||||
$title = $query['title'];
|
||||
|
||||
if($query['php'] == '1') // execute it as php code
|
||||
{
|
||||
$tmp = substr($query['body'], 0, 10);
|
||||
if(($pos = strpos($tmp, '<?php')) !== false) {
|
||||
$tmp = preg_replace('/<\?php/', '', $query['body'], 1);
|
||||
}
|
||||
else if(($pos = strpos($tmp, '<?')) !== false) {
|
||||
$tmp = preg_replace('/<\?/', '', $query['body'], 1);
|
||||
}
|
||||
else
|
||||
$tmp = $query['body'];
|
||||
|
||||
$php_errors = array();
|
||||
function error_handler($errno, $errstr) {
|
||||
global $php_errors;
|
||||
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
|
||||
}
|
||||
set_error_handler('error_handler');
|
||||
|
||||
ob_start();
|
||||
eval($tmp);
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
restore_error_handler();
|
||||
if(isset($php_errors[0]) && superAdmin()) {
|
||||
var_dump($php_errors);
|
||||
}
|
||||
}
|
||||
else
|
||||
$content .= $query['body']; // plain html
|
||||
|
||||
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
|
||||
$content = $twig->render('admin.pages.links.html.twig', array(
|
||||
'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
|
||||
)) . $content;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$file = SYSTEM . 'pages/' . $page . '.php';
|
||||
if(!@file_exists($file))
|
||||
{
|
||||
$page = '404';
|
||||
$file = SYSTEM . 'pages/404.php';
|
||||
}
|
||||
}
|
||||
|
||||
ob_start();
|
||||
if($hooks->trigger(HOOK_BEFORE_PAGE)) {
|
||||
if(!$ignore)
|
||||
require $file;
|
||||
}
|
||||
|
||||
if($config['backward_support'] && isset($main_content[0]))
|
||||
$content .= $main_content;
|
||||
|
||||
$content .= ob_get_contents();
|
||||
ob_end_clean();
|
||||
$hooks->trigger(HOOK_AFTER_PAGE);
|
||||
}
|
||||
|
||||
if($config['backward_support']) {
|
||||
$main_content = $content;
|
||||
if(!isset($title))
|
||||
$title = ucfirst($page);
|
||||
|
||||
$topic = $title;
|
||||
}
|
||||
|
||||
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
|
||||
if(file_exists($template_path . '/index.php'))
|
||||
require $template_path . '/index.php';
|
||||
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'))
|
||||
{
|
||||
require $template_path . '/layout.php';
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: save more info to log file
|
||||
die('ERROR: Cannot load template.');
|
||||
}
|
||||
|
||||
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
|
||||
if(superAdmin()) {
|
||||
echo '<!-- Generated in: ' . round(microtime(true) - START_TIME, 4) . 'ms -->';
|
||||
echo PHP_EOL . '<!-- Queries done: ' . $db->queries() . ' -->';
|
||||
if(function_exists('memory_get_peak_usage')) {
|
||||
echo PHP_EOL . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
|
||||
}
|
||||
|
||||
if($config['database_log']) {
|
||||
echo PHP_EOL . '<!-- Database Queries Done by MyAAC:' . PHP_EOL . $db->getLog() . '-->';
|
||||
}
|
||||
}
|
||||
|
||||
$hooks->trigger(HOOK_FINISH);
|
||||
?>
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
require(SYSTEM . 'libs/pot/OTS.php');
|
||||
require SYSTEM . 'libs/pot/OTS.php';
|
||||
$ots = POT::getInstance();
|
||||
require(SYSTEM . 'database.php');
|
||||
require SYSTEM . 'database.php';
|
||||
|
||||
if(!isset($db)) {
|
||||
$database_error = $locale['step_database_error_mysql_connect'] . '<br/>' .
|
||||
|
@ -31,13 +31,13 @@ else
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!isset($locale_))
|
||||
$locale_ = 'en';
|
||||
}
|
||||
|
||||
require(LOCALE . 'en/main.php');
|
||||
require(LOCALE . 'en/install.php');
|
||||
require LOCALE . 'en/main.php';
|
||||
require LOCALE . 'en/install.php';
|
||||
|
||||
$file_main = LOCALE . $locale_ . '/main.php';
|
||||
if(!file_exists($file_main))
|
||||
@ -47,6 +47,6 @@ $file_install = LOCALE . $locale_ . '/install.php';
|
||||
if(!file_exists($file_install))
|
||||
$file_install = LOCALE . 'en/install.php';
|
||||
|
||||
require($file_main);
|
||||
require($file_install);
|
||||
require $file_main;
|
||||
require $file_install;
|
||||
?>
|
@ -1,16 +1,16 @@
|
||||
<?php
|
||||
require('../common.php');
|
||||
require '../common.php';
|
||||
|
||||
define('MYAAC_INSTALL', true);
|
||||
|
||||
// includes
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(BASE . 'install/includes/functions.php');
|
||||
require(BASE . 'install/includes/locale.php');
|
||||
require(SYSTEM . 'clients.conf.php');
|
||||
require SYSTEM . 'functions.php';
|
||||
require BASE . 'install/includes/functions.php';
|
||||
require BASE . 'install/includes/locale.php';
|
||||
require SYSTEM . 'clients.conf.php';
|
||||
|
||||
if(file_exists(BASE . 'config.local.php'))
|
||||
require(BASE . 'config.local.php');
|
||||
require BASE . 'config.local.php';
|
||||
|
||||
// twig
|
||||
require_once LIBS . 'Twig/Autoloader.php';
|
||||
@ -181,7 +181,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
|
||||
ob_start();
|
||||
|
||||
$step_id = array_search($step, $steps);
|
||||
require('steps/' . $step_id . '-' . $step . '.php');
|
||||
require 'steps/' . $step_id . '-' . $step . '.php';
|
||||
$content = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
@ -192,5 +192,5 @@ else {
|
||||
}
|
||||
|
||||
// render
|
||||
require('template/template.php');
|
||||
require 'template/template.php';
|
||||
//$_SESSION['laststep'] = $step;
|
@ -14,7 +14,7 @@ else {
|
||||
if(@file_exists($lang_file_main)
|
||||
&& @file_exists($lang_file_install))
|
||||
{
|
||||
require($lang_file_main);
|
||||
require $lang_file_main;
|
||||
$locales[] = array('id' => $tmp_locale, 'name' => $locale['name']);
|
||||
}
|
||||
}
|
||||
|
@ -40,13 +40,13 @@ if(!$error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require(BASE . 'install/includes/config.php');
|
||||
|
||||
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
if(!$error) {
|
||||
success($locale['step_database_importing']);
|
||||
require(BASE . 'install/includes/database.php');
|
||||
|
||||
require BASE . 'install/includes/database.php';
|
||||
|
||||
if(isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
require(BASE . 'install/includes/config.php');
|
||||
require BASE . 'install/includes/config.php';
|
||||
if(!$error) {
|
||||
require(BASE . 'install/includes/database.php');
|
||||
|
||||
require BASE . 'install/includes/database.php';
|
||||
|
||||
if(isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save
|
||||
warning($locale['already_installed']);
|
||||
}
|
||||
else {
|
||||
require(SYSTEM . 'init.php');
|
||||
require SYSTEM . 'init.php';
|
||||
if(!$error) {
|
||||
if(USE_ACCOUNT_NAME)
|
||||
$account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : null;
|
||||
|
@ -1,19 +1,19 @@
|
||||
<?php
|
||||
require_once('../../common.php');
|
||||
require_once '../../common.php';
|
||||
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(BASE . 'install/includes/functions.php');
|
||||
require(BASE . 'install/includes/locale.php');
|
||||
require SYSTEM . 'functions.php';
|
||||
require BASE . 'install/includes/functions.php';
|
||||
require BASE . 'install/includes/locale.php';
|
||||
|
||||
$error = false;
|
||||
require(BASE . 'install/includes/config.php');
|
||||
require BASE . 'install/includes/config.php';
|
||||
|
||||
ini_set('max_execution_time', 300);
|
||||
ob_implicit_flush();
|
||||
ob_end_flush();
|
||||
|
||||
if(!$error) {
|
||||
require(BASE . 'install/includes/database.php');
|
||||
require BASE . 'install/includes/database.php';
|
||||
if(isset($database_error)) { // we failed connect to the database
|
||||
error($database_error);
|
||||
return;
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
require_once('../../common.php');
|
||||
require_once '../../common.php';
|
||||
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(BASE . 'install/includes/functions.php');
|
||||
require(BASE . 'install/includes/locale.php');
|
||||
require SYSTEM . 'functions.php';
|
||||
require BASE . 'install/includes/functions.php';
|
||||
require BASE . 'install/includes/locale.php';
|
||||
|
||||
ini_set('max_execution_time', 300);
|
||||
ob_implicit_flush();
|
||||
@ -14,7 +14,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save
|
||||
return;
|
||||
}
|
||||
|
||||
require(SYSTEM . 'init.php');
|
||||
require SYSTEM . 'init.php';
|
||||
|
||||
$deleted = 'deleted';
|
||||
if($db->hasColumn('players', 'deletion'))
|
||||
@ -42,19 +42,19 @@ if($success) {
|
||||
success($locale['step_database_imported_players']);
|
||||
}
|
||||
|
||||
require(LIBS . 'items.php');
|
||||
require LIBS . 'items.php';
|
||||
if(Items::loadFromXML())
|
||||
success($locale['step_database_loaded_items']);
|
||||
else
|
||||
error(Items::getError());
|
||||
|
||||
require(LIBS . 'weapons.php');
|
||||
require LIBS . 'weapons.php';
|
||||
if(Weapons::loadFromXML())
|
||||
success($locale['step_database_loaded_weapons']);
|
||||
else
|
||||
error(Weapons::getError());
|
||||
|
||||
require(LIBS . 'creatures.php');
|
||||
require LIBS . 'creatures.php';
|
||||
if(Creatures::loadFromXML()) {
|
||||
success($locale['step_database_loaded_monsters']);
|
||||
|
||||
@ -67,7 +67,7 @@ else {
|
||||
error(Creatures::getLastError());
|
||||
}
|
||||
|
||||
require(LIBS . 'spells.php');
|
||||
require LIBS . 'spells.php';
|
||||
if(Spells::loadFromXML()) {
|
||||
success($locale['step_database_loaded_spells']);
|
||||
}
|
||||
@ -76,7 +76,7 @@ else {
|
||||
}
|
||||
|
||||
// update config.highscores_ids_hidden
|
||||
require_once(SYSTEM . 'migrations/20.php');
|
||||
require_once SYSTEM . 'migrations/20.php';
|
||||
$database_migration_20 = true;
|
||||
$content = '';
|
||||
if(!databaseMigration20($content)) {
|
||||
@ -86,7 +86,7 @@ if(!databaseMigration20($content)) {
|
||||
}
|
||||
|
||||
// add z_polls tables
|
||||
require_once(SYSTEM . 'migrations/22.php');
|
||||
require_once SYSTEM . 'migrations/22.php';
|
||||
|
||||
$locale['step_finish_desc'] = str_replace('$ADMIN_PANEL$', generateLink(str_replace('tools/', '',ADMIN_URL), $locale['step_finish_admin_panel'], true), $locale['step_finish_desc']);
|
||||
$locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(str_replace('tools/', '', BASE_URL), $locale['step_finish_homepage'], true), $locale['step_finish_desc']);
|
||||
|
@ -4,11 +4,11 @@ if(php_sapi_name() != "cli") {
|
||||
die('This script can be run only in command line mode.');
|
||||
}
|
||||
|
||||
require_once('../../common.php');
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
require_once(SYSTEM . 'init.php');
|
||||
require_once(SYSTEM . 'hooks.php');
|
||||
require_once(LIBS . 'plugins.php');
|
||||
require_once '../../common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
require_once SYSTEM . 'init.php';
|
||||
require_once SYSTEM . 'hooks.php';
|
||||
require_once LIBS . 'plugins.php';
|
||||
|
||||
if($argc != 2) {
|
||||
exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL);
|
||||
|
@ -47,7 +47,7 @@ class Hook
|
||||
|
||||
global $db, $config, $template_path, $ots, $content, $twig;
|
||||
if(file_exists(BASE . $this->_file)) {
|
||||
$ret = require(BASE . $this->_file);
|
||||
$ret = require BASE . $this->_file;
|
||||
}
|
||||
|
||||
return $ret === null || $ret == 1 || $ret;
|
||||
|
@ -120,9 +120,9 @@ if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hid
|
||||
}
|
||||
|
||||
// POT
|
||||
require_once(SYSTEM . 'libs/pot/OTS.php');
|
||||
require_once SYSTEM . 'libs/pot/OTS.php';
|
||||
$ots = POT::getInstance();
|
||||
require_once(SYSTEM . 'database.php');
|
||||
require_once SYSTEM . 'database.php';
|
||||
|
||||
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
|
||||
// load vocation names
|
||||
|
@ -8,7 +8,7 @@
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
require_once(SYSTEM . 'libs/items_images.php');
|
||||
require_once SYSTEM . 'libs/items_images.php';
|
||||
|
||||
Items_Images::$files = array(
|
||||
'otb' => SYSTEM . 'data/items.otb',
|
||||
|
@ -19,27 +19,27 @@ class Cache
|
||||
if(!self::$instance) {
|
||||
switch(strtolower($engine)) {
|
||||
case 'apc':
|
||||
require('cache_apc.php');
|
||||
require 'cache_apc.php';
|
||||
self::$instance = new Cache_APC($prefix);
|
||||
break;
|
||||
|
||||
case 'apcu':
|
||||
require('cache_apcu.php');
|
||||
require 'cache_apcu.php';
|
||||
self::$instance = new Cache_APCu($prefix);
|
||||
break;
|
||||
|
||||
case 'eaccelerator':
|
||||
require('cache_eaccelerator.php');
|
||||
require 'cache_eaccelerator.php';
|
||||
self::$instance = new Cache_eAccelerator($prefix);
|
||||
break;
|
||||
|
||||
case 'xcache':
|
||||
require('cache_xcache.php');
|
||||
require 'cache_xcache.php';
|
||||
self::$instance = new Cache_XCache($prefix);
|
||||
break;
|
||||
|
||||
case 'file':
|
||||
require('cache_file.php');
|
||||
require 'cache_file.php';
|
||||
self::$instance = new Cache_File($prefix, CACHE);
|
||||
break;
|
||||
|
||||
|
@ -236,7 +236,7 @@ class Plugins {
|
||||
if (isset($plugin['install'])) {
|
||||
if (file_exists(BASE . $plugin['install'])) {
|
||||
$db->revalidateCache();
|
||||
require(BASE . $plugin['install']);
|
||||
require BASE . $plugin['install'];
|
||||
$db->revalidateCache();
|
||||
}
|
||||
else
|
||||
|
@ -11,6 +11,6 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
if($action == 'confirm_email') {
|
||||
require_once(PAGES . 'account/confirm_email.php');
|
||||
require_once PAGES . 'account/confirm_email.php';
|
||||
}
|
||||
?>
|
||||
|
@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Account Management';
|
||||
|
||||
if($config['account_country'])
|
||||
require(SYSTEM . 'countries.conf.php');
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$groups = new OTS_Groups_List();
|
||||
|
||||
@ -30,7 +30,7 @@ if(ACTION == "logout" && !isset($_REQUEST['account_login'])) {
|
||||
if(!$logged)
|
||||
{
|
||||
if(ACTION == 'confirm_email') {
|
||||
require(PAGES . 'account/' . ACTION . '.php');
|
||||
require PAGES . 'account/' . ACTION . '.php';
|
||||
return;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ $errors = array();
|
||||
error('Error: Action contains illegal characters.');
|
||||
}
|
||||
else if(file_exists(PAGES . 'account/' . $action . '.php')) {
|
||||
require(PAGES . 'account/' . $action . '.php');
|
||||
require PAGES . 'account/' . $action . '.php';
|
||||
}
|
||||
else {
|
||||
error('This page does not exists.');
|
||||
|
@ -10,8 +10,8 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Load items.xml';
|
||||
|
||||
require(LIBS . 'items.php');
|
||||
require(LIBS . 'weapons.php');
|
||||
require LIBS . 'items.php';
|
||||
require LIBS . 'weapons.php';
|
||||
|
||||
echo $twig->render('admin.items.html.twig');
|
||||
|
||||
|
@ -49,7 +49,7 @@ if(isset($_REQUEST['template'])) {
|
||||
|
||||
$file = TEMPLATES . $template . '/config.php';
|
||||
if(file_exists($file)) {
|
||||
require_once($file);
|
||||
require_once $file;
|
||||
}
|
||||
else {
|
||||
echo 'Cannot find template config.php file.';
|
||||
|
@ -10,7 +10,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Plugin manager';
|
||||
|
||||
require(LIBS . 'plugins.php');
|
||||
require LIBS . 'plugins.php';
|
||||
|
||||
echo $twig->render('admin.plugins.form.html.twig');
|
||||
|
||||
|
@ -25,5 +25,5 @@ if(preg_match("/[^A-z0-9_\-]/", $tool))
|
||||
|
||||
$file = BASE . 'admin/pages/tools/' . $tool . '.php';
|
||||
if(!@file_exists($file))
|
||||
require($file);
|
||||
require $file;
|
||||
?>
|
||||
|
@ -18,7 +18,7 @@ You can enable it by editing this configurable in <b>config.local.php</b> file:<
|
||||
return;
|
||||
endif;
|
||||
|
||||
require(SYSTEM . 'libs/visitors.php');
|
||||
require SYSTEM . 'libs/visitors.php';
|
||||
$visitors = new Visitors($config['visitors_counter_ttl']);
|
||||
|
||||
function compare($a, $b) {
|
||||
|
@ -11,7 +11,7 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Characters';
|
||||
|
||||
require_once(SYSTEM . 'item.php');
|
||||
require_once SYSTEM . 'item.php';
|
||||
|
||||
$groups = new OTS_Groups_List();
|
||||
function generate_search_form($autofocus = false)
|
||||
|
@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Create Account';
|
||||
|
||||
if($config['account_country'])
|
||||
require(SYSTEM . 'countries.conf.php');
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
if($logged)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ if(strtolower($config['forum']) != 'site')
|
||||
if(!$logged)
|
||||
echo 'You are not logged in. <a href="?subtopic=accountmanagement&redirect=' . BASE_URL . urlencode('?subtopic=forum') . '">Log in</a> to post on the forum.<br /><br />';
|
||||
|
||||
require_once(LIBS . 'forum.php');
|
||||
require_once LIBS . 'forum.php';
|
||||
|
||||
$canEdit = Forum::isModerator();
|
||||
if($canEdit)
|
||||
|
@ -20,14 +20,14 @@ define('MOTD_EXISTS', $db->hasColumn('guilds', 'motd'));
|
||||
|
||||
//show list of guilds
|
||||
if(empty($action)) {
|
||||
require(PAGES . 'guilds/list_of_guilds.php');
|
||||
require PAGES . 'guilds/list_of_guilds.php';
|
||||
}
|
||||
else {
|
||||
if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) {
|
||||
error('Error: Action contains illegal characters.');
|
||||
}
|
||||
else if(file_exists(PAGES . 'guilds/' . $action . '.php')) {
|
||||
require(PAGES . 'guilds/' . $action . '.php');
|
||||
require PAGES . 'guilds/' . $action . '.php';
|
||||
}
|
||||
else {
|
||||
error('This page does not exists.');
|
||||
|
@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Highscores';
|
||||
|
||||
if($config['account_country'] && $config['highscores_country_box'])
|
||||
require(SYSTEM . 'countries.conf.php');
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$list = isset($_GET['list']) ? $_GET['list'] : '';
|
||||
$_page = isset($_GET['page']) ? $_GET['page'] : 0;
|
||||
|
@ -10,7 +10,7 @@
|
||||
*/
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
|
||||
require_once(LIBS . 'forum.php');
|
||||
require_once LIBS . 'forum.php';
|
||||
|
||||
if(isset($_GET['archive']))
|
||||
{
|
||||
|
@ -9,5 +9,5 @@
|
||||
* @link http://my-aac.org
|
||||
*/
|
||||
$_GET['archive'] = true;
|
||||
require('news.php');
|
||||
require 'news.php';
|
||||
?>
|
||||
|
@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Who is online?';
|
||||
|
||||
if($config['account_country'])
|
||||
require(SYSTEM . 'countries.conf.php');
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$promotion = '';
|
||||
if($db->hasColumn('players', 'promotion'))
|
||||
|
@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Gamemasters List';
|
||||
|
||||
if($config['account_country'])
|
||||
require(SYSTEM . 'countries.conf.php');
|
||||
require SYSTEM . 'countries.conf.php';
|
||||
|
||||
$groups = new OTS_Groups_List();
|
||||
if(!$groups->count())
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
//require('../../common.php');
|
||||
//require '../../common.php';
|
||||
|
||||
//$text = $_GET['text'];
|
||||
/*
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
require('../common.php');
|
||||
require(SYSTEM . 'item.php');
|
||||
require '../common.php';
|
||||
require SYSTEM . 'item.php';
|
||||
|
||||
if(isset($_GET['id']))
|
||||
outputItem($_GET['id'], $_GET['count']);
|
||||
|
@ -10,10 +10,10 @@
|
||||
*/
|
||||
|
||||
// we need some functions
|
||||
require('../common.php');
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
require_once(SYSTEM . 'init.php');
|
||||
require_once(SYSTEM . 'template.php');
|
||||
require '../common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
require_once SYSTEM . 'init.php';
|
||||
require_once SYSTEM . 'template.php';
|
||||
|
||||
$error = '';
|
||||
if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $_GET['forum_section'], $_GET['template_path'], $_GET['type']))
|
||||
|
@ -8,9 +8,9 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once('../../common.php');
|
||||
require_once(SYSTEM . 'functions.php');
|
||||
require_once(SYSTEM . 'init.php');
|
||||
require_once '../../common.php';
|
||||
require_once SYSTEM . 'functions.php';
|
||||
require_once SYSTEM . 'init.php';
|
||||
|
||||
// Definitions
|
||||
define('SIGNATURES', TOOLS . 'signature/');
|
||||
@ -59,7 +59,7 @@
|
||||
exit;
|
||||
}
|
||||
|
||||
require($file);
|
||||
require $file;
|
||||
header('Content-type: image/png');
|
||||
$seconds_to_cache = $config['signature_browser_cache'] * 60;
|
||||
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
|
||||
|
@ -6,7 +6,7 @@
|
||||
**/
|
||||
|
||||
/** Load the MadGD class **/
|
||||
require('gd.class.php');
|
||||
require 'gd.class.php';
|
||||
/** Default values **/
|
||||
list( $i, $eachRow, $percent ) = array( .5, 14, array( 'size' => 7 ) );
|
||||
/** Get experience points for a certain level **/
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
require('../common.php');
|
||||
require(SYSTEM . 'init.php');
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(SYSTEM . 'status.php');
|
||||
require(SYSTEM . 'login.php');
|
||||
require '../common.php';
|
||||
require SYSTEM . 'init.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'status.php';
|
||||
require SYSTEM . 'login.php';
|
||||
|
||||
if(!admin())
|
||||
die('Access denied.');
|
||||
|
@ -10,9 +10,9 @@
|
||||
*/
|
||||
|
||||
// we need some functions
|
||||
require('../common.php');
|
||||
require(SYSTEM . 'functions.php');
|
||||
require(SYSTEM . 'init.php');
|
||||
require '../common.php';
|
||||
require SYSTEM . 'functions.php';
|
||||
require SYSTEM . 'init.php';
|
||||
|
||||
$error = '';
|
||||
if(isset($_GET['account']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user