From 4465da67e9f2c7ddd28dec9a6b8cc0af63fd8bba Mon Sep 17 00:00:00 2001 From: slawkens1 Date: Fri, 5 May 2017 19:55:25 +0200 Subject: [PATCH] Fixes * fixed support for TFS 0.2 series * added FAQ link --- install/includes/schema.sql | 2 +- system/database.php | 37 ++++++++++++------- system/libs/pot/OTS_Account.php | 15 ++++++-- system/libs/pot/OTS_Player.php | 31 ++++++++++++---- system/pages/accountmanagement.php | 6 ++- system/pages/characters.php | 59 ++++++++++++++++++------------ system/pages/houses.php | 7 +++- templates/kathrine/template.php | 6 ++- templates/tibiacom/index.php | 2 + 9 files changed, 113 insertions(+), 52 deletions(-) diff --git a/install/includes/schema.sql b/install/includes/schema.sql index ae76deac..216f58d4 100644 --- a/install/includes/schema.sql +++ b/install/includes/schema.sql @@ -233,4 +233,4 @@ CREATE TABLE `myaac_visitors` `lastvisit` INT(11) NOT NULL DEFAULT 0, `page` VARCHAR(100) NOT NULL, UNIQUE (`ip`) -) ENGINE = MyISAM; +) ENGINE = MyISAM; \ No newline at end of file diff --git a/system/database.php b/system/database.php index 03e6ecdc..02c058f2 100644 --- a/system/database.php +++ b/system/database.php @@ -3,21 +3,32 @@ defined('MYAAC') or die('Direct access not allowed!'); if(!isset($config['database_type'][0]) || !isset($config['database_user'][0]) || !isset($config['database_password'][0]) || !isset($config['database_name'][0])) { - if(isset($config['lua']['sqlType'])) // tfs 0.3 - { - $config['otserv_version'] = TFS_03; - $config['database_type'] = $config['lua']['sqlType']; - $config['database_host'] = $config['lua']['sqlHost']; - $config['database_port'] = $config['lua']['sqlPort']; - $config['database_user'] = $config['lua']['sqlUser']; - $config['database_password'] = $config['lua']['sqlPass']; - $config['database_name'] = $config['lua']['sqlDatabase']; - - $config['database_encryption'] = $config['lua']['encryptionType']; - if(!isset($config['database_encryption']) || empty($config['database_encryption'])) // before 0.3.6 + if(isset($config['lua']['sqlType'])) {// tfs 0.3 + if(isset($config['lua']['mysqlHost'])) {// tfs 0.2 + $config['otserv_version'] = TFS_02; + $config['database_type'] = 'mysql'; + $config['database_host'] = $config['lua']['mysqlHost']; + $config['database_port'] = $config['lua']['mysqlPort']; + $config['database_user'] = $config['lua']['mysqlUser']; + $config['database_password'] = $config['lua']['mysqlPass']; + $config['database_name'] = $config['lua']['mysqlDatabase']; $config['database_encryption'] = $config['lua']['passwordType']; + } + else { + $config['otserv_version'] = TFS_03; + $config['database_type'] = $config['lua']['sqlType']; + $config['database_host'] = $config['lua']['sqlHost']; + $config['database_port'] = $config['lua']['sqlPort']; + $config['database_user'] = $config['lua']['sqlUser']; + $config['database_password'] = $config['lua']['sqlPass']; + $config['database_name'] = $config['lua']['sqlDatabase']; + + $config['database_encryption'] = $config['lua']['encryptionType']; + if(!isset($config['database_encryption']) || empty($config['database_encryption'])) // before 0.3.6 + $config['database_encryption'] = $config['lua']['passwordType']; + } } - else if(isset($config['lua']['mysqlHost'])) // tfs 0.2/1.0 + else if(isset($config['lua']['mysqlHost'])) // tfs 1.0 { $config['otserv_version'] = TFS_02; $config['database_type'] = 'mysql'; diff --git a/system/libs/pot/OTS_Account.php b/system/libs/pot/OTS_Account.php index 1212e302..1e7894cd 100644 --- a/system/libs/pot/OTS_Account.php +++ b/system/libs/pot/OTS_Account.php @@ -756,10 +756,17 @@ class OTS_Account extends OTS_Row_DAO implements IteratorAggregate, Countable $this->data['banned'] = isset($ban['expires_at']); $this->data['banned_time'] = $ban['expires_at']; } - else { - $ban = $this->db->query('SELECT `active`, `expires` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `active` = 1 AND `value` = ' . $this->data['id'] . ' AND (`expires` > ' . time() .' OR `expires` = -1) ORDER BY `expires` DESC')->fetch(); - $this->data['banned'] = $ban['active']; - $this->data['banned_time'] = $ban['expires']; + else if(tableExist('bans')) { + if(fieldExist('active', 'bans')) { + $ban = $this->db->query('SELECT `active`, `expires` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `active` = 1 AND `value` = ' . $this->data['id'] . ' AND (`expires` > ' . time() .' OR `expires` = -1) ORDER BY `expires` DESC')->fetch(); + $this->data['banned'] = $ban['active']; + $this->data['banned_time'] = $ban['expires']; + } + else { // tfs 0.2 + $ban = $this->db->query('SELECT `time` FROM `bans` WHERE (`type` = 3 OR `type` = 5) AND `account` = ' . $this->data['id'] . ' AND (`time` > ' . time() .' OR `time` = -1) ORDER BY `time` DESC')->fetch(); + $this->data['banned'] = $ban['time'] == -1 || $ban['time'] > 0; + $this->data['banned_time'] = $ban['time']; + } } } diff --git a/system/libs/pot/OTS_Player.php b/system/libs/pot/OTS_Player.php index 7c7a6f75..a4c7f7ed 100644 --- a/system/libs/pot/OTS_Player.php +++ b/system/libs/pot/OTS_Player.php @@ -117,7 +117,12 @@ class OTS_Player extends OTS_Row_DAO { $loss = ''; if(fieldExist('loss_experience', 'players')) { - $loss = ', `loss_experience`, `loss_mana`, `loss_skills`, `loss_items`, `loss_containers`'; + $loss = ', `loss_experience`, `loss_mana`, `loss_skills`'; + } + + $loss_items = ''; + if(fieldExist('loss_items', 'players')) { + $loss_items = ', `loss_items`, `loss_containers`'; } $guild_info = ''; @@ -136,7 +141,7 @@ class OTS_Player extends OTS_Row_DAO } // SELECT query on database - $this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . (fieldExist('lookaddons', 'players') ? ', `lookaddons`' : '') . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull`' . $guild_info . ', `town_id`' . $loss . ', `balance`' . (fieldExist('blessings', 'players') ? ', `blessings`' : '') . (fieldExist('direction', 'players') ? ', `direction`' : '') . (fieldExist('stamina', 'players') ? ', `stamina`' : '') . (fieldExist('world_id', 'players') ? ', `world_id`' : '') . (fieldExist('online', 'players') ? ', `online`' : '') . ', `' . (fieldExist('deletion', 'players') ? 'deletion' : 'deleted') . '`' . (fieldExist('promotion', 'players') ? ', `promotion`' : '') . (fieldExist('marriage', 'players') ? ', `marriage`' : '') . ', `comment`, `created`, `hidden` FROM `players` WHERE `id` = ' . (int)$id)->fetch(); + $this->data = $this->db->query('SELECT `id`, `name`, `account_id`, `group_id`, `sex`, `vocation`, `experience`, `level`, `maglevel`, `health`, `healthmax`, `mana`, `manamax`, `manaspent`, `soul`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`' . (fieldExist('lookaddons', 'players') ? ', `lookaddons`' : '') . ', `posx`, `posy`, `posz`, `cap`, `lastlogin`, `lastlogout`, `lastip`, `save`, `conditions`, `' . $skull_time . '` as `skulltime`, `' . $skull_type . '` as `skull`' . $guild_info . ', `town_id`' . $loss . $loss_items . ', `balance`' . (fieldExist('blessings', 'players') ? ', `blessings`' : '') . (fieldExist('direction', 'players') ? ', `direction`' : '') . (fieldExist('stamina', 'players') ? ', `stamina`' : '') . (fieldExist('world_id', 'players') ? ', `world_id`' : '') . (fieldExist('online', 'players') ? ', `online`' : '') . ', `' . (fieldExist('deletion', 'players') ? 'deletion' : 'deleted') . '`' . (fieldExist('promotion', 'players') ? ', `promotion`' : '') . (fieldExist('marriage', 'players') ? ', `marriage`' : '') . ', `comment`, `created`, `hidden` FROM `players` WHERE `id` = ' . (int)$id)->fetch(); if(!isset($this->data['guildnick']) || $this->data['guildnick']) $this->data['guildnick'] = ''; @@ -278,7 +283,12 @@ class OTS_Player extends OTS_Row_DAO { $loss = ''; if(fieldExist('loss_experience', 'players')) { - $loss = ', `loss_experience` = ' . $this->data['loss_experience'] . ', `loss_mana` = ' . $this->data['loss_mana'] . ', `loss_skills` = ' . $this->data['loss_skills'] . ', `loss_items` = ' . $this->data['loss_items'] . ', `loss_containers` = ' . $this->data['loss_containers']; + $loss = ', `loss_experience` = ' . $this->data['loss_experience'] . ', `loss_mana` = ' . $this->data['loss_mana'] . ', `loss_skills` = ' . $this->data['loss_skills']; + } + + $loss_items = ''; + if(fieldExist('loss_items', 'players')) { + $loss_items = ', `loss_items` = ' . $this->data['loss_items'] . ', `loss_containers` = ' . $this->data['loss_containers']; } $guild_info = ''; @@ -307,7 +317,7 @@ class OTS_Player extends OTS_Row_DAO } // UPDATE query on database - $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('account_id') . ' = ' . $this->data['account_id'] . ', ' . $this->db->fieldName('group_id') . ' = ' . $this->data['group_id'] . ', ' . $this->db->fieldName('sex') . ' = ' . $this->data['sex'] . ', ' . $this->db->fieldName('vocation') . ' = ' . $this->data['vocation'] . ', ' . $this->db->fieldName('experience') . ' = ' . $this->data['experience'] . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ', ' . $this->db->fieldName('maglevel') . ' = ' . $this->data['maglevel'] . ', ' . $this->db->fieldName('health') . ' = ' . $this->data['health'] . ', ' . $this->db->fieldName('healthmax') . ' = ' . $this->data['healthmax'] . ', ' . $this->db->fieldName('mana') . ' = ' . $this->data['mana'] . ', ' . $this->db->fieldName('manamax') . ' = ' . $this->data['manamax'] . ', ' . $this->db->fieldName('manaspent') . ' = ' . $this->data['manaspent'] . ', ' . $this->db->fieldName('soul') . ' = ' . $this->data['soul'] . ', ' . $this->db->fieldName('lookbody') . ' = ' . $this->data['lookbody'] . ', ' . $this->db->fieldName('lookfeet') . ' = ' . $this->data['lookfeet'] . ', ' . $this->db->fieldName('lookhead') . ' = ' . $this->data['lookhead'] . ', ' . $this->db->fieldName('looklegs') . ' = ' . $this->data['looklegs'] . ', ' . $this->db->fieldName('looktype') . ' = ' . $this->data['looktype'] . $lookaddons . ', ' . $this->db->fieldName('posx') . ' = ' . $this->data['posx'] . ', ' . $this->db->fieldName('posy') . ' = ' . $this->data['posy'] . ', ' . $this->db->fieldName('posz') . ' = ' . $this->data['posz'] . ', ' . $this->db->fieldName('cap') . ' = ' . $this->data['cap'] . ', ' . $this->db->fieldName('lastlogin') . ' = ' . $this->data['lastlogin'] . ', ' . $this->db->fieldName('lastlogout') . ' = ' . $this->data['lastlogout'] . ', ' . $this->db->fieldName('lastip') . ' = ' . $this->data['lastip'] . ', ' . $this->db->fieldName('save') . ' = ' . (int) $this->data['save'] . ', ' . $this->db->fieldName('conditions') . ' = ' . $this->db->quote($this->data['conditions']) . ', `' . $skull_time . '` = ' . $this->data['skulltime'] . ', `' . $skull_type . '` = ' . (int) $this->data['skull'] . $guild_info . ', ' . $this->db->fieldName('town_id') . ' = ' . $this->data['town_id'] . $loss . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . $blessings . $stamina . $direction . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); + $this->db->query('UPDATE ' . $this->db->tableName('players') . ' SET ' . $this->db->fieldName('name') . ' = ' . $this->db->quote($this->data['name']) . ', ' . $this->db->fieldName('account_id') . ' = ' . $this->data['account_id'] . ', ' . $this->db->fieldName('group_id') . ' = ' . $this->data['group_id'] . ', ' . $this->db->fieldName('sex') . ' = ' . $this->data['sex'] . ', ' . $this->db->fieldName('vocation') . ' = ' . $this->data['vocation'] . ', ' . $this->db->fieldName('experience') . ' = ' . $this->data['experience'] . ', ' . $this->db->fieldName('level') . ' = ' . $this->data['level'] . ', ' . $this->db->fieldName('maglevel') . ' = ' . $this->data['maglevel'] . ', ' . $this->db->fieldName('health') . ' = ' . $this->data['health'] . ', ' . $this->db->fieldName('healthmax') . ' = ' . $this->data['healthmax'] . ', ' . $this->db->fieldName('mana') . ' = ' . $this->data['mana'] . ', ' . $this->db->fieldName('manamax') . ' = ' . $this->data['manamax'] . ', ' . $this->db->fieldName('manaspent') . ' = ' . $this->data['manaspent'] . ', ' . $this->db->fieldName('soul') . ' = ' . $this->data['soul'] . ', ' . $this->db->fieldName('lookbody') . ' = ' . $this->data['lookbody'] . ', ' . $this->db->fieldName('lookfeet') . ' = ' . $this->data['lookfeet'] . ', ' . $this->db->fieldName('lookhead') . ' = ' . $this->data['lookhead'] . ', ' . $this->db->fieldName('looklegs') . ' = ' . $this->data['looklegs'] . ', ' . $this->db->fieldName('looktype') . ' = ' . $this->data['looktype'] . $lookaddons . ', ' . $this->db->fieldName('posx') . ' = ' . $this->data['posx'] . ', ' . $this->db->fieldName('posy') . ' = ' . $this->data['posy'] . ', ' . $this->db->fieldName('posz') . ' = ' . $this->data['posz'] . ', ' . $this->db->fieldName('cap') . ' = ' . $this->data['cap'] . ', ' . $this->db->fieldName('lastlogin') . ' = ' . $this->data['lastlogin'] . ', ' . $this->db->fieldName('lastlogout') . ' = ' . $this->data['lastlogout'] . ', ' . $this->db->fieldName('lastip') . ' = ' . $this->data['lastip'] . ', ' . $this->db->fieldName('save') . ' = ' . (int) $this->data['save'] . ', ' . $this->db->fieldName('conditions') . ' = ' . $this->db->quote($this->data['conditions']) . ', `' . $skull_time . '` = ' . $this->data['skulltime'] . ', `' . $skull_type . '` = ' . (int) $this->data['skull'] . $guild_info . ', ' . $this->db->fieldName('town_id') . ' = ' . $this->data['town_id'] . $loss . $loss_items . ', ' . $this->db->fieldName('balance') . ' = ' . $this->data['balance'] . $blessings . $stamina . $direction . ' WHERE ' . $this->db->fieldName('id') . ' = ' . $this->data['id']); } // creates new player else @@ -315,8 +325,15 @@ class OTS_Player extends OTS_Row_DAO $loss = ''; $loss_data = ''; if(fieldExist('loss_experience', 'players')) { - $loss = ', `loss_experience`, `loss_mana`, `loss_skills`, `loss_items`, `loss_containers`'; - $loss_data = ', ' . $this->data['loss_experience'] . ', ' . $this->data['loss_mana'] . ', ' . $this->data['loss_skills'] . ', ' . $this->data['loss_items'] . ', ' . $this->data['loss_containers']; + $loss = ', `loss_experience`, `loss_mana`, `loss_skills`'; + $loss_data = ', ' . $this->data['loss_experience'] . ', ' . $this->data['loss_mana'] . ', ' . $this->data['loss_skills']; + } + + $loss_items = ''; + $loss_items_data = ''; + if(fieldExist('loss_items', 'players')) { + $loss_items = ', `loss_items`, `loss_containers`'; + $loss_items_data = ', ' . $this->data['loss_items'] . ', ' . $this->data['loss_containers']; } $guild_info = ''; @@ -362,7 +379,7 @@ class OTS_Player extends OTS_Row_DAO } // INSERT query on database - $this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . $lookaddons . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', `lastlogin`, `lastlogout`, ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', ' . $this->db->fieldName('town_id') . $loss . ', `balance`' . $blessings . $stamina . $direction . ', ' . $this->db->fieldName('created') . $promotion . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . $lookaddons_data . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . ', ' . $this->data['balance'] . $blessings_data . $stamina_data . $direction_data . ', ' . time() . $promotion_data . ')'); + $this->db->query('INSERT INTO ' . $this->db->tableName('players') . ' (' . $this->db->fieldName('name') . ', ' . $this->db->fieldName('account_id') . ', ' . $this->db->fieldName('group_id') . ', ' . $this->db->fieldName('sex') . ', ' . $this->db->fieldName('vocation') . ', ' . $this->db->fieldName('experience') . ', ' . $this->db->fieldName('level') . ', ' . $this->db->fieldName('maglevel') . ', ' . $this->db->fieldName('health') . ', ' . $this->db->fieldName('healthmax') . ', ' . $this->db->fieldName('mana') . ', ' . $this->db->fieldName('manamax') . ', ' . $this->db->fieldName('manaspent') . ', ' . $this->db->fieldName('soul') . ', ' . $this->db->fieldName('lookbody') . ', ' . $this->db->fieldName('lookfeet') . ', ' . $this->db->fieldName('lookhead') . ', ' . $this->db->fieldName('looklegs') . ', ' . $this->db->fieldName('looktype') . $lookaddons . ', ' . $this->db->fieldName('posx') . ', ' . $this->db->fieldName('posy') . ', ' . $this->db->fieldName('posz') . ', ' . $this->db->fieldName('cap') . ', `lastlogin`, `lastlogout`, ' . $this->db->fieldName('lastip') . ', ' . $this->db->fieldName('save') . ', ' . $this->db->fieldName('conditions') . ', `' . $skull_time . '`, `' . $skull_type . '`' . $guild_info . ', ' . $this->db->fieldName('town_id') . $loss . $loss_items . ', `balance`' . $blessings . $stamina . $direction . ', ' . $this->db->fieldName('created') . $promotion . ') VALUES (' . $this->db->quote($this->data['name']) . ', ' . $this->data['account_id'] . ', ' . $this->data['group_id'] . ', ' . $this->data['sex'] . ', ' . $this->data['vocation'] . ', ' . $this->data['experience'] . ', ' . $this->data['level'] . ', ' . $this->data['maglevel'] . ', ' . $this->data['health'] . ', ' . $this->data['healthmax'] . ', ' . $this->data['mana'] . ', ' . $this->data['manamax'] . ', ' . $this->data['manaspent'] . ', ' . $this->data['soul'] . ', ' . $this->data['lookbody'] . ', ' . $this->data['lookfeet'] . ', ' . $this->data['lookhead'] . ', ' . $this->data['looklegs'] . ', ' . $this->data['looktype'] . $lookaddons_data . ', ' . $this->data['posx'] . ', ' . $this->data['posy'] . ', ' . $this->data['posz'] . ', ' . $this->data['cap'] . ', ' . $this->data['lastlogin'] . ', ' . $this->data['lastlogout'] . ', ' . $this->data['lastip'] . ', ' . (int) $this->data['save'] . ', ' . $this->db->quote($this->data['conditions']) . ', ' . $this->data['skulltime'] . ', ' . (int) $this->data['skull'] . $guild_info_data . ', ' . $this->data['town_id'] . $loss_data . $loss_items_data . ', ' . $this->data['balance'] . $blessings_data . $stamina_data . $direction_data . ', ' . time() . $promotion_data . ')'); // ID of new group $this->data['id'] = $this->db->lastInsertId(); } diff --git a/system/pages/accountmanagement.php b/system/pages/accountmanagement.php index f5ac7998..6a45bca0 100644 --- a/system/pages/accountmanagement.php +++ b/system/pages/accountmanagement.php @@ -927,8 +927,12 @@ function checkName() $player->setLossExperience($char_to_copy->getLossExperience()); $player->setLossMana($char_to_copy->getLossMana()); $player->setLossSkills($char_to_copy->getLossSkills()); - $player->setLossItems($char_to_copy->getLossItems()); } + if(fieldExist('loss_items', 'players')) { + $player->setLossItems($char_to_copy->getLossItems()); + $player->setLossContainerse($char_to_copy->getLossContainers()); + } + $player->save(); $player->setCustomField("created", time()); diff --git a/system/pages/characters.php b/system/pages/characters.php index b1635197..0d4771c2 100644 --- a/system/pages/characters.php +++ b/system/pages/characters.php @@ -227,28 +227,33 @@ if($player->isLoaded() && !$player->isDeleted()) $town_field = 'town_id'; else if(fieldExist('townid', 'houses')) $town_field = 'townid'; + else if(!fieldExist('town', 'houses')) + $town_field = false; - $house = $db->query('SELECT `id`, `paid`, `name`, `' . $town_field . '` FROM `houses` WHERE `owner` = '.$player->getId())->fetch(); - if(isset($house['id'])) - { - if($house['paid'] > 0) - $add = ' is paid until '.date("M d Y", $house['paid']); + if(fieldExist('name', 'houses')) { + $house = $db->query('SELECT `id`, `paid`, `name`' . ($town_field != false ? ', `' . $town_field . '` as `town`' : '') . ' FROM `houses` WHERE `owner` = '.$player->getId())->fetch(); + if(isset($house['id'])) + { + $add = ''; + if($house['paid'] > 0) + $add = ' is paid until '.date("M d Y", $house['paid']); - echo - ' - House: - - - - -
'.$house['name'].' ('.$config['towns'][$house[$town_field]].')'.$add.' -
- - -
-
- - '; + echo + ' + House: + + + + +
' . (isset($house['name']) ? $house['name'] : $house['id']) . (isset($house['town']) ? ' (' . $config['towns'][$house[$town_field]] . ')' : '') . $add . ' +
+ + +
+
+ + '; + } } $rank_of_player = $player->getRank(); @@ -452,9 +457,11 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil } } else { + $mostdamage = ''; + if(fieldExist('mostdamage_by', 'player_deaths')) + $mostdamage = ', `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified`'; $deaths = $db->query('SELECT - `player_id`, `time`, `level`, `killed_by`, `is_player`, - `mostdamage_by`, `mostdamage_is_player`, `unjustified`, `mostdamage_unjustified` + `player_id`, `time`, `level`, `killed_by`, `is_player`' . $mostdamage . ' FROM `player_deaths` WHERE `player_id` = ' . $player->getId() . ' ORDER BY `time` DESC LIMIT 10;'); @@ -613,13 +620,17 @@ WHERE killers.death_id = '".$death['id']."' ORDER BY killers.final_hit DESC, kil ' Created:'; $bannedUntil = ''; + $banned = array(); if(tableExist('account_bans')) $banned = $db->query('SELECT `expires_at` as `expires` FROM `account_bans` WHERE `account_id` = '.$account->getId().' and `expires_at` > ' . time()); + else if(tableExist('bans')) { + if(fieldExist('expires', 'bans')) + $banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time()); else - $banned = $db->query('SELECT `expires` FROM `bans` WHERE (`value` = '.$account->getId().' or `value` = '.$player->getId().') and `active` = 1 and `type` != 2 and `type` != 4 and `expires` > ' . time()); + $banned = $db->query('SELECT `time` as `time` FROM `bans` WHERE (`account` = '.$account->getId().' or `player` = '.$player->getId().') and `type` != 2 and `type` != 4 and `time` > ' . time()); + } foreach($banned as $ban) { - if($ban['type'] != 2 and $ban['type'] != 4) $bannedUntil = ' [Banished '.($ban['expires'] == "-1" ? 'forever' : 'until '.date("d F Y, h:s", $ban['expires'])).']'; } echo ''.date("j F Y, g:i a", $account->getCustomField("created")).$bannedUntil.' diff --git a/system/pages/houses.php b/system/pages/houses.php index 71046ae2..70aa3da2 100644 --- a/system/pages/houses.php +++ b/system/pages/houses.php @@ -12,6 +12,10 @@ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Houses'; +if(!fieldExist('name', 'houses')) { + echo 'Houses list is not available on this server.'; + return; +} $rent = trim(strtolower($config['lua']['houseRentPeriod'])); if($rent != 'yearly' && $rent != 'monthly' && $rent != 'weekly' && $rent != 'daily') $rent = 'never'; @@ -29,7 +33,8 @@ $type = ''; { $beds = array("", "one", "two", "three", "fourth", "fifth"); $houseName = $_REQUEST['house']; - $house = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName)); + $houseId = (check_number($_REQUEST['house']) ? $_REQUEST['house'] : -1); + $house = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId)); if($house->rowCount() > 0) { diff --git a/templates/kathrine/template.php b/templates/kathrine/template.php index f22cc4ed..d75c9a75 100644 --- a/templates/kathrine/template.php +++ b/templates/kathrine/template.php @@ -93,8 +93,10 @@ Highscores Last Deaths + Houses + Bans @@ -127,6 +129,8 @@ Screenshots Experience Table + + FAQ Server Online » Players Online: ' . $status['players'] . ' / ' . $status['playersMax'] . ' » - Monsters: ' . $status['monsters'] . ' » Uptime: ' . $status['uptimeReadable'] . ''; + Monsters: ' . $status['monsters'] . ' » Uptime: ' . (isset($status['uptimeReadable']) ? $status['uptimeReadable'] : 'Unknown') . ''; else echo 'Server Offline'; ?> diff --git a/templates/tibiacom/index.php b/templates/tibiacom/index.php index bc367652..9a5f5e91 100644 --- a/templates/tibiacom/index.php +++ b/templates/tibiacom/index.php @@ -420,6 +420,7 @@ echo "
+ '> + '>