From 5a800349157a5673771d4758993a127e06e1baa3 Mon Sep 17 00:00:00 2001
From: Znote
Date: Mon, 1 Jun 2020 23:32:09 +0200
Subject: [PATCH] Toggle guild nick feature in config.php Fix #407 TFS 1.3 has
a potential unresolved crash bug related to guild nicks. You can check out
the details here:
https://github.com/otland/forgottenserver/issues/2561#issuecomment-633101435
---
config.php | 73 ++++++------
engine/function/users.php | 234 +++++++++++++++++++-------------------
guilds.php | 220 +++++++++++++++++------------------
3 files changed, 268 insertions(+), 259 deletions(-)
diff --git a/config.php b/config.php
index 771741a..f71cccd 100644
--- a/config.php
+++ b/config.php
@@ -23,7 +23,7 @@
$config['site_url'] = "http://demo.znote.eu";
// Path to server folder without "\" (or "/") at the end, ex: C:\Users\Username\Documents\GitHub\forgottenserver
- $config['server_path'] = '';
+ $config['server_path'] = '';
// ------------------------ \\
// MYSQL CONNECTION DETAILS \\
@@ -49,7 +49,7 @@
- getClock() = returns current time in numbers.
- getClock(time(), true) = returns current time in formatted date
- getClock(false, true) = same as above
- - getClock(false, true, false) = get current time, don't adjust timezone
+ - getClock(false, true, false) = get current time, don't adjust timezone
- echo getClock($profile_data['lastlogin'], true); = from characterprofile,
explains when user was last logged in. */
function getClock($time = false, $format = false, $adjust = true) {
@@ -65,7 +65,7 @@
// ------------------- \\
// CUSTOM SERVER STUFF \\
// ------------------- \\
- // Enable / disable Questlog function (true / false)
+ // Enable / disable Questlog function (true / false)
$config['EnableQuests'] = false;
// array for filling questlog (Questid, max value, name, end of the quest fill 1 for the last part 0 for all others)
@@ -145,8 +145,8 @@
'secret' => true
),
30001 => array(
- 'Allow Cookies?',
- 'With a perfectly harmless smile you fooled all of those wicecrackers into eating your exploding cookies. Consider a boy or girl scout outfit next time to make the trick even better.',
+ 'Allow Cookies?',
+ 'With a perfectly harmless smile you fooled all of those wicecrackers into eating your exploding cookies. Consider a boy or girl scout outfit next time to make the trick even better.',
'points' => '10', // 1-3 points (1 star), 4-6 points (2 stars), 7-9 points(3 stars), 10 points => (4 stars)
'secret' => true // show "secret" badge
),
@@ -157,7 +157,7 @@
),
30003 => array(
'Bearhugger',
- 'Warm, furry and cuddly - though that same bear you just hugged would probably rip you into pieces if he had been conscious, he reminded you of that old teddy bear which always slept in your bed when you were still small.',
+ 'Warm, furry and cuddly - though that same bear you just hugged would probably rip you into pieces if he had been conscious, he reminded you of that old teddy bear which always slept in your bed when you were still small.',
'points' => '4'
),
30004 => array(
@@ -167,23 +167,23 @@
),
30005 => array(
'Chorister',
- 'Lalalala... you now know the cult\'s hymn sung in Liberty Bay by heart. Not that hard, considering that it mainly consists of two notes and repetitive lyrics.',
+ 'Lalalala... you now know the cult\'s hymn sung in Liberty Bay by heart. Not that hard, considering that it mainly consists of two notes and repetitive lyrics.',
'points' => '1'
),
30006 => array(
'Fountain of Life',
- 'You found and took a sip from the Fountain of Life. Thought it didn\'t grant you eternal life, you feel changed and somehow at peace.',
+ 'You found and took a sip from the Fountain of Life. Thought it didn\'t grant you eternal life, you feel changed and somehow at peace.',
'points' => '1',
'secret' => true
),
30007 => array(
'Here, Fishy Fishy!',
- 'Ah, the smell of the sea! Standing at the shore and casting a line is one of your favourite activities. For you, fishing is relaxing - and at the same time, providing easy food. Perfect!',
+ 'Ah, the smell of the sea! Standing at the shore and casting a line is one of your favourite activities. For you, fishing is relaxing - and at the same time, providing easy food. Perfect!',
'points' => '1'
),
30008 => array(
'Honorary Barbarian',
- 'You\'ve hugged bears, pushed mammoths and proved your drinking skills. And even though you have a slight hangover, a partially fractured rib and some greasy hair on your tongue, you\'re quite proud to call yourself a honorary barbarian from now on.',
+ 'You\'ve hugged bears, pushed mammoths and proved your drinking skills. And even though you have a slight hangover, a partially fractured rib and some greasy hair on your tongue, you\'re quite proud to call yourself a honorary barbarian from now on.',
'points' => '1'
),
30009 => array(
@@ -193,12 +193,12 @@
),
300010 => array(
'Just in Time',
- 'You\'re a fast runner and are good at delivering wares which are bound to decay just in the nick of time, even if you can\'t use any means of transportation or if your hands get cold or smelly in the process.',
+ 'You\'re a fast runner and are good at delivering wares which are bound to decay just in the nick of time, even if you can\'t use any means of transportation or if your hands get cold or smelly in the process.',
'points' => '1'
),
30011 => array(
'Matchmaker',
- 'You don\'t believe in romance to be a coincidence or in love at first sight. In fact - love potions, bouquets of flowers and cheesy poems do the trick much better than ever could. Keep those hormones flowing!',
+ 'You don\'t believe in romance to be a coincidence or in love at first sight. In fact - love potions, bouquets of flowers and cheesy poems do the trick much better than ever could. Keep those hormones flowing!',
'points' => '1',
'secret' => true
),
@@ -216,7 +216,7 @@
),
30014 => array(
'Secret Agent',
- 'Pack your spy gear and get ready for some dangerous missions in service of a secret agency. You\'ve shown you want to - but can you really do it? Time will tell.',
+ 'Pack your spy gear and get ready for some dangerous missions in service of a secret agency. You\'ve shown you want to - but can you really do it? Time will tell.',
'points' => '1',
'secret' => true
),
@@ -232,7 +232,7 @@
),
30017 => array(
'Worm Whacker',
- 'Weehee! Whack those worms! You sure know how to handle a big hammer.',
+ 'Weehee! Whack those worms! You sure know how to handle a big hammer.',
'points' => '1',
'secret' => true
),
@@ -243,7 +243,7 @@
),
30019 => array(
'Amateur Actor',
- 'You helped bringing Princess Buttercup, Doctor Dumbness and Lucky the Wonder Dog to life - and will probably dream of them tonight, since you memorised your lines perfectly. What a .. special piece of.. screenplay.',
+ 'You helped bringing Princess Buttercup, Doctor Dumbness and Lucky the Wonder Dog to life - and will probably dream of them tonight, since you memorised your lines perfectly. What a .. special piece of.. screenplay.',
'points' => '2'
),
30020 => array(
@@ -269,39 +269,39 @@
// Vocation IDs, names and which vocation ID they got promoted from
$config['vocations'] = array(
- 0 => array(
+ 0 => array(
'name' => 'No vocation',
'fromVoc' => false
),
- 1 => array(
+ 1 => array(
'name' => 'Sorcerer',
'fromVoc' => false
),
- 2 => array(
+ 2 => array(
'name' => 'Druid',
'fromVoc' => false
),
- 3 => array(
+ 3 => array(
'name' => 'Paladin',
'fromVoc' => false
),
- 4 => array(
+ 4 => array(
'name' => 'Knight',
'fromVoc' => false
),
- 5 => array(
+ 5 => array(
'name' => 'Master Sorcerer',
'fromVoc' => 1
),
- 6 => array(
+ 6 => array(
'name' => 'Elder Druid',
'fromVoc' => 2
),
- 7 => array(
+ 7 => array(
'name' => 'Royal Paladin',
'fromVoc' => 3
),
- 8 => array(
+ 8 => array(
'name' => 'Elite Knight',
'fromVoc' => 4
)
@@ -424,7 +424,7 @@
5 => 'Ended',
);
- /* -- SUB PAGES --
+ /* -- SUB PAGES --
Some custom layouts/templates have custom pages, they can use
this sub page functionality for that.
*/
@@ -564,7 +564,7 @@
'price_sqm' => '50', // price per house sqm
);
- $config['delete_character_interval'] = '3 DAY'; // Delay after user character delete request is executed, ex: 1 DAY, 2 HOUR, 3 MONTH etc.
+ $config['delete_character_interval'] = '3 DAY'; // Delay after user character delete request is executed, ex: 1 DAY, 2 HOUR, 3 MONTH etc.
$config['validate_IP'] = false;
$config['salt'] = false;
@@ -605,7 +605,7 @@
'equipment' => true,
'skills' => true,
'outfits' => true,
- // Player storage (storage_value + outfitId)
+ // Player storage (storage_value + outfitId)
// used to see if player has outfit.
// see LUA scripts folder for otserv code
'storage_value' => 10000
@@ -620,6 +620,11 @@
// Do you need to have premium account to create a guild?
$config['guild_require_premium'] = true;
+ // There is a TFS 1.3 bug related to guild nicks
+ // https://github.com/otland/forgottenserver/issues/2561
+ // So if your using TFS 1.x, you might need to disable guild nicks until the crash has been fixed.
+ $config['guild_allow_nicknames'] = true;
+
$config['guildwar_enabled'] = false;
// Use htaccess rewrite? (basically this makes website.com/username work instead of website.com/characterprofile.php?name=username
@@ -712,13 +717,13 @@
'host' => "mailserver.znote.eu", // Outgoing mail server host.
'securityType' => 'ssl', // ssl or tls
'port' => 465, // SMTP port number - likely to be 465(ssl) or 587(tls)
- 'email' => 'noreply@znote.eu',
+ 'email' => 'noreply@znote.eu',
'username' => 'noreply@znote.eu', // Likely the same as email
'password' => 'emailpassword', // The password.
'debug' => false, // Enable debugging if you have problems and are looking for errors.
'fromName' => $config['site_title'],
);
-
+
// Don't touch this unless you know what you are doing. (modifying these (key value) also requires modifications in OT files data/XML/groups.xml).
$config['ingame_positions'] = array(
1 => 'Player',
@@ -736,7 +741,7 @@
// Available options: LINUX or WINDOWS
$config['os'] = ZNOTE_OS; // Use 'ZNOTE_OS' to auto-detect
- // Measure how much players are lagging in-game. (Not completed).
+ // Measure how much players are lagging in-game. (Not completed).
$config['ping'] = false;
// BAN STUFF - Don't touch this unless you know what you are doing.
@@ -818,7 +823,7 @@
$config['session_prefix'] = 'znote_';
/* Store visitor data
- Store visitor data in the database, logging every IP visiting site,
+ Store visitor data in the database, logging every IP visiting site,
and how many times they have visited the site. And sometimes what
they do on the site.
@@ -832,7 +837,7 @@
$config['log_ip'] = false;
// Flush IP logs each configured seconds, 60 * 15 = 15 minutes.
- // Set to false to entirely disable ip log flush.
+ // Set to false to entirely disable ip log flush.
// It is important to flush for optimal performance.
$config['flush_ip_logs'] = 59 * 27;
@@ -946,7 +951,7 @@
/// Let players sell, buy and bid on characters.
/// Creates a deeper shop economy, encourages players to spend more money in shop for points.
/// Pay to win/progress mechanic, but also lets people who can barely afford points to gain it
- /// by leveling characters to sell. It can also discourages illegal/risky third-party account
+ /// by leveling characters to sell. It can also discourages illegal/risky third-party account
/// services. Since players can buy officially & support the server, dodgy competitors have to sell for cheaper.
/// Without admin interference this is organic to each individual community economy inflation.
//////////
@@ -968,7 +973,7 @@
type 2 = Premium days
type 3 = Change character gender
type 4 = Change character name
- type 5 = Buy outfit (put outfit id as itemid),
+ type 5 = Buy outfit (put outfit id as itemid),
(put addon id as count [0 = nothing, 1 = first addon, 2 = second addon, 3 = both addons])
type 6 = Buy mount (put mount id as itemid)
type 7 = Buy house (hardcoded in the house system, type used for data log)
diff --git a/engine/function/users.php b/engine/function/users.php
index 1e01e05..c1a8414 100644
--- a/engine/function/users.php
+++ b/engine/function/users.php
@@ -62,23 +62,23 @@ function fetchLatestDeaths_03($rowz = 30, $killers = false) {
//while ($showdeaths = mysql_fetch_assoc($getdeaths)) {
if ($getdeaths !== false) {
for ($i = 0; $i < count($getdeaths); $i++) {
- $pid = $getdeaths[$i]['player_id'];
- $level = $getdeaths[$i]['level'];
- $kid = user_get_kid($getdeaths[$i]['id']);
-
- $killedby = user_name(user_get_killer_id($kid));
-
+ $pid = $getdeaths[$i]['player_id'];
+ $level = $getdeaths[$i]['level'];
+ $kid = user_get_kid($getdeaths[$i]['id']);
+
+ $killedby = user_name(user_get_killer_id($kid));
+
if ($killedby == false) {
- $killedby = user_get_killer_m_name($kid);
- $player = 0;
+ $killedby = user_get_killer_m_name($kid);
+ $player = 0;
} else {
- $player = 1;
+ $player = 1;
}
if ($killedby === false) {
$player = 2;
$killedby = "Deleted player.";
}
- $getname = mysql_select_single("SELECT `name` FROM `players` WHERE `id` = '$pid' LIMIT 1;");
+ $getname = mysql_select_single("SELECT `name` FROM `players` WHERE `id` = '$pid' LIMIT 1;");
$name = $getname['name'];
$row = array();
$row['level'] = $level;
@@ -151,7 +151,7 @@ function fetchAllHouses_03() {
return mysql_select_multi("SELECT * FROM `houses`;");
}
-// TFS Storage value functions (Warning, I think these things are saved in cache,
+// TFS Storage value functions (Warning, I think these things are saved in cache,
// and thus require server to be offline, or affected players to be offline while using)
// Get player storage list
@@ -171,7 +171,7 @@ function getGlobalStorage($storage) {
function setGlobalStorage($storage, $value) {
$storage = (int)$storage;
$value = (int)$value;
-
+
// If the storage does not exist yet
if (getGlobalStorage($storage) === false) {
mysql_insert("INSERT INTO `global_storage` (`key`, `world_id`, `value`) VALUES ('$storage', 0, '$value')");
@@ -196,7 +196,7 @@ function setPlayerStorage($player_id, $storage, $value) {
$storage = (int)$storage;
$value = (int)$value;
$player_id = (int)$player_id;
-
+
// If the storage does not exist yet
if (getPlayerStorage($storage) === false) {
mysql_insert("INSERT INTO `player_storage` (`player_id`, `key`, `value`) VALUES ('$player_id', '$storage', '$value')");
@@ -254,7 +254,7 @@ function guild_remove_member_10($cid) {
function guild_change_rank($rid, $name) {
$rid = (int)$rid;
$name = sanitize($name);
-
+
mysql_update("UPDATE `guild_ranks` SET `name`='$name' WHERE `id`=$rid");
}
@@ -266,20 +266,20 @@ function guild_change_leader($nCid, $oCid) {
$ranks = get_guild_rank_data($gid);
$leader_rid = 0;
$vice_rid = 0;
-
-
+
+
// Get rank id for leader and vice leader.
foreach ($ranks as $rank) {
if ($rank['level'] == 3) $leader_rid = $rank['id'];
if ($rank['level'] == 2) $vice_rid = $rank['id'];
}
-
+
$status = false;
if ($leader_rid > 0 && $vice_rid > 0) $status = true;
-
+
// Verify that we found the rank ids for vice leader and leader.
if ($status) {
-
+
// Update players and set their new rank id
if (config('ServerEngine') !== 'TFS_10') {
mysql_update("UPDATE `players` SET `rank_id`='$leader_rid' WHERE `id`=$nCid LIMIT 1;");
@@ -288,11 +288,11 @@ function guild_change_leader($nCid, $oCid) {
mysql_update("UPDATE `guild_membership` SET `rank_id`='$leader_rid' WHERE `player_id`=$nCid LIMIT 1;");
mysql_update("UPDATE `guild_membership` SET `rank_id`='$vice_rid' WHERE `player_id`=$oCid LIMIT 1;");
}
-
+
// Update guilds set new ownerid
guild_new_leader($nCid, $gid);
}
-
+
return $status;
}
@@ -432,20 +432,20 @@ function update_player_guild_position_10($cid, $rid) {
function update_player_guildnick($cid, $nick) {
$cid = (int)$cid;
$nick = sanitize($nick);
- if (!empty($nick)) {
+ if (!empty($nick)) {
mysql_update("UPDATE `players` SET `guildnick`='$nick' WHERE `id`=$cid");
} else {
- mysql_update("UPDATE `players` SET `guildnick`= NULL WHERE `id`=$cid");
+ mysql_update("UPDATE `players` SET `guildnick`='' WHERE `id`=$cid");
}
}
function update_player_guildnick_10($cid, $nick) {
$cid = (int)$cid;
$nick = sanitize($nick);
- if (!empty($nick)) {
+ if (!empty($nick)) {
mysql_update("UPDATE `guild_membership` SET `nick`='$nick' WHERE `player_id`=$cid");
} else {
- mysql_update("UPDATE `guild_membership` SET `nick`= NULL WHERE `player_id`=$cid");
+ mysql_update("UPDATE `guild_membership` SET `nick`='' WHERE `player_id`=$cid");
}
}
@@ -460,7 +460,7 @@ function create_guild($cid, $name) {
$cid = (int)$cid;
$name = sanitize($name);
$time = time();
-
+
// Create the guild
if (config('ServerEngine') !== 'OTHIRE')
mysql_insert("INSERT INTO `guilds` (`name`, `ownerid`, `creationdata`, `motd`) VALUES ('$name', '$cid', '$time', '');");
@@ -469,7 +469,7 @@ function create_guild($cid, $name) {
// Get guild id
$gid = get_guild_id($name);
-
+
// Get rank id for guild leader
$data = mysql_select_single("SELECT `id` FROM `guild_ranks` WHERE `guild_id`='$gid' AND `level`='3' LIMIT 1;");
$rid = ($data !== false) ? $data['id'] : false;
@@ -510,7 +510,7 @@ function get_player_guild_data($cid) {
$cid = (int)$cid;
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) {
$rankdata = mysql_select_single("SELECT `guild_id`, `level` AS `rank_level`, `name` AS `rank_name` FROM `guild_ranks` WHERE `id`='". $playerdata['rank_id'] ."' LIMIT 1;");
if ($rankdata !== false) {
@@ -599,7 +599,7 @@ function get_guild_war($warid) {
function get_guild_war03($warid) {
$warid = (int)$warid; // Sanitizing the parameter id
- $war = mysql_select_single("SELECT `id`, `guild_id`, `enemy_id`, `status`, `begin`, `end`
+ $war = mysql_select_single("SELECT `id`, `guild_id`, `enemy_id`, `status`, `begin`, `end`
FROM `guild_wars` WHERE `id`=$warid ORDER BY `begin` DESC LIMIT 0, 30");
if ($war !== false) {
$war['guild1'] = $war['guild_id'];
@@ -680,10 +680,10 @@ function set_ingame_position($name, $acctype) {
function set_ingame_position03($name, $acctype) {
$acctype = (int)$acctype;
$name = sanitize($name);
-
+
$acc_id = user_character_account_id($name);
$char_id = user_character_id($name);
-
+
$group_id = 2;
if ($acctype == 1) {
$group_id = 1;
@@ -691,7 +691,7 @@ function set_ingame_position03($name, $acctype) {
mysql_update("UPDATE `players` SET `group_id` = '$acctype' WHERE `id` =$char_id;");
}
-// Set rule violation.
+// Set rule violation.
// Return true if success, query error die if failed, and false if $config['website_char'] is not recognized.
function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $comment) {
$charid = user_character_id($charname);
@@ -699,19 +699,19 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
$actionid = (int)$actionid;
$reasonid = (int)$reasonid;
$time = (int)($time + time());
-
+
$data = user_character_data($charid, 'account_id', 'lastip');
-
+
$accountid = $data['account_id'];
$charip = $data['lastip'];
-
+
$comment = sanitize($comment);
-
+
// ...
$bannedby = config('website_char');
if (user_character_exist($bannedby)) {
$bannedby = user_character_id($bannedby);
-
+
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('ServerEngine') === 'TFS_03') {
@@ -720,19 +720,19 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
case 1: // IP ban
mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('$typeid', '$charip', '4294967295', '1', '$time', '$now', '$bannedby', '$comment');");
break;
-
+
case 2: // namelock
mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('$typeid', '$charid', '4294967295', '1', '$time', '$now', '$bannedby', '$comment');");
break;
-
+
case 3: // acc ban
mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('$typeid', '$accountid', '4294967295', '1', '$time', '$now', '$bannedby', '$comment');");
break;
-
+
case 4: // notation
mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('$typeid', '$charid', '4294967295', '1', '$time', '$now', '$bannedby', '$comment');");
break;
-
+
case 5: // deletion
mysql_insert("INSERT INTO `bans` (`type`, `value`, `param`, `active`, `expires`, `added`, `admin_id`, `comment`) VALUES ('$typeid', '$charid', '4294967295', '1', '$time', '$now', '$bannedby', '$comment');");
break;
@@ -740,32 +740,32 @@ function set_rule_violation($charname, $typeid, $actionid, $reasonid, $time, $co
}
elseif (Config('ServerEngine') === 'TFS_10') {
$now = time();
-
+
switch ($typeid) {
case 1: // IP ban
mysql_insert("INSERT INTO `ip_bans` (`ip`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES ('$charip', '$comment', '$now', '$time', '$bannedby');");
break;
-
+
case 2: // namelock
mysql_insert("INSERT INTO `player_namelocks` (`player_id`, `reason`, `namelocked_at`, `namelocked_by`) VALUES ('$charid', 'comment', '$now', '$bannedby');");
break;
-
+
case 3: // acc ban
mysql_insert("INSERT INTO `account_bans` (`account_id`, `reason`, `banned_at`, `expires_at`, `banned_by`) VALUES ('$accountid', '$comment', '$now', '$time', '$bannedby');");
break;
-
+
case 4: // notation
data_dump(false, array('status' => false), "Function deprecated. Ban option does not exist in TFS 1.0.");
die();
break;
-
+
case 5: // deletion
data_dump(false, array('status' => false), "Function deprecated. Ban option does not exist in TFS 1.0.");
die();
break;
}
}
-
+
return true;
} else {
return false;
@@ -835,7 +835,7 @@ function user_delete_character($char_id) {
// Delete character with supplied id with a delay.
function user_delete_character_soft($char_id) {
$char_id = (int)$char_id;
-
+
$char_name = user_character_name($char_id);
$original_acc_id = user_character_account_id($char_name);
if(!user_character_pending_delete($char_name))
@@ -878,18 +878,18 @@ function user_character_list($account_id) {
for ($i = 0; $i < $count; $i++) {
$characters[$i]['vocation'] = vocation_id_to_name($characters[$i]['vocation']); // Change vocation id to vocation name
$characters[$i]['town_id'] = town_id_to_name($characters[$i]['town_id']); // Change town id to town name
-
- // Make lastlogin human read-able.
+
+ // Make lastlogin human read-able.
if ($characters[$i]['lastlogin'] != 0) {
$characters[$i]['lastlogin'] = getClock($characters[$i]['lastlogin'], true, false);
} else {
$characters[$i]['lastlogin'] = 'Never.';
}
-
- $characters[$i]['online'] = online_id_to_name($characters[$i]['online']); // 0 to "offline", 1 to "ONLINE".
+
+ $characters[$i]['online'] = online_id_to_name($characters[$i]['online']); // 0 to "offline", 1 to "ONLINE".
}
}
-
+
return $characters;
}
@@ -954,7 +954,7 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
// Generate SQL WHERE-clause for vocation if $v is set
$v = '';
- if ($vGrp !== 'all')
+ if ($vGrp !== 'all')
$v = (strpos($vGrp, ',') !== false) ? 'AND `p`.`vocation` IN ('. $vGrp . ')' : 'AND `p`.`vocation` = \''.intval($vGrp).'\'';
if ($tfs == 'TFS_10') {
@@ -962,7 +962,7 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
if ($flags === false) { // In this case we only need to query players table
$v = str_replace('`p`.', '', $v);
$outfits = str_replace('`p`.', '', $outfits);
-
+
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `name`, `vocation`, `skill_club` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_club` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `name`, `vocation`, `skill_sword` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_sword` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][3] = mysql_select_multi("SELECT `name`, `vocation`, `skill_axe` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_axe` DESC LIMIT 0, $rows;");
@@ -972,7 +972,7 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `name`, `vocation`, `experience`, `level` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `experience` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `name`, `vocation`, `maglevel` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `maglevel` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `name`, `vocation`, `skill_fist` AS `value` $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `skill_fist` DESC LIMIT 0, $rows;");
-
+
} else { // Inner join znote_accounts table to retrieve the flag
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_club` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_club` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][2] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_sword` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_sword` DESC LIMIT 0, $rows;");
@@ -985,7 +985,7 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_fist` AS `value`, `za`.`flag` $outfits FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < $g $v ORDER BY `p`.`skill_fist` DESC LIMIT 0, $rows;");
}
} else { // TFS 0.2, 0.3, 0.4
-
+
if ($flags === false) {
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 0 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation` $outfits FROM `player_skills` AS `s` LEFT JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` WHERE `s`.`skillid` = 1 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
@@ -998,7 +998,7 @@ function fetchAllScores($rows, $tfs, $g, $vlist, $v = -1, $flags = false, $outfi
$outfits = str_replace('`p`.', '', $outfits);
$vocGroups[$vGrp][7] = mysql_select_multi("SELECT `id`, `name`, `vocation`, `experience`, `level` AS `value` $outfits $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `experience` DESC limit 0, $rows;");
$vocGroups[$vGrp][8] = mysql_select_multi("SELECT `id`, `name`, `vocation`, `maglevel` AS `value` $outfits $outfits FROM `players` WHERE `group_id` < $g $v ORDER BY `maglevel` DESC limit 0, $rows;");
-
+
} else { // Inner join znote_accounts table to retrieve the flag
$vocGroups[$vGrp][9] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 0 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
$vocGroups[$vGrp][1] = mysql_select_multi("SELECT `s`.`player_id` AS `id`, `s`.`value` AS `value`, `p`.`name` AS `name`, `p`.`vocation` AS `vocation`, `za`.`flag` AS `flag` $outfits FROM `player_skills` AS `s` INNER JOIN `players` AS `p` ON `s`.`player_id`=`p`.`id` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `s`.`skillid` = 1 AND `p`.`group_id` < $g $v ORDER BY `s`.`value` DESC LIMIT 0, $rows;");
@@ -1050,11 +1050,11 @@ function user_recover($mode, $edom, $email, $character, $ip) {
'id' => $edom,
'email' => $email
);
- }
+ }
}
// Determine if the submitted information is correct and herit from same account
if (user_account_fields_verify_value($verify_data)) {
-
+
// Structure account id fetch method correctly
if ($mode == 'username') {
$account_id = user_account_id_from_password($verify_data['password']);
@@ -1066,7 +1066,7 @@ function user_recover($mode, $edom, $email, $character, $ip) {
}
// get account id from character name
$player_account_id = user_character_account_id($character);
-
+
//Verify that players.account_id matches account.id
if ($player_account_id == $account_id) {
// verify IP match (IP = accounts.email_new) \\
@@ -1082,7 +1082,7 @@ function user_recover($mode, $edom, $email, $character, $ip) {
} else {
$name_data = user_data($account_id, 'id');
echo '