mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-04-29 18:59:21 +02:00
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:
parent
0d51f87c76
commit
2817010781
@ -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.
|
||||
|
||||
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).
|
||||
|
||||
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.
|
||||
|
||||
#### Server distribution compatibility:
|
||||
- OTHire
|
||||
- TFS 0.2
|
||||
- TFS 0.3/4
|
||||
- TFS 1.x
|
||||
|
10
admin.php
10
admin.php
@ -50,9 +50,9 @@ if (empty($_POST) === false) {
|
||||
$acc_id = user_character_account_id($_POST['reset_pass']);
|
||||
|
||||
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']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
} else if ($config['ServerEngine'] == 'TFS_03') {
|
||||
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']) .'.';
|
||||
@ -89,9 +89,9 @@ if (empty($_POST) === false) {
|
||||
if (empty($_POST['position_name']) === false && empty($_POST['position_type']) === false) {
|
||||
if (user_character_exist($_POST['position_name'])) {
|
||||
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']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
} else if ($config['ServerEngine'] == 'TFS_03') {
|
||||
set_ingame_position03($_POST['position_name'], $_POST['position_type']);
|
||||
}
|
||||
$pos = 'Undefined';
|
||||
@ -239,7 +239,7 @@ echo "Last cached on: ". getClock($basic['cached'], true) .".<br>";
|
||||
<li>
|
||||
<b>Set character name to position:</b>
|
||||
<?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>
|
||||
<?php
|
||||
|
@ -13,7 +13,7 @@ function playerSkill($skills, $id) {
|
||||
// UPDATE SKILLS POST
|
||||
if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
|
||||
$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);
|
||||
|
||||
if (!$status) {
|
||||
@ -46,7 +46,7 @@ if (isset($_POST['pid']) && (int)$_POST['pid'] > 0) {
|
||||
$newcap = $playercnf['base']['cap'] + ($statgain['cap'] * $LevelsFromBase);
|
||||
|
||||
// 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['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;");
|
||||
@ -86,7 +86,7 @@ if ($name !== false) {
|
||||
if (user_character_exist($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;");
|
||||
$player = mysql_select_single("SELECT `maglevel`, `level`, `vocation` FROM `players` WHERE `id`='$pid' LIMIT 1;");
|
||||
$skills[] = array('value' => $player['maglevel']);
|
||||
|
@ -17,7 +17,7 @@ if (!isset($config['api']['debug'])) $config['api']['debug'] = false;
|
||||
$response = array(
|
||||
'version' => array(
|
||||
'znote' => $version,
|
||||
'ot' => $config['TFSVersion']
|
||||
'ot' => $config['ServerEngine']
|
||||
),
|
||||
);
|
||||
|
||||
|
@ -39,7 +39,7 @@ $response['data']['accounts'] = ($accounts !== false) ? (int)$accounts['count']
|
||||
$players = mysql_select_single("SELECT COUNT('id') AS `count` FROM `players`;");
|
||||
$response['data']['players'] = ($players !== false) ? (int)$players['count'] : 0;
|
||||
// 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';");
|
||||
} 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`;");
|
||||
|
@ -21,10 +21,10 @@ if (empty($_POST) === false) {
|
||||
// $_POST['']
|
||||
|
||||
// .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');
|
||||
}
|
||||
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'])) {
|
||||
$errors[] = 'Your new passwords do not match.';
|
||||
} else if (strlen($_POST['new_password']) < 6) {
|
||||
@ -50,9 +50,9 @@ if (isset($_GET['success']) && empty($_GET['success'])) {
|
||||
} else {
|
||||
if (empty($_POST) === false && empty($errors) === true) {
|
||||
//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']);
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
} else if ($config['ServerEngine'] == 'TFS_03') {
|
||||
user_change_password03($session_user_id, $_POST['new_password']);
|
||||
}
|
||||
header('Location: changepassword.php?success');
|
||||
|
@ -11,7 +11,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
||||
if ($user_id !== false) {
|
||||
$loadOutfits = $config['show_outfits']['characterprofile'];
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
if ($config['ServerEngine'] == 'TFS_10') {
|
||||
if (!$loadOutfits) {
|
||||
$profile_data = user_character_data($user_id, 'account_id', 'name', 'level', 'group_id', 'vocation', 'health', 'healthmax', 'experience', 'mana', 'manamax', 'sex', 'lastlogin');
|
||||
} else { // Load outfits
|
||||
@ -27,7 +27,10 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
||||
if (!$loadOutfits) {
|
||||
$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
|
||||
$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 -->
|
||||
<?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;");
|
||||
|
||||
if ($houses)
|
||||
@ -180,7 +188,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
||||
|
||||
<!-- Display player status -->
|
||||
<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'])
|
||||
{
|
||||
@ -276,7 +284,7 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
|
||||
<li>
|
||||
<b>Death List:</b><br>
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_02')
|
||||
if ($config['ServerEngine'] == 'TFS_02')
|
||||
{
|
||||
$array = user_fetch_deathlist($user_id);
|
||||
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>';
|
||||
}
|
||||
}
|
||||
else if ($config['TFSVersion'] == 'TFS_10')
|
||||
else if ($config['ServerEngine'] == 'TFS_10')
|
||||
{
|
||||
$deaths = mysql_select_multi("SELECT
|
||||
`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>';
|
||||
}
|
||||
}
|
||||
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';");
|
||||
$array = user_fetch_deathlist03($user_id);
|
||||
|
23
config.php
23
config.php
@ -8,12 +8,13 @@
|
||||
// Tested with TFS items.xml master (1.3)
|
||||
$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.3 = TFS_03 (If ur using 0.3.6, set $config['salt'] to false)!
|
||||
// TFS 0.4 = TFS_03
|
||||
// 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
|
||||
$config['CustomVersion'] = false;
|
||||
|
||||
@ -28,6 +29,9 @@
|
||||
// MYSQL CONNECTION DETAILS \\
|
||||
// ------------------------ \\
|
||||
|
||||
if ($config['ServerEngine'] !== 'OTHIRE') {
|
||||
|
||||
// TFS DATABASE CONFIGS
|
||||
// phpmyadmin username for OT server: (DONT USE "root" if ur hosting to public.).
|
||||
$config['sqlUser'] = 'tfs13';
|
||||
|
||||
@ -39,6 +43,21 @@
|
||||
|
||||
// Hostname is usually localhost or 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+
|
||||
$config['twoFactorAuthenticator'] = false;
|
||||
|
@ -2,9 +2,9 @@
|
||||
$cache = new Cache('engine/cache/deaths');
|
||||
if ($cache->hasExpired()) {
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') {
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10') {
|
||||
$deaths = fetchLatestDeaths();
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
} else if ($config['ServerEngine'] == 'TFS_03' || $config['ServerEngine'] == 'OTHIRE') {
|
||||
$deaths = fetchLatestDeaths_03(30);
|
||||
}
|
||||
$cache->setContent($deaths);
|
||||
@ -27,7 +27,7 @@ if ($deaths) {
|
||||
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>";
|
||||
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>". $death['killed_by'] ."</td>";
|
||||
|
@ -274,8 +274,11 @@ CREATE TABLE IF NOT EXISTS `znote_global_storage` (
|
||||
</li>
|
||||
</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) {
|
||||
die("Failed to connect to MySQL: (" . $connect->connect_errno . ") " . $connect->connect_error . $install);
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ function bomberman_highscores() {
|
||||
|
||||
// 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;");
|
||||
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) {
|
||||
|
||||
// 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`='$vice_rid' WHERE `id`=$oCid LIMIT 1;");
|
||||
} else {
|
||||
@ -305,20 +305,29 @@ function guild_change_leader($nCid, $oCid) {
|
||||
function guild_new_leader($new_leader, $gid) {
|
||||
$new_leader = (int)$new_leader;
|
||||
$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).
|
||||
function guild_leader_gid($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'];
|
||||
}
|
||||
|
||||
// Returns guild leader(charID) of a guild. (parameter: guild_ID)
|
||||
function guild_leader($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;
|
||||
}
|
||||
|
||||
@ -351,7 +360,7 @@ function guild_player_join($cid, $gid) {
|
||||
// Create a status we can return depending on results.
|
||||
$status = false;
|
||||
|
||||
if (config('TFSVersion') !== 'TFS_10') {
|
||||
if (config('ServerEngine') !== 'TFS_10') {
|
||||
// Get rank data
|
||||
$ranks = get_guild_rank_data($gid);
|
||||
// Locate rank id for regular member position in this guild
|
||||
@ -450,7 +459,10 @@ function create_guild($cid, $name) {
|
||||
$time = time();
|
||||
|
||||
// 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
|
||||
$gid = get_guild_id($name);
|
||||
@ -460,14 +472,14 @@ function create_guild($cid, $name) {
|
||||
$rid = ($data !== false) ? $data['id'] : false;
|
||||
|
||||
// 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', '');");
|
||||
}
|
||||
|
||||
// Search player table on cid for his rank_id, returns rank_id
|
||||
function get_character_guild_rank($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';");
|
||||
return ($data !== false && $data['rank_id'] > 0) ? $data['rank_id'] : false;
|
||||
} 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)
|
||||
function get_player_guild_data($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;");
|
||||
|
||||
if ($playerdata !== false) {
|
||||
@ -523,25 +535,31 @@ function get_guild_id($name) {
|
||||
// Returns guild data from name
|
||||
function get_guild_data($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
|
||||
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.
|
||||
function get_guild_players($gid) {
|
||||
$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`");
|
||||
}
|
||||
|
||||
// Get guild level data (avg level, total level, count of players)
|
||||
function get_guild_level_data($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;
|
||||
$totallevels = 0;
|
||||
if ($data !== false) {
|
||||
@ -556,7 +574,7 @@ function get_guild_level_data($gid) {
|
||||
// Returns total members in a guild (integer)
|
||||
function count_guild_members($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");
|
||||
return ($data !== false) ? $data['total'] : false;
|
||||
} else {
|
||||
@ -636,6 +654,7 @@ function gesior_sql_killer($did) {
|
||||
}
|
||||
// end gesior
|
||||
// END GUILD WAR
|
||||
|
||||
// ADMIN FUNCTIONS
|
||||
function set_ingame_position($name, $acctype) {
|
||||
$acctype = (int)$acctype;
|
||||
@ -690,9 +709,9 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
|
||||
if (user_character_exist($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');");
|
||||
elseif (Config('TFSVersion') === 'TFS_03') {
|
||||
elseif (Config('ServerEngine') === 'TFS_03') {
|
||||
$now = time();
|
||||
switch ($typeid) {
|
||||
case 1: // IP ban
|
||||
@ -716,7 +735,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
|
||||
break;
|
||||
}
|
||||
}
|
||||
elseif (Config('TFSVersion') === 'TFS_10') {
|
||||
elseif (Config('ServerEngine') === 'TFS_10') {
|
||||
$now = time();
|
||||
|
||||
switch ($typeid) {
|
||||
@ -751,6 +770,7 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
|
||||
}
|
||||
|
||||
// -- END admin
|
||||
|
||||
// Fetch deathlist
|
||||
function user_fetch_deathlist($char_id) {
|
||||
$char_id = (int)$char_id;
|
||||
@ -839,7 +859,7 @@ function user_character_list($account_id) {
|
||||
//$count = user_character_list_count($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");
|
||||
if ($characters !== false) {
|
||||
for ($i = 0; $i < count($characters); $i++) {
|
||||
@ -996,16 +1016,30 @@ function user_recover($mode, $edom, $email, $character, $ip) {
|
||||
$ip = character IP
|
||||
*/
|
||||
// Structure verify array data correctly
|
||||
if ($mode === 'username') {
|
||||
$verify_data = array(
|
||||
'password' => sha1($edom),
|
||||
'email' => $email
|
||||
);
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
if ($mode === 'username') {
|
||||
$verify_data = array(
|
||||
'password' => sha1($edom),
|
||||
'email' => $email
|
||||
);
|
||||
} else {
|
||||
$verify_data = array(
|
||||
'name' => $edom,
|
||||
'email' => $email
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$verify_data = array(
|
||||
'name' => $edom,
|
||||
'email' => $email
|
||||
);
|
||||
if ($mode === 'username') {
|
||||
$verify_data = array(
|
||||
'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
|
||||
if (user_account_fields_verify_value($verify_data)) {
|
||||
@ -1014,7 +1048,10 @@ function user_recover($mode, $edom, $email, $character, $ip) {
|
||||
if ($mode == 'username') {
|
||||
$account_id = user_account_id_from_password($verify_data['password']);
|
||||
} 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
|
||||
$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
|
||||
// With giving the visitor his goddamn username/password!
|
||||
if ($mode == 'username') {
|
||||
$name_data = user_data($account_id, 'name');
|
||||
echo '<br><p>Your username is:</p> <h3>'. $name_data['name'] .'</h3>';
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
$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 {
|
||||
$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>';
|
||||
@ -1051,18 +1093,34 @@ function user_account_id_from_password($password) {
|
||||
// Get account name from id.
|
||||
function user_account_id_from_name($id) {
|
||||
$id = (int)$id;;
|
||||
$result = mysql_select_single("SELECT `name` FROM `accounts` WHERE `id` = '" . $id . "' LIMIT 1;");
|
||||
return $result['name'];
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
$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
|
||||
function user_account_add_premdays($accid, $days) {
|
||||
$accid = (int)$accid;
|
||||
$days = (int)$days;
|
||||
$data = mysql_select_single("SELECT `premdays` FROM `accounts` WHERE `id`='$accid';");
|
||||
$tmp = $data['premdays'];
|
||||
$tmp += $days;
|
||||
mysql_update("UPDATE `accounts` SET `premdays`='$tmp' WHERE `id`='$accid'");
|
||||
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
$data = mysql_select_single("SELECT `premdays` FROM `accounts` 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.
|
||||
@ -1154,7 +1212,7 @@ function user_character_set_hide($char_id, $value) {
|
||||
function user_create_account($register_data, $maildata) {
|
||||
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['password'] = sha1($register_data['salt'].$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['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)) .'`';
|
||||
$data = '\''. implode('\', \'', $register_data) .'\'';
|
||||
@ -1219,53 +1277,98 @@ function user_create_character($character_data) {
|
||||
$cap = $base['cap'] + ( $gains['cap'] * $leveldiff );
|
||||
|
||||
// This is TFS 0.2 compatible import data with Znote AAC mysql schema
|
||||
$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'],
|
||||
'lookaddons' => 0,
|
||||
'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' => 0,
|
||||
'skulltime' => 0,
|
||||
'rank_id' => 0,
|
||||
'guildnick' => '',
|
||||
'lastlogout' => 0,
|
||||
'blessings' => 0,
|
||||
'direction' => 0,
|
||||
'loss_experience' => 10,
|
||||
'loss_mana' => 10,
|
||||
'loss_skills' => 10,
|
||||
'premend' => 0,
|
||||
'online' => 0,
|
||||
'balance' => 0
|
||||
);
|
||||
if (config('ServerEngine') !== 'OTHIRE') {
|
||||
$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'],
|
||||
'lookaddons' => 0,
|
||||
'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' => 0,
|
||||
'skulltime' => 0,
|
||||
'rank_id' => 0,
|
||||
'guildnick' => '',
|
||||
'lastlogout' => 0,
|
||||
'blessings' => 0,
|
||||
'direction' => 0,
|
||||
'loss_experience' => 10,
|
||||
'loss_mana' => 10,
|
||||
'loss_skills' => 10,
|
||||
'premend' => 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
|
||||
if ($cnf['TFSVersion'] === 'TFS_10') {
|
||||
if ($cnf['ServerEngine'] === 'TFS_10') {
|
||||
unset($import_data['rank_id']);
|
||||
unset($import_data['guildnick']);
|
||||
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', '');");
|
||||
|
||||
// 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_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
|
||||
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`;");
|
||||
return ($online !== false) ? $online['value'] : 0;
|
||||
} else {
|
||||
@ -1464,7 +1567,10 @@ function user_activated($username) {
|
||||
// Checks that username exist in database
|
||||
function user_exist($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;
|
||||
}
|
||||
|
||||
@ -1514,7 +1620,10 @@ function user_password_match($password, $account_id) {
|
||||
// Get user ID from name
|
||||
function user_id($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'];
|
||||
else return false;
|
||||
}
|
||||
@ -1523,7 +1632,10 @@ function user_id($username) {
|
||||
function user_login_id($username, $password) {
|
||||
$username = sanitize($username);
|
||||
$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'];
|
||||
else return false;
|
||||
}
|
||||
@ -1573,7 +1685,10 @@ function user_character_hide($username) {
|
||||
function user_login($username, $password) {
|
||||
$username = sanitize($username);
|
||||
$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;
|
||||
}
|
||||
|
||||
|
@ -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>");
|
||||
}
|
||||
|
||||
// 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 'function/general.php';
|
||||
require_once 'function/users.php';
|
||||
@ -47,7 +52,10 @@ Token::generate();
|
||||
|
||||
if (user_logged_in() === true) {
|
||||
$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');
|
||||
}
|
||||
$errors = array();
|
||||
@ -152,4 +160,4 @@ if ($config['allowSubPages']) {
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
@ -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'] ."';");
|
||||
if (!$yourChars) $yourChars = array();
|
||||
$charCount = count($yourChars);
|
||||
$yourAccess = accountAccess($user_data['id'], $config['TFSVersion']);
|
||||
$yourAccess = accountAccess($user_data['id'], $config['ServerEngine']);
|
||||
if ($admin) {
|
||||
if (!empty($_POST)) {
|
||||
$guilds = mysql_select_multi("SELECT `id`, `name` FROM `guilds` ORDER BY `name`;");
|
||||
|
51
guilds.php
51
guilds.php
@ -5,8 +5,13 @@ $isOtx = ($config['CustomVersion'] == 'OTX') ? true : false;
|
||||
function guild_list($TFSVersion) {
|
||||
$cache = new Cache('engine/cache/guildlist');
|
||||
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`;");
|
||||
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 != 'TFS_10')
|
||||
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
|
||||
if ($guilds !== false)
|
||||
@ -47,7 +52,7 @@ if (empty($_GET['name'])) {
|
||||
|
||||
//data_dump($guild, false, "guild data");
|
||||
|
||||
$guilds = guild_list($config['TFSVersion']);
|
||||
$guilds = guild_list($config['ServerEngine']);
|
||||
|
||||
if (isset($guilds) && !empty($guilds) && $guilds !== false) {
|
||||
//data_dump($guilds, false, "Guilds");
|
||||
@ -95,7 +100,7 @@ if (user_logged_in() === true) {
|
||||
//code here
|
||||
$name = sanitize($_POST['selected_char']);
|
||||
$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 {
|
||||
$char_data = user_character_data($user_id, 'level');
|
||||
$char_data['online'] = (user_is_online_10($user_id)) ? 1 : 0;
|
||||
@ -123,7 +128,7 @@ if (user_logged_in() === true) {
|
||||
if ($gid === false) {
|
||||
create_guild($user_id, $guildname);
|
||||
// Re-cache the guild list
|
||||
$guilds = guild_list($config['TFSVersion']);
|
||||
$guilds = guild_list($config['ServerEngine']);
|
||||
header('Location: success.php');
|
||||
exit();
|
||||
} else echo 'A guild with that name already exist.';
|
||||
@ -232,7 +237,7 @@ if (user_logged_in() === true) {
|
||||
<th>Status:</th>
|
||||
</tr>
|
||||
<?php
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
if ($config['ServerEngine'] == 'TFS_10') {
|
||||
$onlinelist = array();
|
||||
$gplayers = array();
|
||||
foreach ($players as $player) {
|
||||
@ -247,7 +252,7 @@ if (user_logged_in() === true) {
|
||||
//data_dump($players, false, "Data");
|
||||
$rankName = '';
|
||||
foreach ($players as $player) {
|
||||
if ($config['TFSVersion'] !== 'TFS_10') {
|
||||
if ($config['ServerEngine'] !== 'TFS_10') {
|
||||
$chardata['online'] = $player['online'];
|
||||
} else $chardata['online'] = (in_array($player['id'], $onlinelist)) ? 1 : 0;
|
||||
echo '<tr>';
|
||||
@ -356,7 +361,7 @@ if (user_logged_in() === true) {
|
||||
//
|
||||
foreach ($inv_data as $inv) {
|
||||
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;
|
||||
if ($chardata['online'] == 0) {
|
||||
if (guild_player_join($_POST['joinguild'], $gid)) {
|
||||
@ -372,10 +377,10 @@ if (user_logged_in() === true) {
|
||||
$name = sanitize($_POST['leave_guild']);
|
||||
$cidd = user_character_id($name);
|
||||
// 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;
|
||||
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);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
@ -393,10 +398,10 @@ if ($highest_access >= 2) {
|
||||
// Only allow normal symbols as guild nick
|
||||
$p_nick = sanitize($_POST['guildnick']);
|
||||
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;
|
||||
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);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
@ -414,10 +419,10 @@ if ($highest_access >= 2) {
|
||||
|
||||
if ($p_guild['guild_id'] == $gid) {
|
||||
// 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;
|
||||
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);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
exit();
|
||||
@ -429,7 +434,7 @@ if ($highest_access >= 2) {
|
||||
if (user_character_exist($_POST['invite'])) {
|
||||
// Make sure they are not in another guild
|
||||
|
||||
if ($config['TFSVersion'] != 'TFS_10') {
|
||||
if ($config['ServerEngine'] != 'TFS_10') {
|
||||
$charname = sanitize($_POST['invite']);
|
||||
$playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;");
|
||||
$charid = $playerdata['id'];
|
||||
@ -475,7 +480,7 @@ if ($highest_access >= 2) {
|
||||
|
||||
// First figure out if anyone are online.
|
||||
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;
|
||||
if ($chardata['online'] == 1) {
|
||||
$online = true;
|
||||
@ -484,7 +489,7 @@ if ($highest_access >= 2) {
|
||||
|
||||
if (!$online) {
|
||||
// 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']));
|
||||
|
||||
// Remove all guild invitations to this guild
|
||||
@ -502,7 +507,7 @@ if ($highest_access >= 2) {
|
||||
$old_leader = guild_leader($gid);
|
||||
|
||||
$online = false;
|
||||
if ($config['TFSVersion'] !== 'TFS_10') {
|
||||
if ($config['ServerEngine'] !== 'TFS_10') {
|
||||
$newData = user_character_data($new_leader, 'online');
|
||||
$oldData = user_character_data($old_leader, 'online');
|
||||
} else {
|
||||
@ -546,7 +551,7 @@ if ($highest_access >= 2) {
|
||||
$name = sanitize($_POST['remove_member']);
|
||||
$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);
|
||||
header('Location: guilds.php?name='. $_GET['name']);
|
||||
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 (get_guild_id($_POST['warinvite'])) {
|
||||
$status = false;
|
||||
@ -814,7 +819,7 @@ if ($highest_access >= 2) {
|
||||
</ul>
|
||||
</form>
|
||||
<?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>
|
||||
<form action="" method="post">
|
||||
<ul>
|
||||
@ -859,8 +864,8 @@ if ($highest_access >= 2) {
|
||||
<!-- end leader-->
|
||||
<?php
|
||||
if ($config['guildwar_enabled'] === true) {
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars();
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03();
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $wardata = get_guild_wars();
|
||||
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");
|
||||
$war_exist = false;
|
||||
if ($wardata !== false) {
|
||||
|
24
guildwar.php
24
guildwar.php
@ -11,14 +11,14 @@ include 'layout/overall/header.php';
|
||||
if (!empty($_GET['warid'])) {
|
||||
$warid = (int)$_GET['warid']; // Sanitizing GET.
|
||||
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $war = get_guild_war($warid);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $war = get_guild_war03($warid);
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $war = get_guild_war($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");
|
||||
|
||||
if ($war != false) {
|
||||
// Kills data for this specific war entry
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $kills = get_war_kills($warid);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $kills = get_war_kills03($warid);
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $kills = get_war_kills($warid);
|
||||
else if ($config['ServerEngine'] == 'TFS_03') $kills = get_war_kills03($warid);
|
||||
?>
|
||||
<h1><?php echo $war['name1']; ?> - VERSUS - <?php echo $war['name2']; ?></h1>
|
||||
|
||||
@ -30,7 +30,7 @@ if (!empty($_GET['warid'])) {
|
||||
$guild2 = $war['guild2'];
|
||||
$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) {
|
||||
if ($kill['killerguild'] == $guild1)
|
||||
$g1c++;
|
||||
@ -50,7 +50,7 @@ if (!empty($_GET['warid'])) {
|
||||
<li>
|
||||
War status: <?php echo $config['war_status'][$war['status']]; ?>.
|
||||
</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>
|
||||
Leading guild: <?php echo $leading; ?>.
|
||||
</li>
|
||||
@ -67,7 +67,7 @@ if (!empty($_GET['warid'])) {
|
||||
<?php } ?>
|
||||
</ul>
|
||||
<?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">
|
||||
<tr class="yellow">
|
||||
@ -90,7 +90,7 @@ if (!empty($_GET['warid'])) {
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
if ($config['TFSVersion'] == 'TFS_03') {
|
||||
if ($config['ServerEngine'] == 'TFS_03') {
|
||||
// BORROWED FROM GESIOR (and ported to work on Znote AAC).
|
||||
$main_content = "";
|
||||
$deaths = gesior_sql_death($warid);
|
||||
@ -146,8 +146,8 @@ if (!empty($_GET['warid'])) {
|
||||
// Display current wars.
|
||||
|
||||
// Fetch list of wars
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $wardata = get_guild_wars();
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $wardata = get_guild_wars03();
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'TFS_10' || $config['ServerEngine'] == 'OTHIRE') $wardata = get_guild_wars();
|
||||
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");
|
||||
//echo $wardata[0]['name1'];
|
||||
//die(var_dump($wardata));
|
||||
@ -155,8 +155,8 @@ if (!empty($_GET['warid'])) {
|
||||
// kills data
|
||||
$killsdata = array(); // killsdata[guildid] => array(warid) => array info about the selected war entry
|
||||
foreach ($wardata as $wars) {
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $killsdata[$wars['id']] = get_war_kills($wars['id']);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($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['ServerEngine'] == 'TFS_03') $killsdata[$wars['id']] = get_war_kills03($wars['id']);
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -55,7 +55,7 @@ function pageCheck($index, $page, $rowPerPage) {
|
||||
|
||||
$cache = new Cache('engine/cache/highscores');
|
||||
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->save();
|
||||
} else {
|
||||
|
@ -5,7 +5,7 @@ if ($config['log_ip']) {
|
||||
|
||||
$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';");
|
||||
$minbid = $config['houseConfig']['minimumBidSQM'] * $house['size'];
|
||||
if ($house['owner'] > 0) $house['ownername'] = user_name($house['owner']);
|
||||
|
@ -5,7 +5,7 @@ include 'layout/overall/header.php';
|
||||
if ($config['log_ip'])
|
||||
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 */
|
||||
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>';
|
||||
}
|
||||
} else {
|
||||
if (empty($_POST) === true && $config['TFSVersion'] === 'TFS_03') {
|
||||
if (empty($_POST) === true && $config['ServerEngine'] === 'TFS_03') {
|
||||
if ($config['allowSubPages'])
|
||||
header('Location: sub.php?page=houses');
|
||||
else
|
||||
echo 'Sub page system disabled.';
|
||||
} else if ($config['TFSVersion'] === 'TFS_02') {
|
||||
} else if ($config['ServerEngine'] === 'TFS_02' || $config['ServerEngine'] == 'OTHIRE') {
|
||||
$house = $config['house'];
|
||||
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>");
|
||||
@ -142,7 +142,7 @@ if (empty($_POST) === false && $config['TFSVersion'] === 'TFS_03') {
|
||||
</table>
|
||||
<?php
|
||||
} 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
|
||||
$querystring_id = &$_GET['id'];
|
||||
$townid = ($querystring_id) ? (int)$_GET['id'] : $config['houseConfig']['HouseListDefaultTown'];
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?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');
|
||||
if ($cache->hasExpired()) {
|
||||
$killers = fetchMurders();
|
||||
@ -84,7 +84,7 @@ if ($latests) {
|
||||
<?php
|
||||
} else echo 'No player kills exist.';
|
||||
|
||||
} else if ($config['TFSVersion'] == 'TFS_03') {
|
||||
} else if ($config['ServerEngine'] == 'TFS_03') {
|
||||
$cache = new Cache('engine/cache/killers');
|
||||
if ($cache->hasExpired()) {
|
||||
$deaths = fetchLatestDeaths_03(30, true);
|
||||
|
@ -11,7 +11,7 @@
|
||||
include 'layout/widgets/topplayers.php';
|
||||
include 'layout/widgets/highscore.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
|
||||
//include 'layout/widgets/twitter.php';
|
||||
?>
|
||||
|
@ -1,17 +1,17 @@
|
||||
<div class="sidebar">
|
||||
<h2>Search town list</h2>
|
||||
<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 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
|
||||
foreach ($config['towns'] as $id => $name) echo '<option value="'. $id .'">'. $name .'</option>';
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
/* Form file */
|
||||
if ($config['TFSVersion'] !== 'TFS_10') Token::create();
|
||||
if ($config['ServerEngine'] !== 'TFS_10') Token::create();
|
||||
?>
|
||||
<input type="submit" value="Fetch houses">
|
||||
</form>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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">
|
||||
<ul>
|
||||
<li>
|
||||
|
@ -2,7 +2,7 @@
|
||||
require_once 'engine/init.php';
|
||||
|
||||
// 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) {
|
||||
die(json_encode(array('errorCode' => $code, 'errorMessage' => $message)));
|
||||
@ -132,8 +132,8 @@ if (empty($_POST) === false) {
|
||||
} else {
|
||||
|
||||
// Starting loging
|
||||
if ($config['TFSVersion'] == 'TFS_02' || $config['TFSVersion'] == 'TFS_10') $login = user_login($username, $password);
|
||||
else if ($config['TFSVersion'] == 'TFS_03') $login = user_login_03($username, $password);
|
||||
if ($config['ServerEngine'] == 'TFS_02' || $config['ServerEngine'] == 'OTHIRE' || $config['ServerEngine'] == 'TFS_10') $login = user_login($username, $password);
|
||||
else if ($config['ServerEngine'] == 'TFS_03') $login = user_login_03($username, $password);
|
||||
else $login = false;
|
||||
if ($login === false) {
|
||||
$errors[] = 'Username and password combination is wrong.';
|
||||
@ -151,7 +151,7 @@ if (empty($_POST) === false) {
|
||||
|
||||
if ($status) {
|
||||
// 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");
|
||||
|
||||
// Two factor authentication code / token
|
||||
|
@ -52,7 +52,7 @@ if (!empty($_POST['selected_character'])) {
|
||||
if (user_character_account_id($char_name) === $session_user_id) {
|
||||
$charid = user_character_id($char_name);
|
||||
if ($charid !== false) {
|
||||
if ($config['TFSVersion'] === 'TFS_10') {
|
||||
if ($config['ServerEngine'] === 'TFS_10') {
|
||||
if (!user_is_online_10($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.';
|
||||
@ -75,7 +75,7 @@ if (!empty($_POST['selected_character'])) {
|
||||
$newname = isset($_POST['newName']) ? getValue($_POST['newName']) : '';
|
||||
|
||||
$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['online'] = (user_is_online_10($player['id'])) ? 1 : 0;
|
||||
} 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);
|
||||
$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;
|
||||
} else $chr_data = user_character_data($char_id, 'online');
|
||||
if ($chr_data['online'] != 1) {
|
||||
@ -239,10 +239,19 @@ if ($render_page) {
|
||||
?>
|
||||
<div id="myaccount">
|
||||
<h1>My account</h1>
|
||||
<p>Welcome to your account page, <?php echo $user_data['name']; ?><br>
|
||||
You have <?php echo $user_data['premdays']; ?> days remaining premium account.</p>
|
||||
<p>Welcome to your account page, <?php if ($config['ServerEngine'] !== 'OTHIRE') echo $user_data['name']; else echo $user_data['id']; ?><br>
|
||||
<?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
|
||||
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;");
|
||||
$status = ($query['secret'] === NULL) ? false : true;
|
||||
|
@ -14,7 +14,7 @@ $cache = new Cache('engine/cache/onlinelist');
|
||||
$cache->setExpiration(30);
|
||||
if ($cache->hasExpired()) {
|
||||
// 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`;");
|
||||
} 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;");
|
||||
|
@ -21,7 +21,7 @@ if ($config['mailserver']['accountRecovery']) {
|
||||
if (!$username) {
|
||||
// Recover username
|
||||
$salt = '';
|
||||
if ($config['TFSVersion'] != 'TFS_03') {
|
||||
if ($config['ServerEngine'] != 'TFS_03') {
|
||||
// TFS 0.2 and 1.0
|
||||
$password = sha1($password);
|
||||
} else {
|
||||
@ -61,7 +61,7 @@ if ($config['mailserver']['accountRecovery']) {
|
||||
// Recover password
|
||||
$newpass = rand(100000000, 999999999);
|
||||
$salt = '';
|
||||
if ($config['TFSVersion'] != 'TFS_03') {
|
||||
if ($config['ServerEngine'] != 'TFS_03') {
|
||||
// TFS 0.2 and 1.0
|
||||
$password = sha1($newpass);
|
||||
} else {
|
||||
|
27
register.php
27
register.php
@ -115,14 +115,25 @@ if (isset($_GET['success']) && empty($_GET['success'])) {
|
||||
}
|
||||
|
||||
//Register
|
||||
$register_data = array(
|
||||
'name' => $_POST['username'],
|
||||
'password' => $_POST['password'],
|
||||
'email' => $_POST['email'],
|
||||
'created' => time(),
|
||||
'ip' => getIPLong(),
|
||||
'flag' => $_POST['flag']
|
||||
);
|
||||
if ($config['ServerEngine'] !== 'OTHIRE') {
|
||||
$register_data = array(
|
||||
'name' => $_POST['username'],
|
||||
'password' => $_POST['password'],
|
||||
'email' => $_POST['email'],
|
||||
'created' => time(),
|
||||
'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']);
|
||||
if (!$config['mailserver']['debug']) header('Location: register.php?success');
|
||||
|
@ -35,12 +35,12 @@ if (user_logged_in() && is_admin($user_data)) {
|
||||
if ($stagesXML !== false) {
|
||||
$stagesData = array();
|
||||
// Load config ( stages enabled or disabled)
|
||||
if ($config['TFSVersion'] == 'TFS_10')
|
||||
if ($config['ServerEngine'] == 'TFS_10')
|
||||
foreach ($stagesXML->config->attributes() as $name => $value)
|
||||
$stagesData["$name"] = "$value";
|
||||
// Load stage levels
|
||||
// Each stage XML object
|
||||
if ($config['TFSVersion'] == 'TFS_10') {
|
||||
if ($config['ServerEngine'] == 'TFS_10') {
|
||||
foreach ($stagesXML->stage as $stage) {
|
||||
$rowData = array();
|
||||
// Each attribute name and values on current stage object
|
||||
|
@ -98,11 +98,11 @@ require '../engine/function/users.php';
|
||||
$updated_acc += 1;
|
||||
|
||||
// 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');
|
||||
$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');
|
||||
$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)
|
||||
if (strlen($p_pass) < 28 && $old > 1) {
|
||||
// encrypt it with sha1
|
||||
if ($config['TFSVersion'] == '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_02' || $config['salt'] === false) $p_pass = sha1($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
|
||||
mysql_update("UPDATE `accounts` SET `password`='$p_pass' WHERE `id`='$old';");
|
||||
|
@ -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';
|
||||
// Two-Factor Authentication setup page
|
||||
if ($config['TFSVersion'] !== 'TFS_10') {
|
||||
if ($config['ServerEngine'] !== 'TFS_10') {
|
||||
?>
|
||||
<h1>Server compatibility error</h1>
|
||||
<p>Sorry, this server is not compatible with Two-Factor Authentication.<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user