diff --git a/characterprofile.php b/characterprofile.php
index cec8686..722a5ce 100644
--- a/characterprofile.php
+++ b/characterprofile.php
@@ -29,7 +29,6 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false)
}
$profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
- $account_data = user_znote_account_data($profile_data['account_id'], 'flag');
$guild_exist = false;
@@ -47,12 +46,18 @@ if (isset($_GET['name']) === true && empty($_GET['name']) === false)
Profile:
-
-
- - Country: '; ?>
+ 0):
+ ?>
+ - Country: '; ?>
+
1) { ?>
diff --git a/config.php b/config.php
index cf3f74c..a42cb16 100644
--- a/config.php
+++ b/config.php
@@ -560,7 +560,13 @@
$config['use_guild_logos'] = true;
// Use country flags
- $config['country_flags'] = false;
+ $config['country_flags'] = array(
+ 'enabled' => true,
+ 'highscores' => true,
+ 'onlinelist' => true,
+ 'characterprofile' => true,
+ 'server' => 'http://flag.znote.eu'
+ );
// Level requirement to create guild? (Just set it to 1 to allow all levels).
$config['create_guild_level'] = 8;
diff --git a/engine/function/general.php b/engine/function/general.php
index f781c15..de9c7a4 100644
--- a/engine/function/general.php
+++ b/engine/function/general.php
@@ -277,13 +277,6 @@ function format_character_name($name) {
return ucwords(strtolower($name));
}
-// Returns a list of players online
-function online_list() {
- if (config('TFSVersion') == 'TFS_10') return mysql_select_multi("SELECT `o`.`player_id` AS `id`, `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname` FROM `players_online` as `o` INNER JOIN `players` as `p` ON `o`.`player_id` = `p`.`id` LEFT JOIN `guild_membership` gm ON `o`.`player_id` = `gm`.`player_id` LEFT JOIN `guilds` g ON `gm`.`guild_id` = `g`.`id`");
- else return mysql_select_multi("SELECT `p`.`name` as `name`, `p`.`level` as `level`, `p`.`vocation` as `vocation`, `g`.`name` as `gname` FROM `players` p LEFT JOIN `guild_ranks` gr ON `gr`.`id` = `p`.`rank_id` LEFT JOIN `guilds` g ON `gr`.`guild_id` = `g`.`id` WHERE `p`.`online` = '1' ORDER BY `p`.`name` DESC;");
-}
-
-
// Gets you the actual IP address even from users behind ISP proxies and so on.
function getIP() {
/*
diff --git a/highscores.php b/highscores.php
index f3a6bbd..bc64e56 100644
--- a/highscores.php
+++ b/highscores.php
@@ -28,6 +28,7 @@ if (!$page || $page == 0) $page = 1;
else $page = (int)$page;
$highscore = $config['highscore'];
+$loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['highscores']) ? true : false;
$rows = $highscore['rows'];
$rowsPerPage = $highscore['rowsPerPage'];
@@ -53,7 +54,7 @@ function pageCheck($index, $page, $rowPerPage) {
$cache = new Cache('engine/cache/highscores');
if ($cache->hasExpired()) {
- $vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $config['country_flags']);
+ $vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags);
$cache->setContent($vocGroups);
$cache->save();
@@ -128,7 +129,7 @@ if ($vocGroups) {
1) ? '
' : '';
+ $flag = ($loadFlags === true && strlen($vocGroup[$type][$i]['flag']) > 1) ? '
' : '';
?>
|
diff --git a/onlinelist.php b/onlinelist.php
index d2a8cf3..348b4cb 100644
--- a/onlinelist.php
+++ b/onlinelist.php
@@ -2,8 +2,30 @@
Who is online?
setExpiration(30);
+if ($cache->hasExpired()) {
+ // Load online list data from SQL
+ if ($config['TFSVersion'] == '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` 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` 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` 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` 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;");
+ }
+ // End loading data from SQL
+ $cache->setContent($array);
+ $cache->save();
+} else {
+ $array = $cache->load();
+}
+// End cache
+
+if ($array !== false) {
?>
@@ -13,17 +35,21 @@ if ($array) {
Level: |
Vocation: |
- ';
- echo ''. $value['name'] .' | ';
- if (!empty($value['gname'])) echo ''. $value['gname'] .' | '; else echo ' | ';
- echo ''. $value['level'] .' | ';
- echo ''. vocation_id_to_name($value['vocation']) .' | ';
- echo '';
- }
+ $flag = ($loadFlags === true && strlen($value['flag']) > 1) ? '
' : '';
+ $guildname = (!empty($value['gname'])) ? ''. $value['gname'] .'' : '';
?>
+
+ |
+ |
+ |
+ |
+
+