* remove unnecessary parentheses in include/require

This commit is contained in:
slawkens 2018-05-29 21:00:56 +02:00
parent e1ddf58119
commit 42d23e9b37
42 changed files with 554 additions and 554 deletions

View File

@ -1,7 +1,7 @@
<?php <?php
// few things we'll need // few things we'll need
require('../common.php'); require '../common.php';
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']))
{ {
@ -21,17 +21,17 @@ if(empty($page) || preg_match("/[^a-zA-Z0-9_\-]/", $page))
$page = strtolower($page); $page = strtolower($page);
define('PAGE', $page); define('PAGE', $page);
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
// event system // event system
require_once(SYSTEM . 'hooks.php'); require_once SYSTEM . 'hooks.php';
$hooks = new Hooks(); $hooks = new Hooks();
$hooks->load(); $hooks->load();
require(SYSTEM . 'status.php'); require SYSTEM . 'status.php';
require(SYSTEM . 'login.php'); require SYSTEM . 'login.php';
require(ADMIN . 'includes/functions.php'); require ADMIN . 'includes/functions.php';
$twig->addGlobal('config', $config); $twig->addGlobal('config', $config);
$twig->addGlobal('status', $status); $twig->addGlobal('status', $status);
@ -41,7 +41,7 @@ if(!$logged || !admin()) {
$page = 'login'; $page = 'login';
} }
// include our page // include our page
$file = SYSTEM . 'pages/admin/' . $page . '.php'; $file = SYSTEM . 'pages/admin/' . $page . '.php';
if(!@file_exists($file)) { if(!@file_exists($file)) {
$page = '404'; $page = '404';
@ -56,5 +56,5 @@ ob_end_clean();
// template // template
$template_path = 'template/'; $template_path = 'template/';
require(ADMIN . $template_path . 'template.php'); require ADMIN . $template_path . 'template.php';
?> ?>

View File

@ -1,8 +1,8 @@
<?php <?php
require('../../common.php'); require '../../common.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
require(SYSTEM . 'login.php'); require SYSTEM . 'login.php';
if(!admin()) if(!admin())
die('Access denied.'); die('Access denied.');

View File

@ -1,9 +1,9 @@
<?php <?php
require('../../common.php'); require '../../common.php';
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(SYSTEM . 'status.php'); require SYSTEM . 'status.php';
require(SYSTEM . 'login.php'); require SYSTEM . 'login.php';
if(!admin()) if(!admin())
die('Access denied.'); die('Access denied.');

876
index.php
View File

@ -1,438 +1,438 @@
<?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;
} }
if(file_exists(BASE . 'config.local.php')) if(file_exists(BASE . 'config.local.php'))
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')
); );
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';
// event system // event system
require_once SYSTEM . 'hooks.php'; require_once SYSTEM . 'hooks.php';
$hooks = new Hooks(); $hooks = new Hooks();
$hooks->load(); $hooks->load();
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 // database migrations
$tmp = ''; $tmp = '';
if(fetchDatabaseConfig('database_version', $tmp)) { // we got version if(fetchDatabaseConfig('database_version', $tmp)) { // we got version
$tmp = (int)$tmp; $tmp = (int)$tmp;
if($tmp < DATABASE_VERSION) { // import if older if($tmp < DATABASE_VERSION) { // import if older
$db->revalidateCache(); $db->revalidateCache();
for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) { for($i = $tmp + 1; $i <= DATABASE_VERSION; $i++) {
require(SYSTEM . 'migrations/' . $i . '.php'); require SYSTEM . 'migrations/' . $i . '.php';
updateDatabaseConfig('database_version', $i); updateDatabaseConfig('database_version', $i);
} }
} }
} }
else { // register first version else { // register first version
registerDatabaseConfig('database_version', 0); registerDatabaseConfig('database_version', 0);
$db->revalidateCache(); $db->revalidateCache();
for($i = 1; $i <= DATABASE_VERSION; $i++) { for($i = 1; $i <= DATABASE_VERSION; $i++) {
require(SYSTEM . 'migrations/' . $i . '.php'); require SYSTEM . 'migrations/' . $i . '.php';
updateDatabaseConfig('database_version', $i); updateDatabaseConfig('database_version', $i);
} }
} }
$hooks->trigger(HOOK_STARTUP); $hooks->trigger(HOOK_STARTUP);
// anonymous usage statistics // anonymous usage statistics
// sent only when user agrees // sent only when user agrees
if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) { if(isset($config['anonymous_usage_statistics']) && $config['anonymous_usage_statistics']) {
$report_time = 30 * 24 * 60 * 60; // report one time per 30 days $report_time = 30 * 24 * 60 * 60; // report one time per 30 days
$should_report = true; $should_report = true;
$value = ''; $value = '';
if($cache->enabled() && $cache->fetch('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;
} }
else { else {
$value = ''; $value = '';
if(fetchDatabaseConfig('last_usage_report', $value)) { if(fetchDatabaseConfig('last_usage_report', $value)) {
$should_report = time() > (int)$value + $report_time; $should_report = time() > (int)$value + $report_time;
if($cache->enabled()) { if($cache->enabled()) {
$cache->set('last_usage_report', $value); $cache->set('last_usage_report', $value);
} }
} }
else { else {
registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week registerDatabaseConfig('last_usage_report', time() - ($report_time - (7 * 24 * 60 * 60))); // first report after a week
$should_report = false; $should_report = false;
} }
} }
if($should_report) { if($should_report) {
require_once(LIBS . 'usage_statistics.php'); require_once(LIBS . 'usage_statistics.php');
Usage_Statistics::report(); Usage_Statistics::report();
updateDatabaseConfig('last_usage_report', time()); updateDatabaseConfig('last_usage_report', time());
if($cache->enabled()) { if($cache->enabled()) {
$cache->set('last_usage_report', time()); $cache->set('last_usage_report', time());
} }
} }
} }
if($config['views_counter']) if($config['views_counter'])
require_once SYSTEM . 'counter.php'; require_once SYSTEM . 'counter.php';
if($config['visitors_counter']) if($config['visitors_counter'])
{ {
require_once SYSTEM . 'libs/visitors.php'; require_once SYSTEM . 'libs/visitors.php';
$visitors = new Visitors($config['visitors_counter_ttl']); $visitors = new Visitors($config['visitors_counter_ttl']);
} }
// page content loading // page content loading
if(!isset($content[0])) if(!isset($content[0]))
$content = ''; $content = '';
$load_it = true; $load_it = true;
// check if site has been closed // check if site has been closed
$site_closed = false; $site_closed = false;
if(fetchDatabaseConfig('site_closed', $site_closed)) { if(fetchDatabaseConfig('site_closed', $site_closed)) {
$site_closed = ($site_closed == 1); $site_closed = ($site_closed == 1);
if($site_closed) { if($site_closed) {
if(!admin()) if(!admin())
{ {
$title = getDatabaseConfig('site_closed_title'); $title = getDatabaseConfig('site_closed_title');
$content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>'; $content .= '<p class="note">' . getDatabaseConfig('site_closed_message') . '</p><br/>';
$load_it = false; $load_it = false;
} }
if(!$logged) if(!$logged)
{ {
ob_start(); ob_start();
require SYSTEM . 'pages/accountmanagement.php'; require SYSTEM . 'pages/accountmanagement.php';
$content .= ob_get_contents(); $content .= ob_get_contents();
ob_end_clean(); ob_end_clean();
$load_it = false; $load_it = false;
} }
} }
} }
define('SITE_CLOSED', $site_closed); define('SITE_CLOSED', $site_closed);
// backward support for gesior // backward support for gesior
if($config['backward_support']) { if($config['backward_support']) {
define('INITIALIZED', true); define('INITIALIZED', true);
$SQL = $db; $SQL = $db;
$layout_header = template_header(); $layout_header = template_header();
$layout_name = $template_path; $layout_name = $template_path;
$news_content = ''; $news_content = '';
$tickers_content = ''; $tickers_content = '';
$subtopic = PAGE; $subtopic = PAGE;
$main_content = ''; $main_content = '';
$config['access_admin_panel'] = 2; $config['access_admin_panel'] = 2;
$group_id_of_acc_logged = 0; $group_id_of_acc_logged = 0;
if($logged && $account_logged) if($logged && $account_logged)
$group_id_of_acc_logged = $account_logged->getGroupId(); $group_id_of_acc_logged = $account_logged->getGroupId();
$config['site'] = &$config; $config['site'] = &$config;
$config['server'] = &$config['lua']; $config['server'] = &$config['lua'];
$config['site']['shop_system'] = $config['gifts_system']; $config['site']['shop_system'] = $config['gifts_system'];
if(!isset($config['vdarkborder'])) if(!isset($config['vdarkborder']))
$config['vdarkborder'] = '#505050'; $config['vdarkborder'] = '#505050';
if(!isset($config['darkborder'])) if(!isset($config['darkborder']))
$config['darkborder'] = '#D4C0A1'; $config['darkborder'] = '#D4C0A1';
if(!isset($config['lightborder'])) if(!isset($config['lightborder']))
$config['lightborder'] = '#F1E0C6'; $config['lightborder'] = '#F1E0C6';
$config['site']['download_page'] = true; $config['site']['download_page'] = true;
$config['site']['serverinfo_page'] = true; $config['site']['serverinfo_page'] = true;
$config['site']['screenshot_page'] = true; $config['site']['screenshot_page'] = true;
if($config['forum'] != '') if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']); $config['forum_link'] = (strtolower($config['forum']) === 'site' ? getLink('forum') : $config['forum']);
foreach($status as $key => $value) foreach($status as $key => $value)
$config['status']['serverStatus_' . $key] = $value; $config['status']['serverStatus_' . $key] = $value;
} }
if($load_it) if($load_it)
{ {
if(SITE_CLOSED && admin()) if(SITE_CLOSED && admin())
$content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>'; $content .= '<p class="note">Site is under maintenance (closed mode). Only privileged users can see it.</p>';
if($config['backward_support']) if($config['backward_support'])
require SYSTEM . 'compat_pages.php'; require SYSTEM . 'compat_pages.php';
$ignore = false; $ignore = false;
$logged_access = 1; $logged_access = 1;
if($logged && $account_logged && $account_logged->isLoaded()) { if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess(); $logged_access = $account_logged->getAccess();
} }
$query = $query =
$db->query( $db->query(
'SELECT `id`, `title`, `body`, `php`, `hidden`' . 'SELECT `id`, `title`, `body`, `php`, `hidden`' .
' FROM `' . TABLE_PREFIX . 'pages`' . ' FROM `' . TABLE_PREFIX . 'pages`' .
' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access)); ' WHERE `name` LIKE ' . $db->quote($page) . ' AND `hidden` != 1 AND `access` <= ' . $db->quote($logged_access));
if($query->rowCount() > 0) // found page if($query->rowCount() > 0) // found page
{ {
$ignore = true; $ignore = true;
$query = $query->fetch(); $query = $query->fetch();
$title = $query['title']; $title = $query['title'];
if($query['php'] == '1') // execute it as php code if($query['php'] == '1') // execute it as php code
{ {
$tmp = substr($query['body'], 0, 10); $tmp = substr($query['body'], 0, 10);
if(($pos = strpos($tmp, '<?php')) !== false) { if(($pos = strpos($tmp, '<?php')) !== false) {
$tmp = preg_replace('/<\?php/', '', $query['body'], 1); $tmp = preg_replace('/<\?php/', '', $query['body'], 1);
} }
else if(($pos = strpos($tmp, '<?')) !== false) { else if(($pos = strpos($tmp, '<?')) !== false) {
$tmp = preg_replace('/<\?/', '', $query['body'], 1); $tmp = preg_replace('/<\?/', '', $query['body'], 1);
} }
else else
$tmp = $query['body']; $tmp = $query['body'];
$php_errors = array(); $php_errors = array();
function error_handler($errno, $errstr) { function error_handler($errno, $errstr) {
global $php_errors; global $php_errors;
$php_errors[] = array('errno' => $errno, 'errstr' => $errstr); $php_errors[] = array('errno' => $errno, 'errstr' => $errstr);
} }
set_error_handler('error_handler'); set_error_handler('error_handler');
ob_start(); ob_start();
eval($tmp); eval($tmp);
$content .= ob_get_contents(); $content .= ob_get_contents();
ob_end_clean(); ob_end_clean();
restore_error_handler(); restore_error_handler();
if(isset($php_errors[0]) && superAdmin()) { if(isset($php_errors[0]) && superAdmin()) {
var_dump($php_errors); var_dump($php_errors);
} }
} }
else else
$content .= $query['body']; // plain html $content .= $query['body']; // plain html
if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) { if(hasFlag(FLAG_CONTENT_PAGES) || superAdmin()) {
$content = $twig->render('admin.pages.links.html.twig', array( $content = $twig->render('admin.pages.links.html.twig', array(
'page' => array('id' => $query['id'], 'hidden' => $query['hidden']) 'page' => array('id' => $query['id'], 'hidden' => $query['hidden'])
)) . $content; )) . $content;
} }
} }
else else
{ {
$file = SYSTEM . 'pages/' . $page . '.php'; $file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file)) if(!@file_exists($file))
{ {
$page = '404'; $page = '404';
$file = SYSTEM . 'pages/404.php'; $file = SYSTEM . 'pages/404.php';
} }
} }
ob_start(); ob_start();
if($hooks->trigger(HOOK_BEFORE_PAGE)) { if($hooks->trigger(HOOK_BEFORE_PAGE)) {
if(!$ignore) if(!$ignore)
require $file; require $file;
} }
if($config['backward_support'] && isset($main_content[0])) if($config['backward_support'] && isset($main_content[0]))
$content .= $main_content; $content .= $main_content;
$content .= ob_get_contents(); $content .= ob_get_contents();
ob_end_clean(); ob_end_clean();
$hooks->trigger(HOOK_AFTER_PAGE); $hooks->trigger(HOOK_AFTER_PAGE);
} }
if($config['backward_support']) { if($config['backward_support']) {
$main_content = $content; $main_content = $content;
if(!isset($title)) if(!isset($title))
$title = ucfirst($page); $title = ucfirst($page);
$topic = $title; $topic = $title;
} }
$title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName']; $title_full = (isset($title) ? $title . $config['title_separator'] : '') . $config['lua']['serverName'];
if(file_exists($template_path . '/index.php')) if(file_exists($template_path . '/index.php'))
require($template_path . '/index.php'); require $template_path . '/index.php';
else if(file_exists($template_path . '/template.php')) // deprecated else if(file_exists($template_path . '/template.php')) // deprecated
require($template_path . '/template.php'); require $template_path . '/template.php';
else if($config['backward_support'] && file_exists($template_path . '/layout.php')) else if($config['backward_support'] && file_exists($template_path . '/layout.php'))
{ {
require($template_path . '/layout.php'); require $template_path . '/layout.php';
} }
else else
{ {
// TODO: save more info to log file // TODO: save more info to log file
die('ERROR: Cannot load template.'); die('ERROR: Cannot load template.');
} }
echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL; echo base64_decode('PCEtLSBQb3dlcmVkIGJ5IE15QUFDIDo6IGh0dHBzOi8vd3d3Lm15LWFhYy5vcmcvIC0tPg==') . PHP_EOL;
if(superAdmin()) { if(superAdmin()) {
echo '<!-- Generated in: ' . round(microtime(true) - START_TIME, 4) . 'ms -->'; echo '<!-- Generated in: ' . round(microtime(true) - START_TIME, 4) . 'ms -->';
echo PHP_EOL . '<!-- Queries done: ' . $db->queries() . ' -->'; echo PHP_EOL . '<!-- Queries done: ' . $db->queries() . ' -->';
if(function_exists('memory_get_peak_usage')) { if(function_exists('memory_get_peak_usage')) {
echo PHP_EOL . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->'; echo PHP_EOL . '<!-- Peak memory usage: ' . convert_bytes(memory_get_peak_usage(true)) . ' -->';
} }
if($config['database_log']) { if($config['database_log']) {
echo PHP_EOL . '<!-- Database Queries Done by MyAAC:' . PHP_EOL . $db->getLog() . '-->'; echo PHP_EOL . '<!-- Database Queries Done by MyAAC:' . PHP_EOL . $db->getLog() . '-->';
} }
} }
$hooks->trigger(HOOK_FINISH); $hooks->trigger(HOOK_FINISH);
?> ?>

View File

@ -1,9 +1,9 @@
<?php <?php
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
require(SYSTEM . 'libs/pot/OTS.php'); require SYSTEM . 'libs/pot/OTS.php';
$ots = POT::getInstance(); $ots = POT::getInstance();
require(SYSTEM . 'database.php'); require SYSTEM . 'database.php';
if(!isset($db)) { if(!isset($db)) {
$database_error = $locale['step_database_error_mysql_connect'] . '<br/>' . $database_error = $locale['step_database_error_mysql_connect'] . '<br/>' .

View File

@ -31,13 +31,13 @@ else
} }
} }
} }
if(!isset($locale_)) if(!isset($locale_))
$locale_ = 'en'; $locale_ = 'en';
} }
require(LOCALE . 'en/main.php'); require LOCALE . 'en/main.php';
require(LOCALE . 'en/install.php'); require LOCALE . 'en/install.php';
$file_main = LOCALE . $locale_ . '/main.php'; $file_main = LOCALE . $locale_ . '/main.php';
if(!file_exists($file_main)) if(!file_exists($file_main))
@ -47,6 +47,6 @@ $file_install = LOCALE . $locale_ . '/install.php';
if(!file_exists($file_install)) if(!file_exists($file_install))
$file_install = LOCALE . 'en/install.php'; $file_install = LOCALE . 'en/install.php';
require($file_main); require $file_main;
require($file_install); require $file_install;
?> ?>

View File

@ -1,16 +1,16 @@
<?php <?php
require('../common.php'); require '../common.php';
define('MYAAC_INSTALL', true); define('MYAAC_INSTALL', true);
// includes // includes
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(BASE . 'install/includes/functions.php'); require BASE . 'install/includes/functions.php';
require(BASE . 'install/includes/locale.php'); require BASE . 'install/includes/locale.php';
require(SYSTEM . 'clients.conf.php'); require SYSTEM . 'clients.conf.php';
if(file_exists(BASE . 'config.local.php')) if(file_exists(BASE . 'config.local.php'))
require(BASE . 'config.local.php'); require BASE . 'config.local.php';
// twig // twig
require_once LIBS . 'Twig/Autoloader.php'; require_once LIBS . 'Twig/Autoloader.php';
@ -181,7 +181,7 @@ if(is_writable(CACHE) && (MYAAC_OS != 'WINDOWS' || win_is_writable(CACHE))) {
ob_start(); ob_start();
$step_id = array_search($step, $steps); $step_id = array_search($step, $steps);
require('steps/' . $step_id . '-' . $step . '.php'); require 'steps/' . $step_id . '-' . $step . '.php';
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
} }
@ -192,5 +192,5 @@ else {
} }
// render // render
require('template/template.php'); require 'template/template.php';
//$_SESSION['laststep'] = $step; //$_SESSION['laststep'] = $step;

View File

@ -14,7 +14,7 @@ else {
if(@file_exists($lang_file_main) if(@file_exists($lang_file_main)
&& @file_exists($lang_file_install)) && @file_exists($lang_file_install))
{ {
require($lang_file_main); require $lang_file_main;
$locales[] = array('id' => $tmp_locale, 'name' => $locale['name']); $locales[] = array('id' => $tmp_locale, 'name' => $locale['name']);
} }
} }

View File

@ -40,13 +40,13 @@ if(!$error) {
} }
} }
} }
require(BASE . 'install/includes/config.php'); require BASE . 'install/includes/config.php';
if(!$error) { if(!$error) {
success($locale['step_database_importing']); 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 if(isset($database_error)) { // we failed connect to the database
error($database_error); error($database_error);
} }

View File

@ -1,10 +1,10 @@
<?php <?php
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
require(BASE . 'install/includes/config.php'); require BASE . 'install/includes/config.php';
if(!$error) { if(!$error) {
require(BASE . 'install/includes/database.php'); require BASE . 'install/includes/database.php';
if(isset($database_error)) { // we failed connect to the database if(isset($database_error)) { // we failed connect to the database
error($database_error); error($database_error);
} }

View File

@ -6,7 +6,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save
warning($locale['already_installed']); warning($locale['already_installed']);
} }
else { else {
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
if(!$error) { if(!$error) {
if(USE_ACCOUNT_NAME) if(USE_ACCOUNT_NAME)
$account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : null; $account = isset($_SESSION['var_account']) ? $_SESSION['var_account'] : null;

View File

@ -1,19 +1,19 @@
<?php <?php
require_once('../../common.php'); require_once '../../common.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(BASE . 'install/includes/functions.php'); require BASE . 'install/includes/functions.php';
require(BASE . 'install/includes/locale.php'); require BASE . 'install/includes/locale.php';
$error = false; $error = false;
require(BASE . 'install/includes/config.php'); require BASE . 'install/includes/config.php';
ini_set('max_execution_time', 300); ini_set('max_execution_time', 300);
ob_implicit_flush(); ob_implicit_flush();
ob_end_flush(); ob_end_flush();
if(!$error) { if(!$error) {
require(BASE . 'install/includes/database.php'); require BASE . 'install/includes/database.php';
if(isset($database_error)) { // we failed connect to the database if(isset($database_error)) { // we failed connect to the database
error($database_error); error($database_error);
return; return;

View File

@ -1,9 +1,9 @@
<?php <?php
require_once('../../common.php'); require_once '../../common.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(BASE . 'install/includes/functions.php'); require BASE . 'install/includes/functions.php';
require(BASE . 'install/includes/locale.php'); require BASE . 'install/includes/locale.php';
ini_set('max_execution_time', 300); ini_set('max_execution_time', 300);
ob_implicit_flush(); ob_implicit_flush();
@ -14,7 +14,7 @@ if(isset($config['installed']) && $config['installed'] && !isset($_SESSION['save
return; return;
} }
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
$deleted = 'deleted'; $deleted = 'deleted';
if($db->hasColumn('players', 'deletion')) if($db->hasColumn('players', 'deletion'))
@ -42,19 +42,19 @@ if($success) {
success($locale['step_database_imported_players']); success($locale['step_database_imported_players']);
} }
require(LIBS . 'items.php'); require LIBS . 'items.php';
if(Items::loadFromXML()) if(Items::loadFromXML())
success($locale['step_database_loaded_items']); success($locale['step_database_loaded_items']);
else else
error(Items::getError()); error(Items::getError());
require(LIBS . 'weapons.php'); require LIBS . 'weapons.php';
if(Weapons::loadFromXML()) if(Weapons::loadFromXML())
success($locale['step_database_loaded_weapons']); success($locale['step_database_loaded_weapons']);
else else
error(Weapons::getError()); error(Weapons::getError());
require(LIBS . 'creatures.php'); require LIBS . 'creatures.php';
if(Creatures::loadFromXML()) { if(Creatures::loadFromXML()) {
success($locale['step_database_loaded_monsters']); success($locale['step_database_loaded_monsters']);
@ -67,7 +67,7 @@ else {
error(Creatures::getLastError()); error(Creatures::getLastError());
} }
require(LIBS . 'spells.php'); require LIBS . 'spells.php';
if(Spells::loadFromXML()) { if(Spells::loadFromXML()) {
success($locale['step_database_loaded_spells']); success($locale['step_database_loaded_spells']);
} }
@ -76,7 +76,7 @@ else {
} }
// update config.highscores_ids_hidden // update config.highscores_ids_hidden
require_once(SYSTEM . 'migrations/20.php'); require_once SYSTEM . 'migrations/20.php';
$database_migration_20 = true; $database_migration_20 = true;
$content = ''; $content = '';
if(!databaseMigration20($content)) { if(!databaseMigration20($content)) {
@ -86,7 +86,7 @@ if(!databaseMigration20($content)) {
} }
// add z_polls tables // 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('$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']); $locale['step_finish_desc'] = str_replace('$HOMEPAGE$', generateLink(str_replace('tools/', '', BASE_URL), $locale['step_finish_homepage'], true), $locale['step_finish_desc']);

View File

@ -4,11 +4,11 @@ if(php_sapi_name() != "cli") {
die('This script can be run only in command line mode.'); die('This script can be run only in command line mode.');
} }
require_once('../../common.php'); require_once '../../common.php';
require_once(SYSTEM . 'functions.php'); require_once SYSTEM . 'functions.php';
require_once(SYSTEM . 'init.php'); require_once SYSTEM . 'init.php';
require_once(SYSTEM . 'hooks.php'); require_once SYSTEM . 'hooks.php';
require_once(LIBS . 'plugins.php'); require_once LIBS . 'plugins.php';
if($argc != 2) { if($argc != 2) {
exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL); exit('This command expects one parameter: zip file name (plugin)' . PHP_EOL);

View File

@ -47,7 +47,7 @@ class Hook
global $db, $config, $template_path, $ots, $content, $twig; global $db, $config, $template_path, $ots, $content, $twig;
if(file_exists(BASE . $this->_file)) { if(file_exists(BASE . $this->_file)) {
$ret = require(BASE . $this->_file); $ret = require BASE . $this->_file;
} }
return $ret === null || $ret == 1 || $ret; return $ret === null || $ret == 1 || $ret;

View File

@ -120,9 +120,9 @@ if(!isset($config['highscores_ids_hidden']) || count($config['highscores_ids_hid
} }
// POT // POT
require_once(SYSTEM . 'libs/pot/OTS.php'); require_once SYSTEM . 'libs/pot/OTS.php';
$ots = POT::getInstance(); $ots = POT::getInstance();
require_once(SYSTEM . 'database.php'); require_once SYSTEM . 'database.php';
define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name')); define('USE_ACCOUNT_NAME', $db->hasColumn('accounts', 'name'));
// load vocation names // load vocation names

View File

@ -8,7 +8,7 @@
* @link http://my-aac.org * @link http://my-aac.org
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
require_once(SYSTEM . 'libs/items_images.php'); require_once SYSTEM . 'libs/items_images.php';
Items_Images::$files = array( Items_Images::$files = array(
'otb' => SYSTEM . 'data/items.otb', 'otb' => SYSTEM . 'data/items.otb',

View File

@ -19,27 +19,27 @@ class Cache
if(!self::$instance) { if(!self::$instance) {
switch(strtolower($engine)) { switch(strtolower($engine)) {
case 'apc': case 'apc':
require('cache_apc.php'); require 'cache_apc.php';
self::$instance = new Cache_APC($prefix); self::$instance = new Cache_APC($prefix);
break; break;
case 'apcu': case 'apcu':
require('cache_apcu.php'); require 'cache_apcu.php';
self::$instance = new Cache_APCu($prefix); self::$instance = new Cache_APCu($prefix);
break; break;
case 'eaccelerator': case 'eaccelerator':
require('cache_eaccelerator.php'); require 'cache_eaccelerator.php';
self::$instance = new Cache_eAccelerator($prefix); self::$instance = new Cache_eAccelerator($prefix);
break; break;
case 'xcache': case 'xcache':
require('cache_xcache.php'); require 'cache_xcache.php';
self::$instance = new Cache_XCache($prefix); self::$instance = new Cache_XCache($prefix);
break; break;
case 'file': case 'file':
require('cache_file.php'); require 'cache_file.php';
self::$instance = new Cache_File($prefix, CACHE); self::$instance = new Cache_File($prefix, CACHE);
break; break;

View File

@ -236,7 +236,7 @@ class Plugins {
if (isset($plugin['install'])) { if (isset($plugin['install'])) {
if (file_exists(BASE . $plugin['install'])) { if (file_exists(BASE . $plugin['install'])) {
$db->revalidateCache(); $db->revalidateCache();
require(BASE . $plugin['install']); require BASE . $plugin['install'];
$db->revalidateCache(); $db->revalidateCache();
} }
else else

View File

@ -11,6 +11,6 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
if($action == 'confirm_email') { if($action == 'confirm_email') {
require_once(PAGES . 'account/confirm_email.php'); require_once PAGES . 'account/confirm_email.php';
} }
?> ?>

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Account Management'; $title = 'Account Management';
if($config['account_country']) if($config['account_country'])
require(SYSTEM . 'countries.conf.php'); require SYSTEM . 'countries.conf.php';
$groups = new OTS_Groups_List(); $groups = new OTS_Groups_List();
@ -30,7 +30,7 @@ if(ACTION == "logout" && !isset($_REQUEST['account_login'])) {
if(!$logged) if(!$logged)
{ {
if(ACTION == 'confirm_email') { if(ACTION == 'confirm_email') {
require(PAGES . 'account/' . ACTION . '.php'); require PAGES . 'account/' . ACTION . '.php';
return; return;
} }
@ -137,7 +137,7 @@ $errors = array();
error('Error: Action contains illegal characters.'); error('Error: Action contains illegal characters.');
} }
else if(file_exists(PAGES . 'account/' . $action . '.php')) { else if(file_exists(PAGES . 'account/' . $action . '.php')) {
require(PAGES . 'account/' . $action . '.php'); require PAGES . 'account/' . $action . '.php';
} }
else { else {
error('This page does not exists.'); error('This page does not exists.');

View File

@ -10,8 +10,8 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Load items.xml'; $title = 'Load items.xml';
require(LIBS . 'items.php'); require LIBS . 'items.php';
require(LIBS . 'weapons.php'); require LIBS . 'weapons.php';
echo $twig->render('admin.items.html.twig'); echo $twig->render('admin.items.html.twig');

View File

@ -49,7 +49,7 @@ if(isset($_REQUEST['template'])) {
$file = TEMPLATES . $template . '/config.php'; $file = TEMPLATES . $template . '/config.php';
if(file_exists($file)) { if(file_exists($file)) {
require_once($file); require_once $file;
} }
else { else {
echo 'Cannot find template config.php file.'; echo 'Cannot find template config.php file.';

View File

@ -10,7 +10,7 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Plugin manager'; $title = 'Plugin manager';
require(LIBS . 'plugins.php'); require LIBS . 'plugins.php';
echo $twig->render('admin.plugins.form.html.twig'); echo $twig->render('admin.plugins.form.html.twig');

View File

@ -25,5 +25,5 @@ if(preg_match("/[^A-z0-9_\-]/", $tool))
$file = BASE . 'admin/pages/tools/' . $tool . '.php'; $file = BASE . 'admin/pages/tools/' . $tool . '.php';
if(!@file_exists($file)) if(!@file_exists($file))
require($file); require $file;
?> ?>

View File

@ -18,7 +18,7 @@ You can enable it by editing this configurable in <b>config.local.php</b> file:<
return; return;
endif; endif;
require(SYSTEM . 'libs/visitors.php'); require SYSTEM . 'libs/visitors.php';
$visitors = new Visitors($config['visitors_counter_ttl']); $visitors = new Visitors($config['visitors_counter_ttl']);
function compare($a, $b) { function compare($a, $b) {

View File

@ -11,7 +11,7 @@
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
$title = 'Characters'; $title = 'Characters';
require_once(SYSTEM . 'item.php'); require_once SYSTEM . 'item.php';
$groups = new OTS_Groups_List(); $groups = new OTS_Groups_List();
function generate_search_form($autofocus = false) function generate_search_form($autofocus = false)

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Create Account'; $title = 'Create Account';
if($config['account_country']) if($config['account_country'])
require(SYSTEM . 'countries.conf.php'); require SYSTEM . 'countries.conf.php';
if($logged) if($logged)
{ {

View File

@ -26,7 +26,7 @@ if(strtolower($config['forum']) != 'site')
if(!$logged) 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 />'; 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(); $canEdit = Forum::isModerator();
if($canEdit) if($canEdit)

View File

@ -20,14 +20,14 @@ define('MOTD_EXISTS', $db->hasColumn('guilds', 'motd'));
//show list of guilds //show list of guilds
if(empty($action)) { if(empty($action)) {
require(PAGES . 'guilds/list_of_guilds.php'); require PAGES . 'guilds/list_of_guilds.php';
} }
else { else {
if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) { if(!ctype_alnum(str_replace(array('-', '_'), '', $action))) {
error('Error: Action contains illegal characters.'); error('Error: Action contains illegal characters.');
} }
else if(file_exists(PAGES . 'guilds/' . $action . '.php')) { else if(file_exists(PAGES . 'guilds/' . $action . '.php')) {
require(PAGES . 'guilds/' . $action . '.php'); require PAGES . 'guilds/' . $action . '.php';
} }
else { else {
error('This page does not exists.'); error('This page does not exists.');

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Highscores'; $title = 'Highscores';
if($config['account_country'] && $config['highscores_country_box']) if($config['account_country'] && $config['highscores_country_box'])
require(SYSTEM . 'countries.conf.php'); require SYSTEM . 'countries.conf.php';
$list = isset($_GET['list']) ? $_GET['list'] : ''; $list = isset($_GET['list']) ? $_GET['list'] : '';
$_page = isset($_GET['page']) ? $_GET['page'] : 0; $_page = isset($_GET['page']) ? $_GET['page'] : 0;

View File

@ -10,7 +10,7 @@
*/ */
defined('MYAAC') or die('Direct access not allowed!'); defined('MYAAC') or die('Direct access not allowed!');
require_once(LIBS . 'forum.php'); require_once LIBS . 'forum.php';
if(isset($_GET['archive'])) if(isset($_GET['archive']))
{ {

View File

@ -9,5 +9,5 @@
* @link http://my-aac.org * @link http://my-aac.org
*/ */
$_GET['archive'] = true; $_GET['archive'] = true;
require('news.php'); require 'news.php';
?> ?>

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Who is online?'; $title = 'Who is online?';
if($config['account_country']) if($config['account_country'])
require(SYSTEM . 'countries.conf.php'); require SYSTEM . 'countries.conf.php';
$promotion = ''; $promotion = '';
if($db->hasColumn('players', 'promotion')) if($db->hasColumn('players', 'promotion'))

View File

@ -12,7 +12,7 @@ defined('MYAAC') or die('Direct access not allowed!');
$title = 'Gamemasters List'; $title = 'Gamemasters List';
if($config['account_country']) if($config['account_country'])
require(SYSTEM . 'countries.conf.php'); require SYSTEM . 'countries.conf.php';
$groups = new OTS_Groups_List(); $groups = new OTS_Groups_List();
if(!$groups->count()) if(!$groups->count())

View File

@ -1,5 +1,5 @@
<?php <?php
//require('../../common.php'); //require '../../common.php';
//$text = $_GET['text']; //$text = $_GET['text'];
/* /*

View File

@ -1,6 +1,6 @@
<?php <?php
require('../common.php'); require '../common.php';
require(SYSTEM . 'item.php'); require SYSTEM . 'item.php';
if(isset($_GET['id'])) if(isset($_GET['id']))
outputItem($_GET['id'], $_GET['count']); outputItem($_GET['id'], $_GET['count']);

View File

@ -10,10 +10,10 @@
*/ */
// we need some functions // we need some functions
require('../common.php'); require '../common.php';
require_once(SYSTEM . 'functions.php'); require_once SYSTEM . 'functions.php';
require_once(SYSTEM . 'init.php'); require_once SYSTEM . 'init.php';
require_once(SYSTEM . 'template.php'); require_once SYSTEM . 'template.php';
$error = ''; $error = '';
if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $_GET['forum_section'], $_GET['template_path'], $_GET['type'])) if(isset($_GET['title'], $_GET['body'], $_GET['player_id'], $_GET['category'], $_GET['forum_section'], $_GET['template_path'], $_GET['type']))

View File

@ -8,9 +8,9 @@
exit; exit;
} }
require_once('../../common.php'); require_once '../../common.php';
require_once(SYSTEM . 'functions.php'); require_once SYSTEM . 'functions.php';
require_once(SYSTEM . 'init.php'); require_once SYSTEM . 'init.php';
// Definitions // Definitions
define('SIGNATURES', TOOLS . 'signature/'); define('SIGNATURES', TOOLS . 'signature/');
@ -59,7 +59,7 @@
exit; exit;
} }
require($file); require $file;
header('Content-type: image/png'); header('Content-type: image/png');
$seconds_to_cache = $config['signature_browser_cache'] * 60; $seconds_to_cache = $config['signature_browser_cache'] * 60;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT"; $ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";

View File

@ -6,7 +6,7 @@
**/ **/
/** Load the MadGD class **/ /** Load the MadGD class **/
require('gd.class.php'); require 'gd.class.php';
/** Default values **/ /** Default values **/
list( $i, $eachRow, $percent ) = array( .5, 14, array( 'size' => 7 ) ); list( $i, $eachRow, $percent ) = array( .5, 14, array( 'size' => 7 ) );
/** Get experience points for a certain level **/ /** Get experience points for a certain level **/

View File

@ -1,9 +1,9 @@
<?php <?php
require('../common.php'); require '../common.php';
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(SYSTEM . 'status.php'); require SYSTEM . 'status.php';
require(SYSTEM . 'login.php'); require SYSTEM . 'login.php';
if(!admin()) if(!admin())
die('Access denied.'); die('Access denied.');

View File

@ -10,9 +10,9 @@
*/ */
// we need some functions // we need some functions
require('../common.php'); require '../common.php';
require(SYSTEM . 'functions.php'); require SYSTEM . 'functions.php';
require(SYSTEM . 'init.php'); require SYSTEM . 'init.php';
$error = ''; $error = '';
if(isset($_GET['account'])) if(isset($_GET['account']))