Compatibility with OTHire (#330)

* Preparing compatibility to OTHire

* Still working on compatibility to OTHire

* More compatibility

* More compatibility

Not tested yet

* Some fixes

- Fixed Account Creation.
- Fixed a problem that you can't load the website, that include that you can now recover your account number.

* More fixes

- Fixed character creation.
- Fixed login problem.
- Fixed displaying account number in My Account.
- Fixed displaying if you have premium days or not in My Account.

* More fixes

- Handle Kills/Deaths as TFS_03

* More fixes

- Fixed showing outfits in character profile
- Fixed displaying player houses in character profile
- Fixed displaying guilds

* Update init.php
This commit is contained in:
Rodrigo Paixão 2018-12-03 04:58:29 -02:00 committed by Stefan A. Brannfjell
parent 0d51f87c76
commit 2817010781
30 changed files with 377 additions and 198 deletions

View File

@ -37,7 +37,7 @@ Without modifying config.php, enter the website and wait for mysql connection er
This will show you the rest of the instructions as well as the mysql schema. This will show you the rest of the instructions as well as the mysql schema.
2: Edit config.php and: 2: Edit config.php and:
- modify $config['TFSVersion'] with correct TFS version you are running. (TFS_02, TFS_03, TFS_10). - modify $config['ServerEngine'] with correct TFS version you are running. (TFS_02, TFS_03, TFS_10).
- modify $config['page_admin_access'] with your admin account username(s). - modify $config['page_admin_access'] with your admin account username(s).
3: Before inserting correct SQL connection details, visit the website ( http://127.0.0.1/ ), it will generate a mysql schema you should import to your OT servers database. 3: Before inserting correct SQL connection details, visit the website ( http://127.0.0.1/ ), it will generate a mysql schema you should import to your OT servers database.
@ -56,6 +56,7 @@ This will show you the rest of the instructions as well as the mysql schema.
Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer. Znote AAC is very rich feature wise, here is an attempt at summarizing what we offer.
#### Server distribution compatibility: #### Server distribution compatibility:
- OTHire
- TFS 0.2 - TFS 0.2
- TFS 0.3/4 - TFS 0.3/4
- TFS 1.x - TFS 1.x

View File

@ -50,9 +50,9 @@ if (empty($_POST) === false) {
$acc_id = user_character_account_id($_POST['reset_pass']); $acc_id = user_character_account_id($_POST['reset_pass']);
if ($acc_id != $session_user_id) { if ($acc_id != $session_user_id) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($acc_id, $_POST['new_pass']); user_change_password($acc_id, $_POST['new_pass']);
} else if ($config['TFSVersion'] == 'TFS_03') { } else if ($config['ServerEngine'] == 'TFS_03') {
user_change_password03($acc_id, $_POST['new_pass']); user_change_password03($acc_id, $_POST['new_pass']);
} }
$errors[] = 'The password to the account of character name: '. getValue($_POST['reset_pass']) .' has been set to: '. getValue($_POST['new_pass']) .'.'; $errors[] = 'The password to the account of character name: '. getValue($_POST['reset_pass']) .' has been set to: '. getValue($_POST['new_pass']) .'.';
@ -89,9 +89,9 @@ if (empty($_POST) === false) {
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) { if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
if (user_character_exist($_POST['position_name'])) { if (user_character_exist($_POST['position_name'])) {
if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) { if (array_key_exists($_POST['position_type'], $config['ingame_positions'])) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
set_ingame_position($_POST['position_name'], $_POST['position_type']); set_ingame_position($_POST['position_name'], $_POST['position_type']);
} else if ($config['TFSVersion'] == 'TFS_03') { } else if ($config['ServerEngine'] == 'TFS_03') {
set_ingame_position03($_POST['position_name'], $_POST['position_type']); set_ingame_position03($_POST['position_name'], $_POST['position_type']);
} }
$pos = 'Undefined'; $pos = 'Undefined';
@ -239,7 +239,7 @@ echo "Last cached on: ". getClock($basic['cached'], true) .".<br>";
<li> <li>
<b>Set character name to position:</b> <b>Set character name to position:</b>
<?php <?php
if ($config['TFSVersion'] == 'TFS_03' && count($config['ingame_positions']) == 5) { if ($config['ServerEngine'] == 'TFS_03' && count($config['ingame_positions']) == 5) {
?> ?>
<font color="red">ERROR: You forgot to add (Senior Tutor) rank in config.php!</font> <font color="red">ERROR: You forgot to add (Senior Tutor) rank in config.php!</font>
<?php <?php

View File

@ -13,7 +13,7 @@ function playerSkill($skills, $id) {
// UPDATE SKILLS POST // UPDATE SKILLS POST
if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) { if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
$pid = (int)$_POST['pid']; $pid = (int)$_POST['pid'];
if ($config['TFSVersion'] != 'TFS_10') $status = user_is_online($pid); if ($config['ServerEngine'] != 'TFS_10') $status = user_is_online($pid);
else $status = user_is_online_10($pid); else $status = user_is_online_10($pid);
if (!$status) { if (!$status) {
@ -46,7 +46,7 @@ if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
$newcap = $playercnf['base']['cap'] + ($statgain['cap'] * $LevelsFromBase); $newcap = $playercnf['base']['cap'] + ($statgain['cap'] * $LevelsFromBase);
// Calibrate hp/mana/cap // Calibrate hp/mana/cap
if ($config['TFSVersion'] != 'TFS_10') { if ($config['ServerEngine'] != 'TFS_10') {
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['fist'] ."' WHERE `player_id`='$pid' AND `skillid`='0' LIMIT 1;"); mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['fist'] ."' WHERE `player_id`='$pid' AND `skillid`='0' LIMIT 1;");
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['club'] ."' WHERE `player_id`='$pid' AND `skillid`='1' LIMIT 1;"); mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['club'] ."' WHERE `player_id`='$pid' AND `skillid`='1' LIMIT 1;");
mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['sword'] ."' WHERE `player_id`='$pid' AND `skillid`='2' LIMIT 1;"); mysql_update("UPDATE `player_skills` SET `value`='". (int)$_POST['sword'] ."' WHERE `player_id`='$pid' AND `skillid`='2' LIMIT 1;");
@ -86,7 +86,7 @@ if ($name !== false) {
if (user_character_exist($name)) { if (user_character_exist($name)) {
$pid = user_character_id($name); $pid = user_character_id($name);
if ($config['TFSVersion'] != 'TFS_10') { if ($config['ServerEngine'] != 'TFS_10') {
$skills = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$pid' LIMIT 7;"); $skills = mysql_select_multi("SELECT `value` FROM `player_skills` WHERE `player_id`='$pid' LIMIT 7;");
$player = mysql_select_single("SELECT `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='$pid' LIMIT 1;"); $player = mysql_select_single("SELECT `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='$pid' LIMIT 1;");
$skills[] = array('value' => $player['maglevel']); $skills[] = array('value' => $player['maglevel']);

View File

@ -17,7 +17,7 @@ if (!isset($config['api']['debug'])) $config['api']['debug'] = false;
$response = array( $response = array(
'version' => array( 'version' => array(
'znote' => $version, 'znote' => $version,
'ot' => $config['TFSVersion'] 'ot' => $config['ServerEngine']
), ),
); );

View File

@ -39,7 +39,7 @@ $response['data']['accounts'] = ($accounts !== false) ? (int)$accounts['count']
$players = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players`;"); $players = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players`;");
$response['data']['players'] = ($players !== false) ? (int)$players['count'] : 0; $response['data']['players'] = ($players !== false) ? (int)$players['count'] : 0;
// online player count // online player count
if ($config['TFSVersion'] != 'TFS_10') { if ($config['ServerEngine'] != 'TFS_10') {
$online = mysql_select_single("SELECT COUNT('id') AS `count`, COUNT(DISTINCT `lastip`) AS `unique` FROM `players` WHERE `online`='1';"); $online = mysql_select_single("SELECT COUNT('id') AS `count`, COUNT(DISTINCT `lastip`) AS `unique` FROM `players` WHERE `online`='1';");
} else { } else {
$online = mysql_select_single("SELECT COUNT(`o`.`player_id`) AS `count`, COUNT(DISTINCT `p`.`lastip`) AS `unique` FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id`;"); $online = mysql_select_single("SELECT COUNT(`o`.`player_id`) AS `count`, COUNT(DISTINCT `p`.`lastip`) AS `unique` FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id`;");

View File

@ -21,10 +21,10 @@ if (empty($_POST) === false) {
// $_POST[''] // $_POST['']
// .3 compatibility // .3 compatibility
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) { if ($config['ServerEngine'] == 'TFS_03' && $config['salt'] === true) {
$salt = user_data($session_user_id, 'salt'); $salt = user_data($session_user_id, 'salt');
} }
if (sha1($_POST['current_password']) === $pass_data['password'] || $config['TFSVersion'] == 'TFS_03' && $config['salt'] === true && sha1($salt['salt'].$_POST['current_password']) === $pass_data['password']) { if (sha1($_POST['current_password']) === $pass_data['password'] || $config['ServerEngine'] == 'TFS_03' && $config['salt'] === true && sha1($salt['salt'].$_POST['current_password']) === $pass_data['password']) {
if (trim($_POST['new_password']) !== trim($_POST['new_password_again'])) { if (trim($_POST['new_password']) !== trim($_POST['new_password_again'])) {
$errors[] = 'Your new passwords do not match.'; $errors[] = 'Your new passwords do not match.';
} else if (strlen($_POST['new_password']) < 6) { } else if (strlen($_POST['new_password']) < 6) {
@ -50,9 +50,9 @@ if (isset($_GET['success']) && empty($_GET['success'])) {
} else { } else {
if (empty($_POST) === false && empty($errors) === true) { if (empty($_POST) === false && empty($errors) === true) {
//Posted the form without errors //Posted the form without errors
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
user_change_password($session_user_id, $_POST['new_password']); user_change_password($session_user_id, $_POST['new_password']);
} else if ($config['TFSVersion'] == 'TFS_03') { } else if ($config['ServerEngine'] == 'TFS_03') {
user_change_password03($session_user_id, $_POST['new_password']); user_change_password03($session_user_id, $_POST['new_password']);
} }
header('Location: changepassword.php?success'); header('Location: changepassword.php?success');

View File

@ -11,7 +11,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
if ($user_id !== false) { if ($user_id !== false) {
$loadOutfits = $config['show_outfits']['characterprofile']; $loadOutfits = $config['show_outfits']['characterprofile'];
if ($config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_10') {
if (!$loadOutfits) { if (!$loadOutfits) {
$profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin'); $profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin');
} else { // Load outfits } else { // Load outfits
@ -27,7 +27,10 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
if (!$loadOutfits) { if (!$loadOutfits) {
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex'); $profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex');
} else { // Load outfits } else { // Load outfits
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype', 'lookaddons'); if ($config['ServerEngine'] !== 'OTHIRE')
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype', 'lookaddons');
else
$profile_data = user_character_data($user_id, 'name', 'account_id', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'lastlogin', 'online', 'sex', 'lookbody', 'lookfeet', 'lookhead', 'looklegs', 'looktype');
} }
} }
@ -142,9 +145,14 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<!-- Display house start --> <!-- Display house start -->
<?php <?php
if ($config['TFSVersion'] !== 'TFS_02') if ($config['ServerEngine'] !== 'TFS_02' || $config['ServerEngine'] == 'OTHIRE')
{ {
$townid = ($config['TFSVersion'] === 'TFS_03') ? 'town' : 'town_id'; if ($config['ServerEngine'] == 'OTHIRE')
$townid = 'townid';
if ($config['ServerEngine'] == 'TFS_03')
$townid = 'town';
if ($config['ServerEngine'] !== 'TFS_03' && $config['ServerEngine'] !== 'OTHIRE')
$townid = 'town_id';
$houses = mysql_select_multi("SELECT `id`, `owner`, `name`, `$townid` AS `town_id` FROM `houses` WHERE `owner` = $user_id;"); $houses = mysql_select_multi("SELECT `id`, `owner`, `name`, `$townid` AS `town_id` FROM `houses` WHERE `owner` = $user_id;");
if ($houses) if ($houses)
@ -180,7 +188,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<!-- Display player status --> <!-- Display player status -->
<li><font class="profile_font" name="profile_font_status">Status:</font> <?php <li><font class="profile_font" name="profile_font_status">Status:</font> <?php
if ($config['TFSVersion'] == 'TFS_10') if ($config['ServerEngine'] == 'TFS_10')
{ {
if ($profile_data['online']) if ($profile_data['online'])
{ {
@ -276,7 +284,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
<li> <li>
<b>Death List:</b><br> <b>Death List:</b><br>
<?php <?php
if ($config['TFSVersion'] == 'TFS_02') if ($config['ServerEngine'] == 'TFS_02')
{ {
$array = user_fetch_deathlist($user_id); $array = user_fetch_deathlist($user_id);
if ($array) if ($array)
@ -313,7 +321,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
echo '<b><font color="green">This player has never died.</font></b>'; echo '<b><font color="green">This player has never died.</font></b>';
} }
} }
else if ($config['TFSVersion'] == 'TFS_10') else if ($config['ServerEngine'] == 'TFS_10')
{ {
$deaths = mysql_select_multi("SELECT $deaths = mysql_select_multi("SELECT
`player_id`, `time`, `level`, `killed_by`, `is_player`, `player_id`, `time`, `level`, `killed_by`, `is_player`,
@ -355,7 +363,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
echo '<b><font color="green">This player has never died.</font></b>'; echo '<b><font color="green">This player has never died.</font></b>';
} }
} }
else if ($config['TFSVersion'] == 'TFS_03') else if ($config['ServerEngine'] == 'TFS_03' || $config['ServerEngine'] == 'OTHIRE')
{ {
//mysql_select_single("SELECT * FROM players WHERE name='TEST DEBUG';"); //mysql_select_single("SELECT * FROM players WHERE name='TEST DEBUG';");
$array = user_fetch_deathlist03($user_id); $array = user_fetch_deathlist03($user_id);

View File

@ -8,12 +8,13 @@
// Tested with TFS items.xml master (1.3) // Tested with TFS items.xml master (1.3)
$config['items'] = false; $config['items'] = false;
// Available options: TFS_02, TFS_03 // Available options: TFS_02, TFS_03, OTHIRE
// OTHire = OTHIRE
// TFS 0.2 = TFS_02 // TFS 0.2 = TFS_02
// TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)! // TFS 0.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
// TFS 0.4 = TFS_03 // TFS 0.4 = TFS_03
// TFS 1.0 = TFS_10 (Under developement) // TFS 1.0 = TFS_10 (Under developement)
$config['TFSVersion'] = 'TFS_10'; $config['ServerEngine'] = 'TFS_10';
// As far as I know, OTX is based on TFS_03, so make sure TFS version is configured TFS_03 // As far as I know, OTX is based on TFS_03, so make sure TFS version is configured TFS_03
$config['CustomVersion'] = false; $config['CustomVersion'] = false;
@ -28,6 +29,9 @@
// MYSQL CONNECTION DETAILS \\ // MYSQL CONNECTION DETAILS \\
// ------------------------ \\ // ------------------------ \\
if ($config['ServerEngine'] !== 'OTHIRE') {
// TFS DATABASE CONFIGS
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.). // phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
$config['sqlUser'] = 'tfs13'; $config['sqlUser'] = 'tfs13';
@ -39,6 +43,21 @@
// Hostname is usually localhost or 127.0.0.1. // Hostname is usually localhost or 127.0.0.1.
$config['sqlHost'] = '127.0.0.1'; $config['sqlHost'] = '127.0.0.1';
} else {
// OTHIRE DATABASE CONFIG
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
$config['sql_user'] = 'tfs13';
// phpmyadmin password for OT server:
$config['sql_pass'] = 'tfs13';
// The database name to connect to. (This is usually same as username).
$config['sql_db'] = 'tfs13';
// Hostname is usually localhost or 127.0.0.1.
$config['sql_host'] = '127.0.0.1';
}
// QR code authenticator Only works with TFS 1.2+ // QR code authenticator Only works with TFS 1.2+
$config['twoFactorAuthenticator'] = false; $config['twoFactorAuthenticator'] = false;

View File

@ -2,9 +2,9 @@
$cache = new Cache('engine/cache/deaths'); $cache = new Cache('engine/cache/deaths');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10') {
$deaths = fetchLatestDeaths(); $deaths = fetchLatestDeaths();
} else if ($config['TFSVersion'] == 'TFS_03') { } else if ($config['ServerEngine'] == 'TFS_03' || $config['ServerEngine'] == 'OTHIRE') {
$deaths = fetchLatestDeaths_03(30); $deaths = fetchLatestDeaths_03(30);
} }
$cache->setContent($deaths); $cache->setContent($deaths);
@ -27,7 +27,7 @@ if ($deaths) {
echo "<td>". getClock($death['time'], true) ."</td>"; echo "<td>". getClock($death['time'], true) ."</td>";
if ($death['is_player'] == 1) echo "<td>Player: <a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>"; if ($death['is_player'] == 1) echo "<td>Player: <a href='characterprofile.php?name=". $death['killed_by'] ."'>". $death['killed_by'] ."</a></td>";
else if ($death['is_player'] == 0) { else if ($death['is_player'] == 0) {
if ($config['TFSVersion'] == 'TFS_03') echo "<td>Monster: ". ucfirst(str_replace("a ", "", $death['killed_by'])) ."</td>"; if ($config['ServerEngine'] == 'TFS_03') echo "<td>Monster: ". ucfirst(str_replace("a ", "", $death['killed_by'])) ."</td>";
else echo "<td>Monster: ". ucfirst($death['killed_by']) ."</td>"; else echo "<td>Monster: ". ucfirst($death['killed_by']) ."</td>";
} }
else echo "<td>". $death['killed_by'] ."</td>"; else echo "<td>". $death['killed_by'] ."</td>";

View File

@ -274,8 +274,11 @@ CREATE TABLE IF NOT EXISTS `znote_global_storage` (
</li> </li>
</ol> </ol>
"; ";
if ($config['ServerEngine'] !== 'OTHIRE')
$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
else
$connect = new mysqli($config['sql_host'], $config['sql_user'], $config['sql_pass'], $config['sql_db']);
$connect = new mysqli($config['sqlHost'], $config['sqlUser'], $config['sqlPassword'], $config['sqlDatabase']);
if ($connect->connect_errno) { if ($connect->connect_errno) {
die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install); die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
} }

View File

@ -123,7 +123,7 @@ function bomberman_highscores() {
// Support list // Support list
function support_list() { function support_list() {
$TFS = Config('TFSVersion'); $TFS = Config('ServerEngine');
if ($TFS == 'TFS_10') $staffs = mysql_select_multi("SELECT `id`, `group_id`, `name`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;"); if ($TFS == 'TFS_10') $staffs = mysql_select_multi("SELECT `id`, `group_id`, `name`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
else $staffs = mysql_select_multi("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;"); else $staffs = mysql_select_multi("SELECT `group_id`, `name`, `online`, `account_id` FROM `players` WHERE `group_id` > 1 ORDER BY `group_id` ASC;");
@ -286,7 +286,7 @@ function guild_change_leader($nCid, $oCid) {
if ($status) { if ($status) {
// Update players and set their new rank id // Update players and set their new rank id
if (config('TFSVersion') !== 'TFS_10') { if (config('ServerEngine') !== 'TFS_10') {
mysql_update("UPDATE `players` SET `rank_id`='$leader_rid' WHERE `id`=$nCid LIMIT 1;"); mysql_update("UPDATE `players` SET `rank_id`='$leader_rid' WHERE `id`=$nCid LIMIT 1;");
mysql_update("UPDATE `players` SET `rank_id`='$vice_rid' WHERE `id`=$oCid LIMIT 1;"); mysql_update("UPDATE `players` SET `rank_id`='$vice_rid' WHERE `id`=$oCid LIMIT 1;");
} else { } else {
@ -305,20 +305,29 @@ function guild_change_leader($nCid, $oCid) {
function guild_new_leader($new_leader, $gid) { function guild_new_leader($new_leader, $gid) {
$new_leader = (int)$new_leader; $new_leader = (int)$new_leader;
$gid = (int)$gid; $gid = (int)$gid;
mysql_update("UPDATE `guilds` SET `ownerid`='$new_leader' WHERE `id`=$gid"); if (config('ServerEngine') !== 'OTHIRE')
mysql_update("UPDATE `guilds` SET `ownerid`='$new_leader' WHERE `id`=$gid");
else
mysql_update("UPDATE `guilds` SET `owner_id`='$new_leader' WHERE `id`=$gid");
} }
// Returns $gid of a guild leader($cid). // Returns $gid of a guild leader($cid).
function guild_leader_gid($leader) { function guild_leader_gid($leader) {
$leader = (int)$leader; $leader = (int)$leader;
$data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `ownerid`='$leader';"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `ownerid`='$leader';");
else
$data = mysql_select_single("SELECT `id` FROM `guilds` WHERE `owner_id`='$leader';");
return ($data === false) ? false : $data['id']; return ($data === false) ? false : $data['id'];
} }
// Returns guild leader(charID) of a guild. (parameter: guild_ID) // Returns guild leader(charID) of a guild. (parameter: guild_ID)
function guild_leader($gid) { function guild_leader($gid) {
$gid = (int)$gid; $gid = (int)$gid;
$data = mysql_select_single("SELECT `ownerid` FROM `guilds` WHERE `id`='$gid';"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `ownerid` FROM `guilds` WHERE `id`='$gid';");
else
$data = mysql_select_single("SELECT `owner_id` FROM `guilds` WHERE `id`='$gid';");
return ($data !== false) ? $data['ownerid'] : false; return ($data !== false) ? $data['ownerid'] : false;
} }
@ -351,7 +360,7 @@ function guild_player_join($cid, $gid) {
// Create a status we can return depending on results. // Create a status we can return depending on results.
$status = false; $status = false;
if (config('TFSVersion') !== 'TFS_10') { if (config('ServerEngine') !== 'TFS_10') {
// Get rank data // Get rank data
$ranks = get_guild_rank_data($gid); $ranks = get_guild_rank_data($gid);
// Locate rank id for regular member position in this guild // Locate rank id for regular member position in this guild
@ -450,7 +459,10 @@ function create_guild($cid, $name) {
$time = time(); $time = time();
// Create the guild // Create the guild
mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');"); if (config('ServerEngine') !== 'OTHIRE')
mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');");
else
mysql_insert("INSERT INTO `guilds` (`name`, `owner_id`, `creationdate`) VALUES ('$name', '$cid', '$time');");
// Get guild id // Get guild id
$gid = get_guild_id($name); $gid = get_guild_id($name);
@ -460,14 +472,14 @@ function create_guild($cid, $name) {
$rid = ($data !== false) ? $data['id'] : false; $rid = ($data !== false) ? $data['id'] : false;
// Give player rank id for leader of his guild // Give player rank id for leader of his guild
if (config('TFSVersion') !== 'TFS_10') mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`='$cid' LIMIT 1;"); if (config('ServerEngine') !== 'TFS_10') mysql_update("UPDATE `players` SET `rank_id`='$rid' WHERE `id`='$cid' LIMIT 1;");
else mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('$cid', '$gid', '$rid', '');"); else mysql_insert("INSERT INTO `guild_membership` (`player_id`, `guild_id`, `rank_id`, `nick`) VALUES ('$cid', '$gid', '$rid', '');");
} }
// Search player table on cid for his rank_id, returns rank_id // Search player table on cid for his rank_id, returns rank_id
function get_character_guild_rank($cid) { function get_character_guild_rank($cid) {
$cid = (int)$cid; $cid = (int)$cid;
if (config('TFSVersion') !== 'TFS_10') { if (config('ServerEngine') !== 'TFS_10') {
$data = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid';"); $data = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid';");
return ($data !== false && $data['rank_id'] > 0) ? $data['rank_id'] : false; return ($data !== false && $data['rank_id'] > 0) ? $data['rank_id'] : false;
} else { } else {
@ -493,7 +505,7 @@ function get_guild_position($rid) {
// Get a players rank_id, guild_id, rank_level(ID), rank_name(string), using cid(player id) // Get a players rank_id, guild_id, rank_level(ID), rank_name(string), using cid(player id)
function get_player_guild_data($cid) { function get_player_guild_data($cid) {
$cid = (int)$cid; $cid = (int)$cid;
if (config('TFSVersion') !== 'TFS_10') $playerdata = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid' LIMIT 1;"); if (config('ServerEngine') !== 'TFS_10') $playerdata = mysql_select_single("SELECT `rank_id` FROM `players` WHERE `id`='$cid' LIMIT 1;");
else $playerdata = mysql_select_single("SELECT `rank_id` FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;"); else $playerdata = mysql_select_single("SELECT `rank_id` FROM `guild_membership` WHERE `player_id`='$cid' LIMIT 1;");
if ($playerdata !== false) { if ($playerdata !== false) {
@ -523,25 +535,31 @@ function get_guild_id($name) {
// Returns guild data from name // Returns guild data from name
function get_guild_data($name) { function get_guild_data($name) {
$name = sanitize($name); $name = sanitize($name);
return mysql_select_single("SELECT `id`, `name`, `ownerid`, `creationdata`, `motd` FROM `guilds` WHERE `name`='$name' LIMIT 1;"); if (config('ServerEngine') !== 'OTHIRE')
return mysql_select_single("SELECT `id`, `name`, `ownerid`, `creationdata`, `motd` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
else
return mysql_select_single("SELECT `id`, `name`, `owner_id`, `creationdate` FROM `guilds` WHERE `name`='$name' LIMIT 1;");
} }
// Get complete list of guilds // Get complete list of guilds
function get_guilds_list() { function get_guilds_list() {
return mysql_select_multi("SELECT `id`, `name`, `creationdata` FROM `guilds` ORDER BY `name`;"); if (config('ServerEngine') !== 'OTHIRE')
return mysql_select_multi("SELECT `id`, `name`, `creationdata` FROM `guilds` ORDER BY `name`;");
else
return mysql_select_multi("SELECT `id`, `name`, `creationdate` FROM `guilds` ORDER BY `name`;");
} }
// Get array of player data related to a guild. // Get array of player data related to a guild.
function get_guild_players($gid) { function get_guild_players($gid) {
$gid = (int)$gid; // Sanitizing the parameter id $gid = (int)$gid; // Sanitizing the parameter id
if (config('TFSVersion') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;"); if (config('ServerEngine') !== 'TFS_10') return mysql_select_multi("SELECT `p`.`rank_id`, `p`.`name`, `p`.`level`, `p`.`guildnick`, `p`.`vocation`, `p`.`online`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `p`.`rank_id` WHERE `gr`.`guild_id` ='$gid' ORDER BY `gr`.`id`, `p`.`name`;");
else return mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `gm`.`rank_id`, `gm`.`nick` AS `guildnick`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `gm`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `gm`.`rank_id` WHERE `gm`.`guild_id` = '$gid' ORDER BY `gm`.`rank_id`, `p`.`name`"); else return mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `gm`.`rank_id`, `gm`.`nick` AS `guildnick`, `gr`.`name` AS `rank_name`, `gr`.`level` AS `rank_level` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `gm`.`player_id` = `p`.`id` LEFT JOIN `guild_ranks` AS `gr` ON `gr`.`id` = `gm`.`rank_id` WHERE `gm`.`guild_id` = '$gid' ORDER BY `gm`.`rank_id`, `p`.`name`");
} }
// Get guild level data (avg level, total level, count of players) // Get guild level data (avg level, total level, count of players)
function get_guild_level_data($gid) { function get_guild_level_data($gid) {
$gid = (int)$gid; $gid = (int)$gid;
$data = (config('TFSVersion') !== 'TFS_10') ? mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id ='$gid';") : mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_membership AS gm ON gm.player_id = p.id WHERE gm.guild_id = '$gid' ORDER BY gm.rank_id, p.name;"); $data = (config('ServerEngine') !== 'TFS_10') ? mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id ='$gid';") : mysql_select_multi("SELECT p.level FROM players AS p LEFT JOIN guild_membership AS gm ON gm.player_id = p.id WHERE gm.guild_id = '$gid' ORDER BY gm.rank_id, p.name;");
$members = 0; $members = 0;
$totallevels = 0; $totallevels = 0;
if ($data !== false) { if ($data !== false) {
@ -556,7 +574,7 @@ function get_guild_level_data($gid) {
// Returns total members in a guild (integer) // Returns total members in a guild (integer)
function count_guild_members($gid) { function count_guild_members($gid) {
$gid = (int)$gid; $gid = (int)$gid;
if (config('TFSVersion') !== 'TFS_10') { if (config('ServerEngine') !== 'TFS_10') {
$data = mysql_select_single("SELECT COUNT(p.id) AS total FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =$gid"); $data = mysql_select_single("SELECT COUNT(p.id) AS total FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =$gid");
return ($data !== false) ? $data['total'] : false; return ($data !== false) ? $data['total'] : false;
} else { } else {
@ -636,6 +654,7 @@ function gesior_sql_killer($did) {
} }
// end gesior // end gesior
// END GUILD WAR // END GUILD WAR
// ADMIN FUNCTIONS // ADMIN FUNCTIONS
function set_ingame_position($name, $acctype) { function set_ingame_position($name, $acctype) {
$acctype = (int)$acctype; $acctype = (int)$acctype;
@ -690,9 +709,9 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
if (user_character_exist($bannedby)) { if (user_character_exist($bannedby)) {
$bannedby = user_character_id($bannedby); $bannedby = user_character_id($bannedby);
if (Config('TFSVersion') === 'TFS_02') if (Config('ServerEngine') === 'TFS_02')
mysql_insert("INSERT INTO `bans` (`type` ,`ip` ,`mask` ,`player` ,`account` ,`time` ,`reason_id` ,`action_id` ,`comment` ,`banned_by`) VALUES ('$typeid', '$charip', '4294967295', '$charid', '$accountid', '$time', '$reasonid', '$actionid', '$comment', '$bannedby');"); mysql_insert("INSERT INTO `bans` (`type` ,`ip` ,`mask` ,`player` ,`account` ,`time` ,`reason_id` ,`action_id` ,`comment` ,`banned_by`) VALUES ('$typeid', '$charip', '4294967295', '$charid', '$accountid', '$time', '$reasonid', '$actionid', '$comment', '$bannedby');");
elseif (Config('TFSVersion') === 'TFS_03') { elseif (Config('ServerEngine') === 'TFS_03') {
$now = time(); $now = time();
switch ($typeid) { switch ($typeid) {
case 1: // IP ban case 1: // IP ban
@ -716,7 +735,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
break; break;
} }
} }
elseif (Config('TFSVersion') === 'TFS_10') { elseif (Config('ServerEngine') === 'TFS_10') {
$now = time(); $now = time();
switch ($typeid) { switch ($typeid) {
@ -751,6 +770,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
} }
// -- END admin // -- END admin
// Fetch deathlist // Fetch deathlist
function user_fetch_deathlist($char_id) { function user_fetch_deathlist($char_id) {
$char_id = (int)$char_id; $char_id = (int)$char_id;
@ -839,7 +859,7 @@ function user_character_list($account_id) {
//$count = user_character_list_count($account_id); //$count = user_character_list_count($account_id);
$account_id = (int)$account_id; $account_id = (int)$account_id;
if (config('TFSVersion') == 'TFS_10') { if (config('ServerEngine') == 'TFS_10') {
$characters = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `p`.`town_id`, `p`.`lastlogin`, `gm`.`rank_id`, `po`.`player_id` AS `online` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `p`.`id`=`gm`.`player_id` LEFT JOIN `players_online` AS `po` ON `p`.`id`=`po`.`player_id` WHERE `p`.`account_id`='$account_id' ORDER BY `p`.`level` DESC"); $characters = mysql_select_multi("SELECT `p`.`id`, `p`.`name`, `p`.`level`, `p`.`vocation`, `p`.`town_id`, `p`.`lastlogin`, `gm`.`rank_id`, `po`.`player_id` AS `online` FROM `players` AS `p` LEFT JOIN `guild_membership` AS `gm` ON `p`.`id`=`gm`.`player_id` LEFT JOIN `players_online` AS `po` ON `p`.`id`=`po`.`player_id` WHERE `p`.`account_id`='$account_id' ORDER BY `p`.`level` DESC");
if ($characters !== false) { if ($characters !== false) {
for ($i = 0; $i < count($characters); $i++) { for ($i = 0; $i < count($characters); $i++) {
@ -996,16 +1016,30 @@ function user_recover($mode, $edom, $email, $character, $ip) {
$ip = character IP $ip = character IP
*/ */
// Structure verify array data correctly // Structure verify array data correctly
if ($mode === 'username') { if (config('ServerEngine') !== 'OTHIRE') {
$verify_data = array( if ($mode === 'username') {
'password' => sha1($edom), $verify_data = array(
'email' => $email 'password' => sha1($edom),
); 'email' => $email
);
} else {
$verify_data = array(
'name' => $edom,
'email' => $email
);
}
} else { } else {
$verify_data = array( if ($mode === 'username') {
'name' => $edom, $verify_data = array(
'email' => $email 'password' => sha1($edom),
); 'email' => $email
);
} else {
$verify_data = array(
'id' => $edom,
'email' => $email
);
}
} }
// Determine if the submitted information is correct and herit from same account // Determine if the submitted information is correct and herit from same account
if (user_account_fields_verify_value($verify_data)) { if (user_account_fields_verify_value($verify_data)) {
@ -1014,7 +1048,10 @@ function user_recover($mode, $edom, $email, $character, $ip) {
if ($mode == 'username') { if ($mode == 'username') {
$account_id = user_account_id_from_password($verify_data['password']); $account_id = user_account_id_from_password($verify_data['password']);
} else { } else {
$account_id = user_id($verify_data['name']); if (config('ServerEngine') !== 'OTHIRE')
$account_id = user_id($verify_data['name']);
else
$account_id = user_id($verify_data['id']);
} }
// get account id from character name // get account id from character name
$player_account_id = user_character_account_id($character); $player_account_id = user_character_account_id($character);
@ -1028,8 +1065,13 @@ function user_recover($mode, $edom, $email, $character, $ip) {
// IP Match, time to stop verifying SHIT and get on // IP Match, time to stop verifying SHIT and get on
// With giving the visitor his goddamn username/password! // With giving the visitor his goddamn username/password!
if ($mode == 'username') { if ($mode == 'username') {
$name_data = user_data($account_id, 'name'); if (config('ServerEngine') !== 'OTHIRE') {
echo '<br><p>Your username is:</p> <h3>'. $name_data['name'] .'</h3>'; $name_data = user_data($account_id, 'name');
echo '<br><p>Your username is:</p> <h3>'. $name_data['name'] .'</h3>';
} else {
$name_data = user_data($account_id, 'id');
echo '<br><p>Your account number is:</p> <h3>'. $name_data['id'] .'</h3>';
}
} else { } else {
$newpass = substr(sha1(rand(1000000, 99999999)), 8); $newpass = substr(sha1(rand(1000000, 99999999)), 8);
echo '<br><p>Your new password is:</p> <h3>'. $newpass .'</h3><p>Remember to login and change it!</p>'; echo '<br><p>Your new password is:</p> <h3>'. $newpass .'</h3><p>Remember to login and change it!</p>';
@ -1051,18 +1093,34 @@ function user_account_id_from_password($password) {
// Get account name from id. // Get account name from id.
function user_account_id_from_name($id) { function user_account_id_from_name($id) {
$id = (int)$id;; $id = (int)$id;;
$result = mysql_select_single("SELECT `name` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;"); if (config('ServerEngine') !== 'OTHIRE') {
return $result['name']; $result = mysql_select_single("SELECT `name` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
return $result['name'];
} else {
$result = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
return $result['id'];
}
} }
// Add additional premium days to account id // Add additional premium days to account id
function user_account_add_premdays($accid, $days) { function user_account_add_premdays($accid, $days) {
$accid = (int)$accid; $accid = (int)$accid;
$days = (int)$days; $days = (int)$days;
$data = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='$accid';");
$tmp = $data['premdays']; if (config('ServerEngine') !== 'OTHIRE') {
$tmp += $days; $data = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='$accid';");
mysql_update("UPDATE `accounts` SET `premdays`='$tmp' WHERE `id`='$accid'"); $tmp = $data['premdays'];
$tmp += $days;
mysql_update("UPDATE `accounts` SET `premdays`='$tmp' WHERE `id`='$accid'");
} else {
$data = mysql_select_single("SELECT `premend` FROM `accounts` WHERE `id`='$accid';");
$tmp = $data['premend'];
if($tmp == 0)
$tmp = time() + ($days * 24 * 60 * 60);
else
$tmp = $tmp + ($days * 24 * 60 * 60);
mysql_update("UPDATE `accounts` SET `premend`='$tmp' WHERE `id`='$accid'");
}
} }
// Name = char name. Changes from male to female & vice versa. // Name = char name. Changes from male to female & vice versa.
@ -1154,7 +1212,7 @@ function user_character_set_hide($char_id, $value) {
function user_create_account($register_data, $maildata) { function user_create_account($register_data, $maildata) {
array_walk($register_data, 'array_sanitize'); array_walk($register_data, 'array_sanitize');
if (config('TFSVersion') == 'TFS_03' && config('salt') === true) { if (config('ServerEngine') == 'TFS_03' && config('salt') === true) {
$register_data['salt'] = generate_recovery_key(18); $register_data['salt'] = generate_recovery_key(18);
$register_data['password'] = sha1($register_data['salt'].$register_data['password']); $register_data['password'] = sha1($register_data['salt'].$register_data['password']);
} else $register_data['password'] = sha1($register_data['password']); } else $register_data['password'] = sha1($register_data['password']);
@ -1167,7 +1225,7 @@ function user_create_account($register_data, $maildata) {
unset($register_data['created']); unset($register_data['created']);
unset($register_data['flag']); unset($register_data['flag']);
if (config('TFSVersion') == 'TFS_10') $register_data['creation'] = $created; if (config('ServerEngine') == 'TFS_10') $register_data['creation'] = $created;
$fields = '`'. implode('`, `', array_keys($register_data)) .'`'; $fields = '`'. implode('`, `', array_keys($register_data)) .'`';
$data = '\''. implode('\', \'', $register_data) .'\''; $data = '\''. implode('\', \'', $register_data) .'\'';
@ -1219,53 +1277,98 @@ function user_create_character($character_data) {
$cap = $base['cap'] + ( $gains['cap'] * $leveldiff ); $cap = $base['cap'] + ( $gains['cap'] * $leveldiff );
// This is TFS 0.2 compatible import data with Znote AAC mysql schema // This is TFS 0.2 compatible import data with Znote AAC mysql schema
$import_data = array( if (config('ServerEngine') !== 'OTHIRE') {
'name' => $character_data['name'], $import_data = array(
'group_id' => 1, 'name' => $character_data['name'],
'account_id' => $character_data['account_id'], 'group_id' => 1,
'level' => $create['level'], 'account_id' => $character_data['account_id'],
'vocation' => $vocation, 'level' => $create['level'],
'health' => $health, 'vocation' => $vocation,
'healthmax' => $health, 'health' => $health,
'experience' => level_to_experience($create['level']), 'healthmax' => $health,
'lookbody' => $outfit['body'], /* STARTER OUTFITS */ 'experience' => level_to_experience($create['level']),
'lookfeet' => $outfit['feet'], 'lookbody' => $outfit['body'], /* STARTER OUTFITS */
'lookhead' => $outfit['head'], 'lookfeet' => $outfit['feet'],
'looklegs' => $outfit['legs'], 'lookhead' => $outfit['head'],
'looktype' => $outfit['id'], 'looklegs' => $outfit['legs'],
'lookaddons' => 0, 'looktype' => $outfit['id'],
'maglevel' => $skills['magic'], 'lookaddons' => 0,
'mana' => $mana, 'maglevel' => $skills['magic'],
'manamax' => $mana, 'mana' => $mana,
'manaspent' => 0, 'manamax' => $mana,
'soul' => $base['soul'], 'manaspent' => 0,
'town_id' => $character_data['town_id'], 'soul' => $base['soul'],
'posx' => $cnf['default_pos']['x'], 'town_id' => $character_data['town_id'],
'posy' => $cnf['default_pos']['y'], 'posx' => $cnf['default_pos']['x'],
'posz' => $cnf['default_pos']['z'], 'posy' => $cnf['default_pos']['y'],
'conditions' => '', 'posz' => $cnf['default_pos']['z'],
'cap' => $cap, 'conditions' => '',
'sex' => $character_data['sex'], 'cap' => $cap,
'lastlogin' => 0, 'sex' => $character_data['sex'],
'lastip' => $character_data['lastip'], 'lastlogin' => 0,
'save' => 1, 'lastip' => $character_data['lastip'],
'skull' => 0, 'save' => 1,
'skulltime' => 0, 'skull' => 0,
'rank_id' => 0, 'skulltime' => 0,
'guildnick' => '', 'rank_id' => 0,
'lastlogout' => 0, 'guildnick' => '',
'blessings' => 0, 'lastlogout' => 0,
'direction' => 0, 'blessings' => 0,
'loss_experience' => 10, 'direction' => 0,
'loss_mana' => 10, 'loss_experience' => 10,
'loss_skills' => 10, 'loss_mana' => 10,
'premend' => 0, 'loss_skills' => 10,
'online' => 0, 'premend' => 0,
'balance' => 0 'online' => 0,
); 'balance' => 0
);
} else {
$import_data = array(
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $create['level'],
'vocation' => $vocation,
'health' => $health,
'healthmax' => $health,
'experience' => level_to_experience($create['level']),
'lookbody' => $outfit['body'], /* STARTER OUTFITS */
'lookfeet' => $outfit['feet'],
'lookhead' => $outfit['head'],
'looklegs' => $outfit['legs'],
'looktype' => $outfit['id'],
'maglevel' => $skills['magic'],
'mana' => $mana,
'manamax' => $mana,
'manaspent' => 0,
'soul' => $base['soul'],
'town_id' => $character_data['town_id'],
'posx' => $cnf['default_pos']['x'],
'posy' => $cnf['default_pos']['y'],
'posz' => $cnf['default_pos']['z'],
'conditions' => '',
'cap' => $cap,
'sex' => $character_data['sex'],
'lastlogin' => 0,
'lastip' => $character_data['lastip'],
'save' => 1,
'skull_type' => 0,
'skull_time' => 0,
'rank_id' => 0,
'guildnick' => '',
'lastlogout' => 0,
'direction' => 0,
'loss_experience' => 100,
'loss_mana' => 100,
'loss_skills' => 100,
'loss_items' => 10,
'online' => 0,
'balance' => 0
);
}
// TFS 1.0 variations // TFS 1.0 variations
if ($cnf['TFSVersion'] === 'TFS_10') { if ($cnf['ServerEngine'] === 'TFS_10') {
unset($import_data['rank_id']); unset($import_data['rank_id']);
unset($import_data['guildnick']); unset($import_data['guildnick']);
unset($import_data['direction']); unset($import_data['direction']);
@ -1309,7 +1412,7 @@ function user_create_character($character_data) {
mysql_insert("INSERT INTO `znote_players`(`player_id`, `created`, `hide_char`, `comment`) VALUES ('$charid', '$created', '0', '');"); mysql_insert("INSERT INTO `znote_players`(`player_id`, `created`, `hide_char`, `comment`) VALUES ('$charid', '$created', '0', '');");
// Player skills TFS 0.2, 0.3/4. (TFS 1.0 is done above character creation) // Player skills TFS 0.2, 0.3/4. (TFS 1.0 is done above character creation)
if ($cnf['TFSVersion'] != 'TFS_10') { if ($cnf['ServerEngine'] != 'TFS_10') {
mysql_delete("DELETE FROM `player_skills` WHERE `player_id`='{$charid}';"); mysql_delete("DELETE FROM `player_skills` WHERE `player_id`='{$charid}';");
mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES ('{$charid}', '0', '".$skills['fist']."'), ('{$charid}', '1', '".$skills['club']."'), ('{$charid}', '2', '".$skills['sword']."'), ('{$charid}', '3', '".$skills['axe']."'), ('{$charid}', '4', '".$skills['dist']."'), ('{$charid}', '5', '".$skills['shield']."'), ('{$charid}', '6', '".$skills['fishing']."');"); mysql_insert("INSERT INTO `player_skills` (`player_id`, `skillid`, `value`) VALUES ('{$charid}', '0', '".$skills['fist']."'), ('{$charid}', '1', '".$skills['club']."'), ('{$charid}', '2', '".$skills['sword']."'), ('{$charid}', '3', '".$skills['axe']."'), ('{$charid}', '4', '".$skills['dist']."'), ('{$charid}', '5', '".$skills['shield']."'), ('{$charid}', '6', '".$skills['fishing']."');");
} }
@ -1317,7 +1420,7 @@ function user_create_character($character_data) {
// Returns counted value of all players online // Returns counted value of all players online
function user_count_online() { function user_count_online() {
if (config('TFSVersion') == 'TFS_10') { if (config('ServerEngine') == 'TFS_10') {
$online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;"); $online = mysql_select_single("SELECT COUNT(`player_id`) AS `value` FROM `players_online`;");
return ($online !== false) ? $online['value'] : 0; return ($online !== false) ? $online['value'] : 0;
} else { } else {
@ -1464,7 +1567,10 @@ function user_activated($username) {
// Checks that username exist in database // Checks that username exist in database
function user_exist($username) { function user_exist($username) {
$username = sanitize($username); $username = sanitize($username);
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username';"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username';");
else
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username';");
return ($data !== false) ? true : false; return ($data !== false) ? true : false;
} }
@ -1514,7 +1620,10 @@ function user_password_match($password, $account_id) {
// Get user ID from name // Get user ID from name
function user_id($username) { function user_id($username) {
$username = sanitize($username); $username = sanitize($username);
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' LIMIT 1;"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' LIMIT 1;");
else
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username' LIMIT 1;");
if ($data !== false) return $data['id']; if ($data !== false) return $data['id'];
else return false; else return false;
} }
@ -1523,7 +1632,10 @@ function user_id($username) {
function user_login_id($username, $password) { function user_login_id($username, $password) {
$username = sanitize($username); $username = sanitize($username);
$password = sha1($password); $password = sha1($password);
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `name`='$username' AND `password`='$password' LIMIT 1;");
else
$data = mysql_select_single("SELECT `id` FROM `accounts` WHERE `id`='$username' AND `password`='$password' LIMIT 1;");
if ($data !== false) return $data['id']; if ($data !== false) return $data['id'];
else return false; else return false;
} }
@ -1573,7 +1685,10 @@ function user_character_hide($username) {
function user_login($username, $password) { function user_login($username, $password) {
$username = sanitize($username); $username = sanitize($username);
$password = sha1($password); $password = sha1($password);
$data = mysql_select_single("SELECT `id` FROM accounts WHERE name='$username' AND password='$password';"); if (config('ServerEngine') !== 'OTHIRE')
$data = mysql_select_single("SELECT `id` FROM accounts WHERE name='$username' AND password='$password';");
else
$data = mysql_select_single("SELECT `id` FROM accounts WHERE id='$username' AND password='$password';");
return ($data !== false) ? $data['id'] : false; return ($data !== false) ? $data['id'] : false;
} }

View File

@ -32,6 +32,11 @@ if ($config['use_captcha'] && !extension_loaded('openssl')) {
die("php openSSL is not enabled. It is required to for captcha services.<br>1. Find your php.ini file.<br>2. Uncomment extension=php_openssl<br>Restart web server.<br><br><b>If you don't want this then disable use_captcha in config.php.</b>"); die("php openSSL is not enabled. It is required to for captcha services.<br>1. Find your php.ini file.<br>2. Uncomment extension=php_openssl<br>Restart web server.<br><br><b>If you don't want this then disable use_captcha in config.php.</b>");
} }
// References ( & ) works as an alias for a variable,
// they point to the same memmory, instead of duplicating it.
if (!isset($config['TFSVersion'])) $config['TFSVersion'] = &$config['ServerEngine'];
if (!isset($config['ServerEngine'])) $config['ServerEngine'] = &$config['TFSVersion'];
require_once 'database/connect.php'; require_once 'database/connect.php';
require_once 'function/general.php'; require_once 'function/general.php';
require_once 'function/users.php'; require_once 'function/users.php';
@ -47,7 +52,10 @@ Token::generate();
if (user_logged_in() === true) { if (user_logged_in() === true) {
$session_user_id = getSession('user_id'); $session_user_id = getSession('user_id');
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays'); if ($config['ServerEngine'] !== 'OTHIRE')
$user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
else
$user_data = user_data($session_user_id, 'id', 'password', 'email', 'premend');
$user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag'); $user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown', 'flag');
} }
$errors = array(); $errors = array();
@ -152,4 +160,4 @@ if ($config['allowSubPages']) {
<?php <?php
} }
} }
?> ?>

View File

@ -57,7 +57,7 @@ if ($admin) $yourChars = mysql_select_multi("SELECT `id`, `name`, `group_id` FRO
else $yourChars = mysql_select_multi("SELECT `id`, `name`, `group_id` FROM `players` WHERE `level`>='". $config['forum']['level'] ."' AND `account_id`='". $user_data['id'] ."';"); else $yourChars = mysql_select_multi("SELECT `id`, `name`, `group_id` FROM `players` WHERE `level`>='". $config['forum']['level'] ."' AND `account_id`='". $user_data['id'] ."';");
if (!$yourChars) $yourChars = array(); if (!$yourChars) $yourChars = array();
$charCount = count($yourChars); $charCount = count($yourChars);
$yourAccess = accountAccess($user_data['id'], $config['TFSVersion']); $yourAccess = accountAccess($user_data['id'], $config['ServerEngine']);
if ($admin) { if ($admin) {
if (!empty($_POST)) { if (!empty($_POST)) {
$guilds = mysql_select_multi("SELECT `id`, `name` FROM `guilds` ORDER BY `name`;"); $guilds = mysql_select_multi("SELECT `id`, `name` FROM `guilds` ORDER BY `name`;");

View File

@ -5,8 +5,13 @@ $isOtx = ($config['CustomVersion'] == 'OTX') ? true : false;
function guild_list($TFSVersion) { function guild_list($TFSVersion) {
$cache = new Cache('engine/cache/guildlist'); $cache = new Cache('engine/cache/guildlist');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
if ($TFSVersion != 'TFS_10') $guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdata`, `motd`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;"); if ($TFSVersion != 'TFS_10')
else $guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, `motd`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;"); if ($TFSVersion === 'OTHIRE')
$guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdate`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
else
$guilds = mysql_select_multi("SELECT `t`.`id`, `t`.`name`, `t`.`creationdata`, `motd`, (SELECT count(p.rank_id) FROM players AS p LEFT JOIN guild_ranks AS gr ON gr.id = p.rank_id WHERE gr.guild_id =`t`.`id`) AS `total` FROM `guilds` as `t` ORDER BY `t`.`name`;");
else
$guilds = mysql_select_multi("SELECT `id`, `name`, `creationdata`, `motd`, (SELECT COUNT('guild_id') FROM `guild_membership` WHERE `guild_id`=`id`) AS `total` FROM `guilds` ORDER BY `name`;");
// Add level data info to guilds // Add level data info to guilds
if ($guilds !== false) if ($guilds !== false)
@ -47,7 +52,7 @@ if (empty($_GET['name'])) {
//data_dump($guild, false, "guild data"); //data_dump($guild, false, "guild data");
$guilds = guild_list($config['TFSVersion']); $guilds = guild_list($config['ServerEngine']);
if (isset($guilds) && !empty($guilds) && $guilds !== false) { if (isset($guilds) && !empty($guilds) && $guilds !== false) {
//data_dump($guilds, false, "Guilds"); //data_dump($guilds, false, "Guilds");
@ -95,7 +100,7 @@ if (user_logged_in() === true) {
//code here //code here
$name = sanitize($_POST['selected_char']); $name = sanitize($_POST['selected_char']);
$user_id = user_character_id($name); $user_id = user_character_id($name);
if ($config['TFSVersion'] !== 'TFS_10') $char_data = user_character_data($user_id, 'level', 'online'); if ($config['ServerEngine'] !== 'TFS_10') $char_data = user_character_data($user_id, 'level', 'online');
else { else {
$char_data = user_character_data($user_id, 'level'); $char_data = user_character_data($user_id, 'level');
$char_data['online'] = (user_is_online_10($user_id)) ? 1 : 0; $char_data['online'] = (user_is_online_10($user_id)) ? 1 : 0;
@ -123,7 +128,7 @@ if (user_logged_in() === true) {
if ($gid === false) { if ($gid === false) {
create_guild($user_id, $guildname); create_guild($user_id, $guildname);
// Re-cache the guild list // Re-cache the guild list
$guilds = guild_list($config['TFSVersion']); $guilds = guild_list($config['ServerEngine']);
header('Location: success.php'); header('Location: success.php');
exit(); exit();
} else echo 'A guild with that name already exist.'; } else echo 'A guild with that name already exist.';
@ -232,7 +237,7 @@ if (user_logged_in() === true) {
<th>Status:</th> <th>Status:</th>
</tr> </tr>
<?php <?php
if ($config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_10') {
$onlinelist = array(); $onlinelist = array();
$gplayers = array(); $gplayers = array();
foreach ($players as $player) { foreach ($players as $player) {
@ -247,7 +252,7 @@ if (user_logged_in() === true) {
//data_dump($players, false, "Data"); //data_dump($players, false, "Data");
$rankName = ''; $rankName = '';
foreach ($players as $player) { foreach ($players as $player) {
if ($config['TFSVersion'] !== 'TFS_10') { if ($config['ServerEngine'] !== 'TFS_10') {
$chardata['online'] = $player['online']; $chardata['online'] = $player['online'];
} else $chardata['online'] = (in_array($player['id'], $onlinelist)) ? 1 : 0; } else $chardata['online'] = (in_array($player['id'], $onlinelist)) ? 1 : 0;
echo '<tr>'; echo '<tr>';
@ -356,7 +361,7 @@ if (user_logged_in() === true) {
// //
foreach ($inv_data as $inv) { foreach ($inv_data as $inv) {
if ($inv['player_id'] == $_POST['joinguild']) { if ($inv['player_id'] == $_POST['joinguild']) {
if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($_POST['joinguild'], 'online'); if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($_POST['joinguild'], 'online');
else $chardata['online'] = (user_is_online_10($_POST['joinguild'])) ? 1 : 0; else $chardata['online'] = (user_is_online_10($_POST['joinguild'])) ? 1 : 0;
if ($chardata['online'] == 0) { if ($chardata['online'] == 0) {
if (guild_player_join($_POST['joinguild'], $gid)) { if (guild_player_join($_POST['joinguild'], $gid)) {
@ -372,10 +377,10 @@ if (user_logged_in() === true) {
$name = sanitize($_POST['leave_guild']); $name = sanitize($_POST['leave_guild']);
$cidd = user_character_id($name); $cidd = user_character_id($name);
// If character is offline // If character is offline
if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($cidd, 'online'); if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($cidd, 'online');
else $chardata['online'] = (user_is_online_10($cidd)) ? 1 : 0; else $chardata['online'] = (user_is_online_10($cidd)) ? 1 : 0;
if ($chardata['online'] == 0) { if ($chardata['online'] == 0) {
if ($config['TFSVersion'] !== 'TFS_10') guild_player_leave($cidd); if ($config['ServerEngine'] !== 'TFS_10') guild_player_leave($cidd);
else guild_player_leave_10($cidd); else guild_player_leave_10($cidd);
header('Location: guilds.php?name='. $_GET['name']); header('Location: guilds.php?name='. $_GET['name']);
exit(); exit();
@ -393,10 +398,10 @@ if ($highest_access >= 2) {
// Only allow normal symbols as guild nick // Only allow normal symbols as guild nick
$p_nick = sanitize($_POST['guildnick']); $p_nick = sanitize($_POST['guildnick']);
if ($p_guild['guild_id'] == $gid) { if ($p_guild['guild_id'] == $gid) {
if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online'); if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0; else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0;
if ($chardata['online'] == 0) { if ($chardata['online'] == 0) {
if ($config['TFSVersion'] !== 'TFS_10') update_player_guildnick($p_cid, $p_nick); if ($config['ServerEngine'] !== 'TFS_10') update_player_guildnick($p_cid, $p_nick);
else update_player_guildnick_10($p_cid, $p_nick); else update_player_guildnick_10($p_cid, $p_nick);
header('Location: guilds.php?name='. $_GET['name']); header('Location: guilds.php?name='. $_GET['name']);
exit(); exit();
@ -414,10 +419,10 @@ if ($highest_access >= 2) {
if ($p_guild['guild_id'] == $gid) { if ($p_guild['guild_id'] == $gid) {
// Do the magic. // Do the magic.
if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online'); if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data($p_cid, 'online');
else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0; else $chardata['online'] = (user_is_online_10($p_cid)) ? 1 : 0;
if ($chardata['online'] == 0) { if ($chardata['online'] == 0) {
if ($config['TFSVersion'] !== 'TFS_10') update_player_guild_position($p_cid, $p_rid); if ($config['ServerEngine'] !== 'TFS_10') update_player_guild_position($p_cid, $p_rid);
else update_player_guild_position_10($p_cid, $p_rid); else update_player_guild_position_10($p_cid, $p_rid);
header('Location: guilds.php?name='. $_GET['name']); header('Location: guilds.php?name='. $_GET['name']);
exit(); exit();
@ -429,7 +434,7 @@ if ($highest_access >= 2) {
if (user_character_exist($_POST['invite'])) { if (user_character_exist($_POST['invite'])) {
// Make sure they are not in another guild // Make sure they are not in another guild
if ($config['TFSVersion'] != 'TFS_10') { if ($config['ServerEngine'] != 'TFS_10') {
$charname = sanitize($_POST['invite']); $charname = sanitize($_POST['invite']);
$playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;"); $playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;");
$charid = $playerdata['id']; $charid = $playerdata['id'];
@ -475,7 +480,7 @@ if ($highest_access >= 2) {
// First figure out if anyone are online. // First figure out if anyone are online.
foreach ($members as $member) { foreach ($members as $member) {
if ($config['TFSVersion'] !== 'TFS_10') $chardata = user_character_data(user_character_id($member['name']), 'online'); if ($config['ServerEngine'] !== 'TFS_10') $chardata = user_character_data(user_character_id($member['name']), 'online');
else $chardata['online'] = (user_is_online_10(user_character_id($member['name']))) ? 1 : 0; else $chardata['online'] = (user_is_online_10(user_character_id($member['name']))) ? 1 : 0;
if ($chardata['online'] == 1) { if ($chardata['online'] == 1) {
$online = true; $online = true;
@ -484,7 +489,7 @@ if ($highest_access >= 2) {
if (!$online) { if (!$online) {
// Then remove guild rank from every player. // Then remove guild rank from every player.
if ($config['TFSVersion'] !== 'TFS_10') foreach ($members as $member) guild_player_leave(user_character_id($member['name'])); if ($config['ServerEngine'] !== 'TFS_10') foreach ($members as $member) guild_player_leave(user_character_id($member['name']));
else foreach ($members as $member) guild_player_leave_10(user_character_id($member['name'])); else foreach ($members as $member) guild_player_leave_10(user_character_id($member['name']));
// Remove all guild invitations to this guild // Remove all guild invitations to this guild
@ -502,7 +507,7 @@ if ($highest_access >= 2) {
$old_leader = guild_leader($gid); $old_leader = guild_leader($gid);
$online = false; $online = false;
if ($config['TFSVersion'] !== 'TFS_10') { if ($config['ServerEngine'] !== 'TFS_10') {
$newData = user_character_data($new_leader, 'online'); $newData = user_character_data($new_leader, 'online');
$oldData = user_character_data($old_leader, 'online'); $oldData = user_character_data($old_leader, 'online');
} else { } else {
@ -546,7 +551,7 @@ if ($highest_access >= 2) {
$name = sanitize($_POST['remove_member']); $name = sanitize($_POST['remove_member']);
$cid = user_character_id($name); $cid = user_character_id($name);
if ($config['TFSVersion'] !== 'TFS_10') guild_remove_member($cid); if ($config['ServerEngine'] !== 'TFS_10') guild_remove_member($cid);
else guild_remove_member_10($cid); else guild_remove_member_10($cid);
header('Location: guilds.php?name='. $_GET['name']); header('Location: guilds.php?name='. $_GET['name']);
exit(); exit();
@ -571,7 +576,7 @@ if ($highest_access >= 2) {
} }
} }
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10' && $config['guildwar_enabled'] === true) { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10' && $config['guildwar_enabled'] === true) {
if (!empty($_POST['warinvite'])) { if (!empty($_POST['warinvite'])) {
if (get_guild_id($_POST['warinvite'])) { if (get_guild_id($_POST['warinvite'])) {
$status = false; $status = false;
@ -814,7 +819,7 @@ if ($highest_access >= 2) {
</ul> </ul>
</form> </form>
<?php } ?> <?php } ?>
<?php if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10' && $config['guildwar_enabled'] === true) { ?> <?php if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10' && $config['guildwar_enabled'] === true) { ?>
<h2>Guild War Management:</h2> <h2>Guild War Management:</h2>
<form action="" method="post"> <form action="" method="post">
<ul> <ul>
@ -859,8 +864,8 @@ if ($highest_access >= 2) {
<!-- end leader--> <!-- end leader-->
<?php <?php
if ($config['guildwar_enabled'] === true) { if ($config['guildwar_enabled'] === true) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars(); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $wardata = get_guild_wars();
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03(); else if ($config['ServerEngine'] == 'TFS_03') $wardata = get_guild_wars03();
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php"); else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
$war_exist = false; $war_exist = false;
if ($wardata !== false) { if ($wardata !== false) {

View File

@ -11,14 +11,14 @@ include 'layout/overall/header.php';
if (!empty($_GET['warid'])) { if (!empty($_GET['warid'])) {
$warid = (int)$_GET['warid']; // Sanitizing GET. $warid = (int)$_GET['warid']; // Sanitizing GET.
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $war = get_guild_war($warid); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $war = get_guild_war($warid);
else if ($config['TFSVersion'] == 'TFS_03') $war = get_guild_war03($warid); else if ($config['ServerEngine'] == 'TFS_03') $war = get_guild_war03($warid);
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php"); else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
if ($war != false) { if ($war != false) {
// Kills data for this specific war entry // Kills data for this specific war entry
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $kills = get_war_kills($warid); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $kills = get_war_kills($warid);
else if ($config['TFSVersion'] == 'TFS_03') $kills = get_war_kills03($warid); else if ($config['ServerEngine'] == 'TFS_03') $kills = get_war_kills03($warid);
?> ?>
<h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1> <h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1>
@ -30,7 +30,7 @@ if (!empty($_GET['warid'])) {
$guild2 = $war['guild2']; $guild2 = $war['guild2'];
$g2c = 0; // kill count $g2c = 0; // kill count
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') {
foreach (($kills ? $kills : array()) as $kill) { foreach (($kills ? $kills : array()) as $kill) {
if ($kill['killerguild'] == $guild1) if ($kill['killerguild'] == $guild1)
$g1c++; $g1c++;
@ -50,7 +50,7 @@ if (!empty($_GET['warid'])) {
<li> <li>
War status: <?php echo $config['war_status'][$war['status']]; ?>. War status: <?php echo $config['war_status'][$war['status']]; ?>.
</li> </li>
<?php if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { ?> <?php if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') { ?>
<li> <li>
Leading guild: <?php echo $leading; ?>. Leading guild: <?php echo $leading; ?>.
</li> </li>
@ -67,7 +67,7 @@ if (!empty($_GET['warid'])) {
<?php } ?> <?php } ?>
</ul> </ul>
<?php <?php
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
?> ?>
<table id="guildwarTable" class="table table-striped table-hover"> <table id="guildwarTable" class="table table-striped table-hover">
<tr class="yellow"> <tr class="yellow">
@ -90,7 +90,7 @@ if (!empty($_GET['warid'])) {
</table> </table>
<?php <?php
} }
if ($config['TFSVersion'] == 'TFS_03') { if ($config['ServerEngine'] == 'TFS_03') {
// BORROWED FROM GESIOR (and ported to work on Znote AAC). // BORROWED FROM GESIOR (and ported to work on Znote AAC).
$main_content = ""; $main_content = "";
$deaths = gesior_sql_death($warid); $deaths = gesior_sql_death($warid);
@ -146,8 +146,8 @@ if (!empty($_GET['warid'])) {
// Display current wars. // Display current wars.
// Fetch list of wars // Fetch list of wars
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars(); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') $wardata = get_guild_wars();
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03(); else if ($config['ServerEngine'] == 'TFS_03') $wardata = get_guild_wars03();
else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php"); else die("Can't recognize TFS version. It has to be either TFS_02 or TFS_03. Correct this in config.php");
//echo $wardata[0]['name1']; //echo $wardata[0]['name1'];
//die(var_dump($wardata)); //die(var_dump($wardata));
@ -155,8 +155,8 @@ if (!empty($_GET['warid'])) {
// kills data // kills data
$killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry $killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry
foreach ($wardata as $wars) { foreach ($wardata as $wars) {
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $killsdata[$wars['id']] = get_war_kills($wars['id']); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') $killsdata[$wars['id']] = get_war_kills($wars['id']);
else if ($config['TFSVersion'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']); else if ($config['ServerEngine'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']);
} }
?> ?>

View File

@ -55,7 +55,7 @@ function pageCheck($index, $page, $rowPerPage) {
$cache = new Cache('engine/cache/highscores'); $cache = new Cache('engine/cache/highscores');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
$vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags, $loadOutfits); $vocGroups = fetchAllScores($rows, $config['ServerEngine'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags, $loadOutfits);
$cache->setContent($vocGroups); $cache->setContent($vocGroups);
$cache->save(); $cache->save();
} else { } else {

View File

@ -5,7 +5,7 @@ if ($config['log_ip']) {
$house = getValue($_GET['id']); $house = getValue($_GET['id']);
if ($house !== false && $config['TFSVersion'] === 'TFS_10') { if ($house !== false && $config['ServerEngine'] === 'TFS_10') {
$house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='$house';"); $house = mysql_select_single("SELECT `id`, `owner`, `paid`, `name`, `rent`, `town_id`, `size`, `beds`, `bid`, `bid_end`, `last_bid`, `highest_bidder` FROM `houses` WHERE `id`='$house';");
$minbid = $config['houseConfig']['minimumBidSQM'] * $house['size']; $minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']); if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);

View File

@ -5,7 +5,7 @@ include 'layout/overall/header.php';
if ($config['log_ip']) if ($config['log_ip'])
znote_visitor_insert_detailed_data(3); znote_visitor_insert_detailed_data(3);
if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') { if (empty($_POST) === false && $config['ServerEngine'] === 'TFS_03') {
/* Token used for cross site scripting security */ /* Token used for cross site scripting security */
if (isset($_POST['token']) && Token::isValid($_POST['token'])) { if (isset($_POST['token']) && Token::isValid($_POST['token'])) {
@ -75,12 +75,12 @@ if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') {
echo 'Please clear your web cache/cookies <b>OR</b> use another web browser<br>'; echo 'Please clear your web cache/cookies <b>OR</b> use another web browser<br>';
} }
} else { } else {
if (empty($_POST) === true && $config['TFSVersion'] === 'TFS_03') { if (empty($_POST) === true && $config['ServerEngine'] === 'TFS_03') {
if ($config['allowSubPages']) if ($config['allowSubPages'])
header('Location: sub.php?page=houses'); header('Location: sub.php?page=houses');
else else
echo 'Sub page system disabled.'; echo 'Sub page system disabled.';
} else if ($config['TFSVersion'] === 'TFS_02') { } else if ($config['ServerEngine'] === 'TFS_02' || $config['ServerEngine'] == 'OTHIRE') {
$house = $config['house']; $house = $config['house'];
if (!is_file($house['house_file'])) { if (!is_file($house['house_file'])) {
echo("<h3>House file not found</h3><p>FAILED TO LOCATE/READ FILE AT:<br><font color='red'>". $house['house_file'] ."</font><br><br>LINUX users: Make sure www-data have read access to file.<br>WINDOWS users: Learn to write correct file path.</p>"); echo("<h3>House file not found</h3><p>FAILED TO LOCATE/READ FILE AT:<br><font color='red'>". $house['house_file'] ."</font><br><br>LINUX users: Make sure www-data have read access to file.<br>WINDOWS users: Learn to write correct file path.</p>");
@ -142,7 +142,7 @@ if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') {
</table> </table>
<?php <?php
} else echo '<p><font color="red">Something is wrong with the cache.</font></p>'; } else echo '<p><font color="red">Something is wrong with the cache.</font></p>';
} else if ($config['TFSVersion'] === 'TFS_10') { } else if ($config['ServerEngine'] === 'TFS_10') {
// Fetch values // Fetch values
$querystring_id = &$_GET['id']; $querystring_id = &$_GET['id'];
$townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown']; $townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown'];

View File

@ -1,5 +1,5 @@
<?php require_once 'engine/init.php'; include 'layout/overall/header.php'; <?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') {
$cache = new Cache('engine/cache/killers'); $cache = new Cache('engine/cache/killers');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
$killers = fetchMurders(); $killers = fetchMurders();
@ -84,7 +84,7 @@ if ($latests) {
<?php <?php
} else echo 'No player kills exist.'; } else echo 'No player kills exist.';
} else if ($config['TFSVersion'] == 'TFS_03') { } else if ($config['ServerEngine'] == 'TFS_03') {
$cache = new Cache('engine/cache/killers'); $cache = new Cache('engine/cache/killers');
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
$deaths = fetchLatestDeaths_03(30, true); $deaths = fetchLatestDeaths_03(30, true);

View File

@ -11,7 +11,7 @@
include 'layout/widgets/topplayers.php'; include 'layout/widgets/topplayers.php';
include 'layout/widgets/highscore.php'; include 'layout/widgets/highscore.php';
include 'layout/widgets/serverinfo.php'; include 'layout/widgets/serverinfo.php';
if ($config['TFSVersion'] !== 'TFS_02') include 'layout/widgets/houses.php'; if ($config['ServerEngine'] !== 'TFS_02') include 'layout/widgets/houses.php';
// Remove // to enable twitter, edit twitter stuff in /widgets/twitter.php // Remove // to enable twitter, edit twitter stuff in /widgets/twitter.php
//include 'layout/widgets/twitter.php'; //include 'layout/widgets/twitter.php';
?> ?>

View File

@ -1,17 +1,17 @@
<div class="sidebar"> <div class="sidebar">
<h2>Search town list</h2> <h2>Search town list</h2>
<div class="inner"> <div class="inner">
<form action="houses.php" method="<?php if ($config['TFSVersion'] !== 'TFS_10') echo "post"; else echo "get" ;?>"> <form action="houses.php" method="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "post"; else echo "get" ;?>">
Select town:<br> Select town:<br>
<select name="<?php if ($config['TFSVersion'] !== 'TFS_10') echo "selected"; else echo "id" ;?>"> <select name="<?php if ($config['ServerEngine'] !== 'TFS_10') echo "selected"; else echo "id" ;?>">
<?php <?php
foreach ($config['towns'] as $id => $name) echo '<option value="'. $id .'">'. $name .'</option>'; foreach ($config['towns'] as $id => $name) echo '<option value="'. $id .'">'. $name .'</option>';
?> ?>
</select> </select>
<?php <?php
/* Form file */ /* Form file */
if ($config['TFSVersion'] !== 'TFS_10') Token::create(); if ($config['ServerEngine'] !== 'TFS_10') Token::create();
?> ?>
<input type="submit" value="Fetch houses"> <input type="submit" value="Fetch houses">
</form> </form>

View File

@ -1,5 +1,5 @@
<div class="sidebar"> <div class="sidebar">
<h2>Welcome, <?php echo $user_data['name']; ?>.</h2> <h2>Welcome, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id'];?>.</h2>
<div class="inner"> <div class="inner">
<ul> <ul>
<li> <li>

View File

@ -2,7 +2,7 @@
require_once 'engine/init.php'; require_once 'engine/init.php';
// Client 11 loginWebService // Client 11 loginWebService
if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['TFSVersion'] === 'TFS_10') { if($_SERVER['HTTP_USER_AGENT'] == "Mozilla/5.0" && $config['ServerEngine'] === 'TFS_10') {
function jsonError($message, $code = 3) { function jsonError($message, $code = 3) {
die(json_encode(array('errorCode' => $code, 'errorMessage' => $message))); die(json_encode(array('errorCode' => $code, 'errorMessage' => $message)));
@ -132,8 +132,8 @@ if (empty($_POST) === false) {
} else { } else {
// Starting loging // Starting loging
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $login = user_login($username, $password); if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $login = user_login($username, $password);
else if ($config['TFSVersion'] == 'TFS_03') $login = user_login_03($username, $password); else if ($config['ServerEngine'] == 'TFS_03') $login = user_login_03($username, $password);
else $login = false; else $login = false;
if ($login === false) { if ($login === false) {
$errors[] = 'Username and password combination is wrong.'; $errors[] = 'Username and password combination is wrong.';
@ -151,7 +151,7 @@ if (empty($_POST) === false) {
if ($status) { if ($status) {
// Regular login success, now lets check authentication token code // Regular login success, now lets check authentication token code
if ($config['TFSVersion'] == 'TFS_10' && $config['twoFactorAuthenticator']) { if ($config['ServerEngine'] == 'TFS_10' && $config['twoFactorAuthenticator']) {
require_once("engine/function/rfc6238.php"); require_once("engine/function/rfc6238.php");
// Two factor authentication code / token // Two factor authentication code / token

View File

@ -52,7 +52,7 @@ if (!empty($_POST['selected_character'])) {
if (user_character_account_id($char_name) === $session_user_id) { if (user_character_account_id($char_name) === $session_user_id) {
$charid = user_character_id($char_name); $charid = user_character_id($char_name);
if ($charid !== false) { if ($charid !== false) {
if ($config['TFSVersion'] === 'TFS_10') { if ($config['ServerEngine'] === 'TFS_10') {
if (!user_is_online_10($charid)) { if (!user_is_online_10($charid)) {
if (guild_leader_gid($charid) === false) user_delete_character_soft($charid); if (guild_leader_gid($charid) === false) user_delete_character_soft($charid);
else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.'; else echo 'Character is leader of a guild, you must disband the guild or change leadership before deleting character.';
@ -75,7 +75,7 @@ if (!empty($_POST['selected_character'])) {
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : ''; $newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
$player = false; $player = false;
if ($config['TFSVersion'] === 'TFS_10') { if ($config['ServerEngine'] === 'TFS_10') {
$player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'"); $player = mysql_select_single("SELECT `id`, `account_id` FROM `players` WHERE `name` = '$oldname'");
$player['online'] = (user_is_online_10($player['id'])) ? 1 : 0; $player['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
} else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'"); } else $player = mysql_select_single("SELECT `id`, `account_id`, `online` FROM `players` WHERE `name` = '$oldname'");
@ -144,7 +144,7 @@ if (!empty($_POST['selected_character'])) {
$char_id = (int)user_character_id($char_name); $char_id = (int)user_character_id($char_name);
$account_id = user_character_account_id($char_name); $account_id = user_character_account_id($char_name);
if ($config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_10') {
$chr_data['online'] = user_is_online_10($char_id) ? 1 : 0; $chr_data['online'] = user_is_online_10($char_id) ? 1 : 0;
} else $chr_data = user_character_data($char_id, 'online'); } else $chr_data = user_character_data($char_id, 'online');
if ($chr_data['online'] != 1) { if ($chr_data['online'] != 1) {
@ -239,10 +239,19 @@ if ($render_page) {
?> ?>
<div id="myaccount"> <div id="myaccount">
<h1>My account</h1> <h1>My account</h1>
<p>Welcome to your account page, <?php echo $user_data['name']; ?><br> <p>Welcome to your account page, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id']; ?><br>
You have <?php echo $user_data['premdays']; ?> days remaining premium account.</p> <?php if ($config['ServerEngine'] !== 'OTHIRE') {
echo 'You have ' .$user_data['premdays']. 'days remaining premium account.';
} else {
if ($user_data['premend'] != 0) {
echo 'Your premium account will last till ';
echo date("d/m/Y", $user_data['premend']);
} else {
echo 'You do not have premium account days.';
}
} ?></p>
<?php <?php
if ($config['TFSVersion'] === 'TFS_10' && $config['twoFactorAuthenticator']) { if ($config['ServerEngine'] === 'TFS_10' && $config['twoFactorAuthenticator']) {
$query = mysql_select_single("SELECT `secret` FROM `accounts` WHERE `id`='".(int)$session_user_id."' LIMIT 1;"); $query = mysql_select_single("SELECT `secret` FROM `accounts` WHERE `id`='".(int)$session_user_id."' LIMIT 1;");
$status = ($query['secret'] === NULL) ? false : true; $status = ($query['secret'] === NULL) ? false : true;

View File

@ -14,7 +14,7 @@ $cache = new Cache('engine/cache/onlinelist');
$cache->setExpiration(30); $cache->setExpiration(30);
if ($cache->hasExpired()) { if ($cache->hasExpired()) {
// Load online list data from SQL // Load online list data from SQL
if ($config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_10') {
$array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname`, `za`.`flag` AS `flag` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id` = `za`.`account_id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;") : mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;"); $array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname`, `za`.`flag` AS `flag` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id` = `za`.`account_id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;") : mysql_select_multi("SELECT `p`.`name` AS `name`, `p`.`level` AS `level`, `p`.`vocation` AS `vocation`, `g`.`name` AS `gname` $outfitQuery FROM `players_online` AS `o` INNER JOIN `players` AS `p` ON `o`.`player_id` = `p`.`id` LEFT JOIN `guild_membership` AS `gm` ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` AS `g` ON `gm`.`guild_id` = `g`.`id`;");
} else { } else {
$array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname`, `za`.`flag` as `flag` $outfitQuery FROM `players` as `p` INNER JOIN `znote_accounts` as `za` ON `za`.`account_id` = `p`.`account_id` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;") : mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname` $outfitQuery FROM `players` as `p` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;"); $array = ($loadFlags === true) ? mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname`, `za`.`flag` as `flag` $outfitQuery FROM `players` as `p` INNER JOIN `znote_accounts` as `za` ON `za`.`account_id` = `p`.`account_id` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;") : mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname` $outfitQuery FROM `players` as `p` LEFT JOIN `guild_ranks` as `gr` ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` as `g` ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;");

View File

@ -21,7 +21,7 @@ if ($config['mailserver']['accountRecovery']) {
if (!$username) { if (!$username) {
// Recover username // Recover username
$salt = ''; $salt = '';
if ($config['TFSVersion'] != 'TFS_03') { if ($config['ServerEngine'] != 'TFS_03') {
// TFS 0.2 and 1.0 // TFS 0.2 and 1.0
$password = sha1($password); $password = sha1($password);
} else { } else {
@ -61,7 +61,7 @@ if ($config['mailserver']['accountRecovery']) {
// Recover password // Recover password
$newpass = rand(100000000, 999999999); $newpass = rand(100000000, 999999999);
$salt = ''; $salt = '';
if ($config['TFSVersion'] != 'TFS_03') { if ($config['ServerEngine'] != 'TFS_03') {
// TFS 0.2 and 1.0 // TFS 0.2 and 1.0
$password = sha1($newpass); $password = sha1($newpass);
} else { } else {

View File

@ -115,14 +115,25 @@ if (isset($_GET['success']) && empty($_GET['success'])) {
} }
//Register //Register
$register_data = array( if ($config['ServerEngine'] !== 'OTHIRE') {
'name' => $_POST['username'], $register_data = array(
'password' => $_POST['password'], 'name' => $_POST['username'],
'email' => $_POST['email'], 'password' => $_POST['password'],
'created' => time(), 'email' => $_POST['email'],
'ip' => getIPLong(), 'created' => time(),
'flag' => $_POST['flag'] 'ip' => getIPLong(),
); 'flag' => $_POST['flag']
);
} else {
$register_data = array(
'id' => $_POST['username'],
'password' => $_POST['password'],
'email' => $_POST['email'],
'created' => time(),
'ip' => getIPLong(),
'flag' => $_POST['flag']
);
}
user_create_account($register_data, $config['mailserver']); user_create_account($register_data, $config['mailserver']);
if (!$config['mailserver']['debug']) header('Location: register.php?success'); if (!$config['mailserver']['debug']) header('Location: register.php?success');

View File

@ -35,12 +35,12 @@ if (user_logged_in() && is_admin($user_data)) {
if ($stagesXML !== false) { if ($stagesXML !== false) {
$stagesData = array(); $stagesData = array();
// Load config ( stages enabled or disabled) // Load config ( stages enabled or disabled)
if ($config['TFSVersion'] == 'TFS_10') if ($config['ServerEngine'] == 'TFS_10')
foreach ($stagesXML->config->attributes() as $name => $value) foreach ($stagesXML->config->attributes() as $name => $value)
$stagesData["$name"] = "$value"; $stagesData["$name"] = "$value";
// Load stage levels // Load stage levels
// Each stage XML object // Each stage XML object
if ($config['TFSVersion'] == 'TFS_10') { if ($config['ServerEngine'] == 'TFS_10') {
foreach ($stagesXML->stage as $stage) { foreach ($stagesXML->stage as $stage) {
$rowData = array(); $rowData = array();
// Each attribute name and values on current stage object // Each attribute name and values on current stage object

View File

@ -98,11 +98,11 @@ require '../engine/function/users.php';
$updated_acc += 1; $updated_acc += 1;
// Fetch unsalted password // Fetch unsalted password
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) { if ($config['ServerEngine'] == 'TFS_03' && $config['salt'] === true) {
$password = user_data($old, 'password', 'salt'); $password = user_data($old, 'password', 'salt');
$p_pass = str_replace($password['salt'],"",$password['password']); $p_pass = str_replace($password['salt'],"",$password['password']);
} }
if ($config['TFSVersion'] == 'TFS_02' || $config['salt'] === false) { if ($config['ServerEngine'] == 'TFS_02' || $config['salt'] === false) {
$password = user_data($old, 'password'); $password = user_data($old, 'password');
$p_pass = $password['password']; $p_pass = $password['password'];
} }
@ -110,8 +110,8 @@ require '../engine/function/users.php';
// Verify lenght of password is less than 28 characters (most likely a plain password) // Verify lenght of password is less than 28 characters (most likely a plain password)
if (strlen($p_pass) < 28 && $old > 1) { if (strlen($p_pass) < 28 && $old > 1) {
// encrypt it with sha1 // encrypt it with sha1
if ($config['TFSVersion'] == 'TFS_02' || $config['salt'] === false) $p_pass = sha1($p_pass); if ($config['ServerEngine'] == 'TFS_02' || $config['salt'] === false) $p_pass = sha1($p_pass);
if ($config['TFSVersion'] == 'TFS_03' && $config['salt'] === true) $p_pass = sha1($password['salt'].$p_pass); if ($config['ServerEngine'] == 'TFS_03' && $config['salt'] === true) $p_pass = sha1($password['salt'].$p_pass);
// Update their password so they are sha1 encrypted // Update their password so they are sha1 encrypted
mysql_update("UPDATE `accounts` SET `password`='$p_pass' WHERE `id`='$old';"); mysql_update("UPDATE `accounts` SET `password`='$p_pass' WHERE `id`='$old';");

View File

@ -1,6 +1,6 @@
<?php require_once 'engine/init.php'; if ($config['twoFactorAuthenticator'] === false) die("twoFactorAuthenticator is disabled in config.php"); protect_page(); include 'layout/overall/header.php'; <?php require_once 'engine/init.php'; if ($config['twoFactorAuthenticator'] === false) die("twoFactorAuthenticator is disabled in config.php"); protect_page(); include 'layout/overall/header.php';
// Two-Factor Authentication setup page // Two-Factor Authentication setup page
if ($config['TFSVersion'] !== 'TFS_10') { if ($config['ServerEngine'] !== 'TFS_10') {
?> ?>
<h1>Server compatibility error</h1> <h1>Server compatibility error</h1>
<p>Sorry, this server is not compatible with Two-Factor Authentication.<br> <p>Sorry, this server is not compatible with Two-Factor Authentication.<br>