diff --git a/index.php b/index.php
index d13e3056..36a1451f 100644
--- a/index.php
+++ b/index.php
@@ -1 +1 @@
-
* @copyright 2017 MyAAC
* @version 0.0.2
* @link http://my-aac.org
*/
require_once('common.php');
require_once(BASE . 'config.local.php');
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
{
header('Location: ' . BASE_DIR . '/install/');
die('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!');
}
// define page visited, so it can be used within events system
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_GET['p']) ? $_GET['p'] : '');
if(empty($page) || preg_match('/[^A-z0-9_\-]/', $page))
$page = 'news';
$page = strtolower($page);
define('PAGE', $page);
$template_place_holders = array();
// event system
require_once(SYSTEM . 'events.php');
$events = new Events();
$events->trigger('STARTUP');
require_once(SYSTEM . 'functions.php');
require_once(SYSTEM . 'init.php');
require_once(SYSTEM . 'login.php');
require_once(SYSTEM . 'status.php');
require_once(SYSTEM . 'template.php');
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
if($config['site_closed'])
{
if(!admin())
{
$title = $config['site_closed_title'];
$content .= $config['site_closed_message'];
$load_it = false;
}
if(!$logged)
{
ob_start();
require(SYSTEM . 'pages/accountmanagement.php');
$content .= ob_get_contents();
ob_end_clean();
$load_it = false;
}
}
if($config['backward_support']) {
// backward support for gesior
define('INITIALIZED', true);
$SQL = $db;
$layout_header = template_header();
$layout_name = $template_path;
$main_content = $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['gifts_system'] = ($config['site']['shop_system'] == 1);
$config['site']['shop_system'] = $config['gifts_system'];
$config['serverinfo_page'] = 1;
$config['download_page'] = 1;
if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? internalLayoutLink('forum') : $config['forum']);
}
if($load_it)
{
if($config['site_closed'] && admin())
$content .= '
Site is under maintenance (closed mode). Only privileged users can see it.
';
if($config['backward_support'])
require(SYSTEM . 'compat_pages.php');
$ignore = false;
$file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file))
{
$logged_access = 0;
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}
$query =
$db->query(
'SELECT `title`, `body`, `php`' .
' 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, ' $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
}
else
{
$page = '404';
$file = SYSTEM . 'pages/404.php';
}
}
ob_start();
if($events->trigger('BEFORE_PAGE'))
{
if(!$ignore)
require($file);
}
if($config['backward_support'] && isset($main_content))
$content .= $main_content;
$content .= ob_get_contents();
ob_end_clean();
$events->trigger('AFTER_PAGE');
}
$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 '' . "\n";
if(($config['debug_level'] & 1) == 1)
echo '';
if(($config['debug_level'] & 2) == 2)
echo "\n" . '';
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '';
$events->trigger('FINISH');
?>
\ No newline at end of file
+
* @copyright 2017 MyAAC
* @version 0.0.2
* @link http://my-aac.org
*/
require_once('common.php');
require_once(BASE . 'config.local.php');
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
{
header('Location: ' . BASE_DIR . '/install/');
die('Setup detected that install/ directory exists. Please visit this url to start MyAAC Installation.
Delete install/ directory if you already installed MyAAC.
Remember to REFRESH this page when you\'re done!');
}
// define page visited, so it can be used within events system
$page = isset($_REQUEST['subtopic']) ? $_REQUEST['subtopic'] : (isset($_GET['p']) ? $_GET['p'] : '');
if(empty($page) || preg_match('/[^A-z0-9_\-]/', $page))
$page = 'news';
$page = strtolower($page);
define('PAGE', $page);
$template_place_holders = array();
// event system
require_once(SYSTEM . 'events.php');
$events = new Events();
$events->trigger('STARTUP');
require_once(SYSTEM . 'functions.php');
require_once(SYSTEM . 'init.php');
require_once(SYSTEM . 'login.php');
require_once(SYSTEM . 'status.php');
require_once(SYSTEM . 'template.php');
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
if($config['site_closed'])
{
if(!admin())
{
$title = $config['site_closed_title'];
$content .= $config['site_closed_message'];
$load_it = false;
}
if(!$logged)
{
ob_start();
require(SYSTEM . 'pages/accountmanagement.php');
$content .= ob_get_contents();
ob_end_clean();
$load_it = false;
}
}
// backward support for gesior
if($config['backward_support']) {
define('INITIALIZED', true);
$SQL = $db;
$layout_header = template_header();
$layout_name = $template_path;
$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'];
$config['serverinfo_page'] = 1;
$config['download_page'] = 1;
if($config['forum'] != '')
$config['forum_link'] = (strtolower($config['forum']) == 'site' ? internalLayoutLink('forum') : $config['forum']);
foreach($status as $key => $value)
$config['status']['serverStatus_' . $key] = $value;
}
if($load_it)
{
if($config['site_closed'] && admin())
$content .= 'Site is under maintenance (closed mode). Only privileged users can see it.
';
if($config['backward_support'])
require(SYSTEM . 'compat_pages.php');
$ignore = false;
$file = SYSTEM . 'pages/' . $page . '.php';
if(!@file_exists($file))
{
$logged_access = 0;
if($logged && $account_logged && $account_logged->isLoaded()) {
$logged_access = $account_logged->getAccess();
}
$query =
$db->query(
'SELECT `title`, `body`, `php`' .
' 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, ' $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
}
else
{
$page = '404';
$file = SYSTEM . 'pages/404.php';
}
}
ob_start();
if($events->trigger('BEFORE_PAGE'))
{
if(!$ignore)
require($file);
}
if($config['backward_support'] && isset($main_content))
$content .= $main_content;
$content .= ob_get_contents();
ob_end_clean();
$events->trigger('AFTER_PAGE');
}
if($config['backward_support']) {
$main_content = $content;
}
$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 '' . "\n";
if(($config['debug_level'] & 1) == 1)
echo '';
if(($config['debug_level'] & 2) == 2)
echo "\n" . '';
if(($config['debug_level'] & 4) == 4 && function_exists('memory_get_peak_usage'))
echo "\n" . '';
$events->trigger('FINISH');
?>
\ No newline at end of file
diff --git a/install/steps/database.php b/install/steps/database.php
index 1bb411f3..756f61cf 100644
--- a/install/steps/database.php
+++ b/install/steps/database.php
@@ -234,7 +234,7 @@ if(!$error) {
$account_db->save();
}
else {
- $new_account = $ots->createObject('Account');
+ $new_account = new OTS_Account();
$new_account->create('dummy_account', 1);
$account_db->setPassword('for sample characters. ' . generateRandomString(10));
}
diff --git a/install/steps/requirements.php b/install/steps/requirements.php
index 34b2862f..a38c691e 100644
--- a/install/steps/requirements.php
+++ b/install/steps/requirements.php
@@ -3,14 +3,14 @@
*
* @param string $name
* @param boolean $ok
- * @param mixed $version
+ * @param mixed $info
*/
-function version_check($name, $ok, $version = '', $warning = false)
+function version_check($name, $ok, $info = '', $warning = false)
{
global $failed;
echo '' . $name;
- if(!empty($version))
- echo ': ' . $version . '';
+ if(!empty($info))
+ echo ': ' . $info . '';
echo '
';
if(!$ok && !$warning)
@@ -33,8 +33,9 @@ version_check('register_long_arrays', !$ini_register_globals, $ini_register_glob
$ini_safe_mode = ini_get_bool('safe_mode');
version_check('safe_mode', !$ini_safe_mode, $ini_safe_mode ? $locale['on'] : $locale['off'], true);
-version_check('PDO extension loaded', extension_loaded('pdo'), '', false);
-version_check('zip extension loaded', extension_loaded('zip'), '', false);
+version_check(str_replace('$EXTENSION$', 'PDO', $locale['step_requirements_extension']) , extension_loaded('pdo'), extension_loaded('pdo') ? $locale['loaded'] : $locale['not_loaded']);
+version_check(str_replace('$EXTENSION$', 'XML', $locale['step_requirements_extension']), extension_loaded('xml'), extension_loaded('xml') ? $locale['loaded'] : $locale['not_loaded']);
+version_check(str_replace('$EXTENSION$', 'ZIP', $locale['step_requirements_extension']), extension_loaded('zip'), extension_loaded('zip') ? $locale['loaded'] : $locale['not_loaded']);
if($failed)
{
diff --git a/system/database.php b/system/database.php
index a2939e06..6cd17cbb 100644
--- a/system/database.php
+++ b/system/database.php
@@ -65,12 +65,16 @@ defined('MYAAC') or die('Direct access not allowed!');
);
}
catch(PDOException $error) {
+ if($cache->enabled()) {
+ $cache->delete('config_lua');
+ }
die('ERROR: Cannot connect to MySQL database.
' .
'Possible reasons:' .
'' .
'- MySQL is not configured propertly in config.lua.
' .
'- MySQL server is not running.
' .
- '
');
+ '' . $error);
+
}
$db = POT::getInstance()->getDBHandle();
?>
\ No newline at end of file
diff --git a/system/functions.php b/system/functions.php
index ad4a6875..eb02ba6a 100644
--- a/system/functions.php
+++ b/system/functions.php
@@ -381,6 +381,8 @@ function delete_guild($id)
foreach($rank_list as $rank_in_guild) {
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
+ else if(tableExist('guild_members'))
+ $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_members`.`rank_id` as `rank_id` FROM `players`, `guild_members` WHERE `guild_members`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_members`.`player_id` ORDER BY `name`;');
else
$players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank_in_guild->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
diff --git a/system/init.php b/system/init.php
index 223c386d..41df7aad 100644
--- a/system/init.php
+++ b/system/init.php
@@ -91,6 +91,15 @@ else if(isset($config['lua']['data_directory'][0]))
if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
$tmp .= '/';
}
+else if(isset($config['lua']['datadir'][0]))
+{
+ $tmp = $config['lua']['datadir'];
+ if($tmp[0] != '/')
+ $tmp = $config['server_path'] . $tmp;
+
+ if($tmp[strlen($tmp) - 1] != '/') // do not forget about trailing slash
+ $tmp .= '/';
+}
else
$tmp = $config['server_path'] . 'data/';
diff --git a/system/libs/cache_apc.php b/system/libs/cache_apc.php
index 366abbb5..31485779 100644
--- a/system/libs/cache_apc.php
+++ b/system/libs/cache_apc.php
@@ -42,6 +42,10 @@ class Cache_APC
return ($var = apc_fetch($this->prefix . $key)) !== false;
}
+ public function delete($key) {
+ apc_delete($key);
+ }
+
public function enabled() {
return $this->enabled;
}
diff --git a/system/libs/cache_eaccelerator.php b/system/libs/cache_eaccelerator.php
index bdf5421e..6275616d 100644
--- a/system/libs/cache_eaccelerator.php
+++ b/system/libs/cache_eaccelerator.php
@@ -41,6 +41,10 @@ class Cache_eAccelerator
return ($var = eaccelerator_get($this->prefix . $key)) !== null;
}
+ public function delete($key) {
+ eaccelerator_rm($key);
+ }
+
public function enabled() {
return $this->enabled;
}
diff --git a/system/libs/cache_file.php b/system/libs/cache_file.php
index 06a909be..6653e4e8 100644
--- a/system/libs/cache_file.php
+++ b/system/libs/cache_file.php
@@ -51,6 +51,13 @@ class Cache_File
return true;
}
+ public function delete($key)
+ {
+ $file = $this->_name($key);
+ if(file_exists($file))
+ unlink($file);
+ }
+
public function enabled() {
return $this->enabled;
}
diff --git a/system/libs/cache_xcache.php b/system/libs/cache_xcache.php
index d031be9c..f6a56e83 100644
--- a/system/libs/cache_xcache.php
+++ b/system/libs/cache_xcache.php
@@ -47,6 +47,10 @@ class Cache_XCache
return true;
}
+ public function delete($key) {
+ xcache_unset($key);
+ }
+
public function enabled() {
return $this->enabled;
}
diff --git a/system/libs/pot/OTS_DB_ODBC.php b/system/libs/pot/OTS_DB_ODBC.php
deleted file mode 100644
index 376e6bb9..00000000
--- a/system/libs/pot/OTS_DB_ODBC.php
+++ /dev/null
@@ -1,110 +0,0 @@
-
- * @copyright 2007 - 2008 (C) by Wrzasq
- * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
- */
-
-/**
- * ODBC connection interface.
- *
- *
- * At all everything that you really need to read from this class documentation is list of parameters for driver's constructor.
- *
- *
- * @package POT
- * @version 0.1.3
- */
-class OTS_DB_ODBC extends OTS_Base_DB
-{
-/**
- * Creates database connection.
- *
- *
- * Connects to ODBC data source on given arguments.
- *
- *
- *
- * List of parameters for this drivers:
- *
- *
- *
- * - host - database host.
- * - port - ODBC driver.
- * - database - database name.
- * - user - user login.
- * - password - user password.
- * - source - ODBC data source.
- *
- *
- *
- * Note: Since 0.1.3 version source parameter was added.
- *
- *
- * @version 0.1.3
- * @param array $params Connection parameters.
- * @throws PDOException On PDO operation error.
- */
- public function __construct($params)
- {
- $user = null;
- $password = null;
- $dns = array();
-
- if( isset($params['host']) )
- {
- $dns[] = 'HOSTNAME={' . $params['host'] . '}';
- }
-
- if( isset($params['port']) )
- {
- $dns[] = 'DRIVER={' . $params['port'] . '}';
- }
-
- if( isset($params['database']) )
- {
- $dns[] = 'DATABASE={' . $params['database'] . '}';
- }
-
- if( isset($params['user']) )
- {
- $user = $params['user'];
- $dns[] = 'UID={' . $user . '}';
- }
-
- if( isset($params['password']) )
- {
- $password = $params['password'];
- $dns[] = 'PWD={' . $user . '}';
- }
-
- if( isset($params['prefix']) )
- {
- $this->prefix = $params['prefix'];
- }
-
- // composes DNS
- $dns = implode(';', $dns);
-
- // source parameter overwrites all other params
- if( isset($params['source']) )
- {
- $dns = $params['source'];
- }
-
- // PDO constructor
- parent::__construct('odbc:' . $dns, $user, $password);
- }
-}
-
-/**#@-*/
-
-?>
diff --git a/system/libs/pot/OTS_DB_PostgreSQL.php b/system/libs/pot/OTS_DB_PostgreSQL.php
deleted file mode 100644
index 80f64c0e..00000000
--- a/system/libs/pot/OTS_DB_PostgreSQL.php
+++ /dev/null
@@ -1,103 +0,0 @@
-
- * @copyright 2007 (C) by Wrzasq
- * @license http://www.gnu.org/licenses/lgpl-3.0.txt GNU Lesser General Public License, Version 3
- */
-
-/**
- * PostgreSQL connection interface.
- *
- *
- * At all everything that you really need to read from this class documentation is list of parameters for driver's constructor.
- *
- *
- * @package POT
- * @version 0.1.3
- */
-class OTS_DB_PostgreSQL extends OTS_Base_DB
-{
-/**
- * Creates database connection.
- *
- *
- * Connects to PgSQL (PostgreSQL) database on given arguments.
- *
- *
- *
- * List of parameters for this drivers:
- *
- *
- *
- * - host - database server.
- * - port - port (optional, also it is possible to use host:port in host parameter).
- * - database - database name.
- * - user - user login.
- * - password - user password.
- *
- *
- * @version 0.0.6
- * @param array $params Connection parameters.
- * @throws PDOException On PDO operation error.
- */
- public function __construct($params)
- {
- $user = null;
- $password = null;
- $dns = array();
-
- // host:port support
- if( strpos(':', $params['host']) !== false)
- {
- $host = explode(':', $params['host'], 2);
-
- $params['host'] = $host[0];
- $params['port'] = $host[1];
- }
-
- if( isset($params['host']) )
- {
- $dns[] = 'host=' . $params['host'];
- }
-
- if( isset($params['port']) )
- {
- $dns[] = 'port=' . $params['port'];
- }
-
- if( isset($params['database']) )
- {
- $dns[] = 'dbname=' . $params['database'];
- }
-
- if( isset($params['user']) )
- {
- $user = $params['user'];
- }
-
- if( isset($params['password']) )
- {
- $password = $params['password'];
- }
-
- if( isset($params['prefix']) )
- {
- $this->prefix = $params['prefix'];
- }
-
- // PDO constructor
- parent::__construct('pgsql:' . implode(' ', $dns), $user, $password);
- }
-}
-
-/**#@-*/
-
-?>
diff --git a/system/pages/guilds.php b/system/pages/guilds.php
index cf030786..b378ab5d 100644
--- a/system/pages/guilds.php
+++ b/system/pages/guilds.php
@@ -12,6 +12,11 @@
defined('MYAAC') or die('Direct access not allowed!');
$title = 'Guilds';
+if(tableExist('guild_members'))
+ define('GUILD_MEMBERS_TABLE', 'guild_members');
+else
+ define('GUILD_MEMBERS_TABLE', 'guild_membership');
+
if($action == 'login')
{
if(check_guild_name($_REQUEST['guild']))
@@ -261,7 +266,7 @@ if($action == 'show')
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
- $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
+ $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if($players_with_rank_number > 0)
@@ -491,7 +496,7 @@ if($action == 'changerank')
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
- $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
+ $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if(count($players_with_rank) > 0)
@@ -573,7 +578,7 @@ if($action == 'changerank')
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
- $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
+ $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if(count($players_with_rank) > 0)
@@ -1598,7 +1603,7 @@ else
if(fieldExist('rank_id', 'players'))
$players_with_rank = $db->query('SELECT `id`, `rank_id` FROM `players` WHERE `rank_id` = ' . $rank->getId() . ' AND `deleted` = 0;');
else
- $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `guild_membership`.`rank_id` as `rank_id` FROM `players`, `guild_membership` WHERE `guild_membership`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `guild_membership`.`player_id` ORDER BY `name`;');
+ $players_with_rank = $db->query('SELECT `players`.`id` as `id`, `' . GUILD_MEMBERS_TABLE . '`.`rank_id` as `rank_id` FROM `players`, `' . GUILD_MEMBERS_TABLE . '` WHERE `' . GUILD_MEMBERS_TABLE . '`.`rank_id` = ' . $rank->getId() . ' AND `players`.`id` = `' . GUILD_MEMBERS_TABLE . '`.`player_id` ORDER BY `name`;');
$players_with_rank_number = $players_with_rank->rowCount();
if($players_with_rank_number > 0) {
diff --git a/system/template.php b/system/template.php
index 4eeddc84..35a64afc 100644
--- a/system/template.php
+++ b/system/template.php
@@ -36,7 +36,9 @@ if($config['template_allow_change'])
}
$template_path = 'templates/' . $template_name;
-if(!file_exists($template_path . '/config.php'))
+if(!file_exists($template_path . '/index.php') &&
+ !file_exists($template_path . '/template.php') &&
+ !file_exists($template_path . '/layout.php'))
{
$template_name = 'kathrine';
$template_path = 'templates/' . $template_name;
@@ -66,7 +68,7 @@ if($exists || ($config['backward_support'] && file_exists($template_path . '/lay
foreach($template_ini as $key => $value)
$config[$key] = $value;
}
-else
+else if(file_exists($template_path . '/config.php'))
require($template_path . '/config.php');
$template = array();
@@ -76,7 +78,7 @@ $template['link_account_lost'] = internalLayoutLink(($config['friendly_urls'] ?
$template['link_account_logout'] = internalLayoutLink(($config['friendly_urls'] ? 'account' : 'accountmanagement'), 'logout');
$template['link_news'] = internalLayoutLink('news');
-$template['link_news_archive'] = internalLayoutLink('news' . ($config['friendly_urls'] ? '' : '') . 'archive');
+$template['link_news_archive'] = internalLayoutLink('news' . ($config['friendly_urls'] ? '/' : '') . 'archive');
$template['link_changelog'] = internalLayoutLink('changelog');
$template['link_rules'] = internalLayoutLink('rules');
$template['link_downloads'] = internalLayoutLink('downloads');
diff --git a/templates/kathrine/template.php b/templates/kathrine/template.php
index 6a9875da..c1d7f117 100644
--- a/templates/kathrine/template.php
+++ b/templates/kathrine/template.php
@@ -51,9 +51,9 @@