diff --git a/config/servers.php b/config/servers.php index d0c58bd91..8ea3e7518 100644 --- a/config/servers.php +++ b/config/servers.php @@ -41,6 +41,14 @@ 'Persistent' => true, 'Timezone' => null // Possible values is as described in the comment in DbConfig. ), + // Web server configuration. + 'WebDbConfig' => array( + 'Hostname' => '127.0.0.1', + 'Username' => 'ragnarok', + 'Password' => 'ragnarok', + 'Database' => 'ragnarok', + 'Persistent' => true + ), // Login server configuration. 'LoginServer' => array( 'Address' => '127.0.0.1', diff --git a/lib/Flux.php b/lib/Flux.php index 7776272b3..911f94d9e 100644 --- a/lib/Flux.php +++ b/lib/Flux.php @@ -152,7 +152,7 @@ public static function initialize($options = array()) public static function initializeServerObjects() { foreach (self::$serversConfig->getChildrenConfigs() as $key => $config) { - $connection = new Flux_Connection($config->getDbConfig(), $config->getLogsDbConfig()); + $connection = new Flux_Connection($config->getDbConfig(), $config->getLogsDbConfig(), $config->getWebDbConfig()); $loginServer = new Flux_LoginServer($config->getLoginServer()); // LoginAthenaGroup maintains the grouping of a central login @@ -378,14 +378,16 @@ public static function parseServersConfigFile($filename, $import = false) $topConfig->setDbConfig(array(), $options); $topConfig->setLogsDbConfig(array(), $options); + $topConfig->setWebDbConfig(array(), $options); $topConfig->setLoginServer(array(), $options); $topConfig->setCharMapServers(array(), $options); $dbConfig = $topConfig->getDbConfig(); $logsDbConfig = $topConfig->getLogsDbConfig(); + $webDbConfig = $topConfig->getWebDbConfig(); $loginServer = $topConfig->getLoginServer(); - foreach (array($dbConfig, $logsDbConfig) as $_dbConfig) { + foreach (array($dbConfig, $logsDbConfig, $webDbConfig) as $_dbConfig) { $_dbConfig->setHostname('localhost', $options); $_dbConfig->setUsername('ragnarok', $options); $_dbConfig->setPassword('ragnarok', $options); diff --git a/lib/Flux/Athena.php b/lib/Flux/Athena.php index 250d18ec3..e45670368 100644 --- a/lib/Flux/Athena.php +++ b/lib/Flux/Athena.php @@ -58,6 +58,14 @@ class Flux_Athena { */ public $logsDatabase; + /** + * Web server database. (is not set until setConnection() is called.) + * + * @access public + * @var string + */ + public $webDatabase; + /** * Database used for the char/map (aka everything else) SQL operations. * This does not include log-related tasks. @@ -249,6 +257,7 @@ public function setConnection(Flux_Connection $connection) { $this->connection = $connection; $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); return $connection; } diff --git a/lib/Flux/Connection.php b/lib/Flux/Connection.php index 3e63d928b..6ba181c08 100644 --- a/lib/Flux/Connection.php +++ b/lib/Flux/Connection.php @@ -26,6 +26,14 @@ class Flux_Connection { */ public $logsDbConfig; + /** + * Logs database configuration object. + * + * @access public + * @var Flux_Config + */ + public $webDbConfig; + /** * @access private * @var PDO @@ -38,15 +46,23 @@ class Flux_Connection { */ private $pdoLogs; + /** + * @access private + * @var PDO + */ + private $pdoWeb; + /** * @param Flux_Config $dbConfig * @param Flux_Config $logsDbConfig + * @param Flux_Config $webDbConfig * @access public */ - public function __construct(Flux_Config $dbConfig, Flux_Config $logsDbConfig) + public function __construct(Flux_Config $dbConfig, Flux_Config $logsDbConfig, Flux_Config $webDbConfig) { $this->dbConfig = $dbConfig; $this->logsDbConfig = $logsDbConfig; + $this->webDbConfig = $webDbConfig; } /** @@ -131,6 +147,31 @@ private function getLogsConnection() return $this->pdoLogs; } + /** + * Get the PDO instance for the web server database server connection. + * + * @return PDO + * @access private + */ + private function getWebConnection() + { + if (!$this->pdoWeb) { + // Establish separate connection just for the web server database. + $pdoWeb = $this->connect($this->webDbConfig); + $this->pdoWeb = $pdoWeb; + + if ($encoding=$this->webDbConfig->getEncoding()) { + $sth = $this->getStatementForWeb("SET NAMES ?"); + $sth->execute(array($encoding)); + } + if ($timezone=$this->webDbConfig->getTimezone()) { + $sth = $this->getStatementForWeb("SET time_zone = ?"); + $sth->execute(array($timezone)); + } + } + return $this->pdoWeb; + } + /** * Select database to use. * @@ -188,6 +229,26 @@ public function getStatementForLogs($statement, $options = array()) } } + /** + * Instanciate a PDOStatement without obtaining a PDO handler before-hand. + * + * @return PDOStatement + * @access public + */ + public function getStatementForWeb($statement, $options = array()) + { + $dbh = $this->getWebConnection(); + $sth = $dbh->prepare($statement, $options); + @$sth->setFetchMode(PDO::FETCH_CLASS, 'Flux_DataObject', array(null, array('dbconfig' => $this->webDbConfig))); + + if ($sth) { + return new Flux_Connection_Statement($sth); + } + else { + return false; + } + } + /** * */ diff --git a/lib/Flux/LoginAthenaGroup.php b/lib/Flux/LoginAthenaGroup.php index 19de6dd52..f7f7fccb1 100644 --- a/lib/Flux/LoginAthenaGroup.php +++ b/lib/Flux/LoginAthenaGroup.php @@ -44,6 +44,14 @@ class Flux_LoginAthenaGroup { */ public $logsDatabase; + /** + * Web server database. + * + * @access public + * @var string + */ + public $webDatabase; + /** * Array of Flux_Athena instances. * @@ -64,6 +72,7 @@ public function __construct($serverName, Flux_Connection $connection, Flux_Login $this->loginServer = $loginServer; $this->loginDatabase = $loginServer->config->getDatabase(); $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); // Assign connection to LoginServer, used mainly to enable // authentication feature. diff --git a/lib/Flux/LoginServer.php b/lib/Flux/LoginServer.php index c8e637534..843f6df74 100644 --- a/lib/Flux/LoginServer.php +++ b/lib/Flux/LoginServer.php @@ -30,6 +30,14 @@ class Flux_LoginServer extends Flux_BaseServer { */ public $logsDatabase; + /** + * Web server database. (is not set until setConnection() is called.) + * + * @access public + * @var string + */ + public $webDatabase; + /** * Overridden to add custom properties. * @@ -52,6 +60,7 @@ public function setConnection(Flux_Connection $connection) { $this->connection = $connection; $this->logsDatabase = $connection->logsDbConfig->getDatabase(); + $this->webDatabase = $connection->webDbConfig->getDatabase(); return $connection; } diff --git a/modules/account/view.php b/modules/account/view.php index 01d905f49..b52764661 100644 --- a/modules/account/view.php +++ b/modules/account/view.php @@ -151,14 +151,8 @@ $athena = $session->getAthenaServer($serverName); $sql = "SELECT ch.*, guild.name AS guild_name, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len AS guild_emblem_len "; $sql .= "FROM {$athena->charMapDatabase}.`char` AS ch "; $sql .= "LEFT OUTER JOIN {$athena->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = guild.guild_id "; $sql .= "WHERE ch.account_id = ? ORDER BY ch.char_num ASC"; $sth = $server->connection->getStatement($sql); $sth->execute(array($accountID)); diff --git a/modules/castle/index.php b/modules/castle/index.php index d57d5a13d..67eb6dbed 100644 --- a/modules/castle/index.php +++ b/modules/castle/index.php @@ -6,15 +6,9 @@ $castleNames = Flux::config('CastleNames')->toArray(); $ids = implode(',', array_fill(0, count($castleNames), '?')); -$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as emblem_len "; -else - $sql .= "guild.emblem_len "; +$sql = "SELECT castles.castle_id, castles.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql .= "FROM {$server->charMapDatabase}.guild_castle AS castles "; $sql .= "LEFT JOIN guild ON guild.guild_id = castles.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = castles.guild_id "; $sql .= "WHERE castles.castle_id IN ($ids)"; $sql .= "ORDER BY castles.castle_id ASC"; $sth = $server->connection->getStatement($sql); diff --git a/modules/character/index.php b/modules/character/index.php index dea1049dc..83645045a 100644 --- a/modules/character/index.php +++ b/modules/character/index.php @@ -13,8 +13,6 @@ $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS mother ON mother.char_id = ch.mother "; $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS father ON father.char_id = ch.father "; $sqlpartial .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char` AS child ON child.char_id = ch.child "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sqlwhere = "WHERE 1=1 "; $sqlcount = ''; @@ -169,11 +167,7 @@ $col = "ch.account_id, ch.char_id, ch.name AS char_name, ch.char_num, "; $col .= "ch.online, ch.base_level, ch.job_level, ch.class, ch.zeny, "; -$col .= "guild.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len as guild_emblem_len, "; +$col .= "guild.guild_id, guild.name AS guild_name, guild.emblem_id as emblem, "; $col .= "login.userid, partner.name AS partner_name, partner.char_id AS partner_id, "; $col .= "mother.name AS mother_name, mother.char_id AS mother_id, "; $col .= "father.name AS father_name, father.char_id AS father_id, "; diff --git a/modules/character/online.php b/modules/character/online.php index f20a591fb..bfc27e3cb 100644 --- a/modules/character/online.php +++ b/modules/character/online.php @@ -8,8 +8,6 @@ $sqlpartial = "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; if (!$auth->allowedToIgnoreHiddenPref) { $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.$charPrefsTable AS pref1 ON "; @@ -100,11 +98,7 @@ $hiddenCount = (int)$sth->fetch()->total; $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "guild.name AS guild_name, guild.guild_id, ch.last_map, pref2.value AS hidemap, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len as guild_emblem_len "; +$col .= "guild.name AS guild_name, guild.guild_id, ch.last_map, pref2.value AS hidemap, guild.emblem_id as emblem "; $sql = $paginator->getSQL("SELECT $col FROM {$server->charMapDatabase}.`char` AS ch $sqlpartial"); $sth = $server->connection->getStatement($sql); diff --git a/modules/character/view.php b/modules/character/view.php index 006a69901..070e72d5e 100644 --- a/modules/character/view.php +++ b/modules/character/view.php @@ -31,11 +31,7 @@ $col .= "mother.name AS mother_name, mother.char_id AS mother_id, "; $col .= "father.name AS father_name, father.char_id AS father_id, "; $col .= "child.name AS child_name, child.char_id AS child_id, "; -$col .= "guild.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len as guild_emblem_len, "; +$col .= "guild.guild_id, guild.name AS guild_name, guild.emblem_id AS emblem, "; $col .= "guild_position.name AS guild_position, IFNULL(guild_position.exp_mode, 0) AS guild_tax, "; $col .= "party.name AS party_name, party.leader_char AS party_leader_id, party_leader.name AS party_leader_name, "; @@ -67,8 +63,6 @@ $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`".$mobdb[0]."` AS pet_mob ON pet_mob.ID = pet.class "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`".$mobdb[1]."` AS pet_mob2 ON pet_mob2.ID = pet.class "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`char_reg_num` AS reg ON reg.char_id = ch.char_id AND reg.key = 'PC_DIE_COUNTER' "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "WHERE ch.char_id = ?"; $sth = $server->connection->getStatement($sql); @@ -96,14 +90,9 @@ $sql = "SELECT fr.char_id, fr.name, fr.class, fr.base_level, fr.job_level, "; $sql .= "guild.guild_id, guild.name AS guild_name, fr.online, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len as guild_emblem_len "; + $sql .= "guild.emblem_id AS emblem "; $sql .= "FROM {$server->charMapDatabase}.`char` AS fr "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.guild ON guild.guild_id = fr.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = fr.guild_id "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.friends ON friends.friend_id = fr.char_id "; $sql .= "WHERE friends.char_id = ? ORDER BY fr.name ASC"; $sth = $server->connection->getStatement($sql); @@ -114,14 +103,9 @@ if ($char->party_leader_id) { $sql = "SELECT p.char_id, p.name, p.class, p.base_level, p.job_level, "; $sql .= "guild.guild_id, guild.name AS guild_name, p.online, "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "guild_emblems.file_data as guild_emblem_len "; - else - $sql .= "guild.emblem_len as guild_emblem_len "; + $sql .= "guild.emblem_id AS emblem "; $sql .= "FROM {$server->charMapDatabase}.`char` AS p "; $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.guild ON guild.guild_id = p.guild_id "; - if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT OUTER JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = p.guild_id "; $sql .= "WHERE p.party_id = ? AND p.char_id != ? ORDER BY p.name ASC"; $sth = $server->connection->getStatement($sql); diff --git a/modules/guild/emblem.php b/modules/guild/emblem.php index dd00e6246..9e47e0e82 100644 --- a/modules/guild/emblem.php +++ b/modules/guild/emblem.php @@ -29,10 +29,11 @@ function flux_display_empty_emblem() if (!$athenaServer || $guildID < 0) flux_display_empty_emblem(); else { + $dirname = FLUX_DATA_DIR."/tmp/emblems/$serverName/$athenaServerName"; + $filename = "$dirname/$guildID.png"; + if ($interval=Flux::config('EmblemCacheInterval')) { $interval *= 60; - $dirname = FLUX_DATA_DIR."/tmp/emblems/$serverName/$athenaServerName"; - $filename = "$dirname/$guildID.png"; if (!is_dir($dirname)) if (Flux::config('RequireOwnership')) @@ -48,24 +49,23 @@ function flux_display_empty_emblem() } if(Flux::config('EmblemUseWebservice')) { - $db = $athenaServer->charMapDatabase; + $db = $athenaServer->webDatabase; $sql = "SELECT file_type, file_data FROM $db.guild_emblems WHERE guild_id = ? LIMIT 1"; - $sth = $athenaServer->connection->getStatement($sql); + $sth = $athenaServer->connection->getStatementForWeb($sql); $sth->execute(array($guildID)); $res = $sth->fetch(); if (!$res->file_data) flux_display_empty_emblem(); else { + $data = 'data:image/gif;base64,'.base64_encode($res->file_data); + + if ($interval) + file_put_contents($filename, $res->file_data); + + /* TODO; add gif animation at first image load */ $image = imagecreatefromstring($res->file_data); - $rgb = imagecolorexact ($image, 255,0,255); - imagecolortransparent($image, $rgb); - header("Content-Type: image/png"); - - if ($interval) - imagepng($image, $filename); - imagepng($image); exit; } diff --git a/modules/guild/index.php b/modules/guild/index.php index a64ae729a..9c8dc1dbd 100644 --- a/modules/guild/index.php +++ b/modules/guild/index.php @@ -7,8 +7,6 @@ $bind = array(); $sqlpartial = "LEFT JOIN {$server->charMapDatabase}.`char` ON `char`.char_id = guild.char_id "; -if(Flux::config('EmblemUseWebservice')) - $sqlpartial .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = guild.guild_id "; $sqlpartial .= "WHERE 1=1 "; $guildID = $params->get('id'); @@ -85,11 +83,7 @@ $col = "guild.guild_id, guild.name AS guildName, guild.char_id AS charID, `char`.name AS charName, "; $col .= "guild.guild_lv AS guildLevel, guild.connect_member AS connectMem, guild.max_member AS maxMem, "; -$col .= "guild.average_lv AS avgLevel, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len "; -else - $col .= "guild.emblem_len "; +$col .= "guild.average_lv AS avgLevel, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`guild` $sqlpartial"; $sql = $paginator->getSQL($sql); diff --git a/modules/guild/view.php b/modules/guild/view.php index 81d3903f4..4dedf434b 100644 --- a/modules/guild/view.php +++ b/modules/guild/view.php @@ -19,16 +19,10 @@ $col = "guild.guild_id, guild.name, guild.char_id, guild.master, guild.guild_lv, guild.connect_member, guild.max_member, "; $col .= "guild.average_lv, guild.exp, guild.next_exp, guild.skill_point, REPLACE(guild.mes1, '|00', '') AS mes1, REPLACE(guild.mes2, '|00', '') AS mes2, "; -$col .= "guild.emblem_id, guild.emblem_data, `char`.name AS guild_master, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len "; -else - $col .= "guild.emblem_len "; +$col .= "guild.emblem_id as emblem, `char`.name AS guild_master "; $sql = "SELECT $col FROM {$server->charMapDatabase}.guild "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` ON `char`.char_id = guild.char_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = `char`.guild_id "; $sql .= "WHERE guild.guild_id = ?"; $sth = $server->connection->getStatement($sql); diff --git a/modules/ranking/alchemist.php b/modules/ranking/alchemist.php index d5764b949..ae917ef1f 100644 --- a/modules/ranking/alchemist.php +++ b/modules/ranking/alchemist.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.fame, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $ids = implode(',', array_fill(0, count($alchemistJobs), '?')); diff --git a/modules/ranking/blacksmith.php b/modules/ranking/blacksmith.php index 0bac1e9ed..20f98ccd9 100644 --- a/modules/ranking/blacksmith.php +++ b/modules/ranking/blacksmith.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.fame, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $ids = implode(',', array_fill(0, count($blacksmithJobs), '?')); diff --git a/modules/ranking/character.php b/modules/ranking/character.php index 098e44a71..834735743 100644 --- a/modules/ranking/character.php +++ b/modules/ranking/character.php @@ -15,16 +15,10 @@ } $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.base_exp, ch.job_level, ch.job_exp, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "WHERE 1=1 "; diff --git a/modules/ranking/death.php b/modules/ranking/death.php index c0cd25c1e..2c751da30 100644 --- a/modules/ranking/death.php +++ b/modules/ranking/death.php @@ -15,18 +15,12 @@ } $col = "ch.char_id, ch.name AS char_name, ch.class AS char_class, ch.base_level, ch.job_level, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len, "; -else - $col .= "guild.emblem_len AS guild_emblem_len, "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem, "; $col .= "CAST(IFNULL(reg.value, '0') AS UNSIGNED) AS death_count"; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char_reg_num` AS reg ON reg.char_id = ch.char_id AND reg.key = 'PC_DIE_COUNTER' "; $sql .= "WHERE 1=1 "; diff --git a/modules/ranking/guild.php b/modules/ranking/guild.php index 8c5d59c36..aab81a886 100644 --- a/modules/ranking/guild.php +++ b/modules/ranking/guild.php @@ -7,11 +7,7 @@ $ids = implode(',', array_fill(0, count($castleNames), '?')); $bind = array_keys($castleNames); -$col = "g.guild_id, g.name, g.guild_lv, g.average_lv, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as emblem_len, "; -else - $col .= "g.emblem_len, "; +$col = "g.guild_id, g.name, g.guild_lv, g.average_lv, g.emblem_id as emblem, "; $col .= "GREATEST(g.exp, (SELECT SUM(exp) FROM {$server->charMapDatabase}.guild_member WHERE guild_member.guild_id = g.guild_id)) AS exp, "; $col .= "(SELECT COUNT(char_id) FROM {$server->charMapDatabase}.`char` WHERE `char`.guild_id = g.guild_id) AS members, "; $col .= "(SELECT COUNT(castle_id) FROM {$server->charMapDatabase}.guild_castle WHERE guild_castle.guild_id = g.guild_id AND castle_id IN ($ids)) AS castles"; @@ -19,8 +15,6 @@ $sql = "SELECT $col FROM {$server->charMapDatabase}.guild AS g "; $sql .= "LEFT JOIN {$server->charMapDatabase}.`char` AS ch ON ch.char_id = g.char_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = g.guild_id "; $groups = AccountLevel::getGroupID((int)Flux::config('RankingHideGroupLevel'), '<'); if(!empty($groups)) { diff --git a/modules/ranking/zeny.php b/modules/ranking/zeny.php index 4d8f53a1f..9705d4ee4 100644 --- a/modules/ranking/zeny.php +++ b/modules/ranking/zeny.php @@ -17,18 +17,12 @@ $charPrefsTable = Flux::config('FluxTables.CharacterPrefsTable'); $col = "ch.char_id, ch.name AS char_name, ch.zeny, ch.class AS char_class, ch.base_level, ch.base_exp, ch.job_level, ch.job_exp, "; -$col .= "ch.guild_id, guild.name AS guild_name, "; -if(Flux::config('EmblemUseWebservice')) - $col .= "guild_emblems.file_data as guild_emblem_len "; -else - $col .= "guild.emblem_len AS guild_emblem_len "; +$col .= "ch.guild_id, guild.name AS guild_name, guild.emblem_id as emblem "; $sql = "SELECT $col FROM {$server->charMapDatabase}.`char` AS ch "; $sql .= "LEFT JOIN {$server->charMapDatabase}.$charPrefsTable AS hide_from_zr ON "; $sql .= "(hide_from_zr.name = 'HideFromZenyRanking' AND hide_from_zr.char_id = ch.char_id) "; $sql .= "LEFT JOIN {$server->charMapDatabase}.guild ON guild.guild_id = ch.guild_id "; -if(Flux::config('EmblemUseWebservice')) - $sql .= "LEFT JOIN {$server->charMapDatabase}.`guild_emblems` ON `guild_emblems`.guild_id = ch.guild_id "; $sql .= "LEFT JOIN {$server->loginDatabase}.login ON login.account_id = ch.account_id "; $sql .= "WHERE 1=1 "; diff --git a/themes/default/account/view.php b/themes/default/account/view.php index 5cce1da7b..d9e11442e 100644 --- a/themes/default/account/view.php +++ b/themes/default/account/view.php @@ -218,10 +218,10 @@ job_level ?> zeny) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view')): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/castle/index.php b/themes/default/castle/index.php index 1fe335f2e..55a0bdbcc 100644 --- a/themes/default/castle/index.php +++ b/themes/default/castle/index.php @@ -13,7 +13,7 @@ castle_id) ?> castle_id]) ?> guild_name): ?> - emblem_len): ?> + emblem): ?> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> diff --git a/themes/default/character/index.php b/themes/default/character/index.php index a1c2f7c96..b46298b64 100644 --- a/themes/default/character/index.php +++ b/themes/default/character/index.php @@ -124,10 +124,10 @@ job_level) ?> zeny) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/character/online.php b/themes/default/character/online.php index b290f9ea7..eef62557d 100644 --- a/themes/default/character/online.php +++ b/themes/default/character/online.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($char->guild_id, $char->guild_name) ?> diff --git a/themes/default/character/view.php b/themes/default/character/view.php index 975661732..3ca358691 100644 --- a/themes/default/character/view.php +++ b/themes/default/character/view.php @@ -125,10 +125,10 @@ Guild Name guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view')): ?> linkToGuild($char->guild_id, $char->guild_name) ?> @@ -257,7 +257,7 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> actionAllowed('guild', 'view') && $partyMember->guild_id == $char->guild_id) || $auth->allowedToViewGuild): ?> @@ -323,10 +323,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $friend->guild_id == $char->guild_id) || $auth->allowedToViewGuild): ?> linkToGuild($friend->guild_id, $friend->guild_name) ?> diff --git a/themes/default/guild/index.php b/themes/default/guild/index.php index 508e90f38..784abbf44 100644 --- a/themes/default/guild/index.php +++ b/themes/default/guild/index.php @@ -76,7 +76,7 @@ guild_id) ?> - emblem_len): ?> + emblem): ?> guildName) ?> diff --git a/themes/default/ranking/alchemist.php b/themes/default/ranking/alchemist.php index c35135b3f..6645a9e46 100644 --- a/themes/default/ranking/alchemist.php +++ b/themes/default/ranking/alchemist.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/blacksmith.php b/themes/default/ranking/blacksmith.php index c98ef522d..4512ebf2c 100644 --- a/themes/default/ranking/blacksmith.php +++ b/themes/default/ranking/blacksmith.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/character.php b/themes/default/ranking/character.php index 8e7e0a71e..25b4407d0 100644 --- a/themes/default/ranking/character.php +++ b/themes/default/ranking/character.php @@ -51,10 +51,10 @@ jobClassText($chars[$i]->char_class) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/death.php b/themes/default/ranking/death.php index 6dc430cbc..c8ed3fed1 100644 --- a/themes/default/ranking/death.php +++ b/themes/default/ranking/death.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?> diff --git a/themes/default/ranking/guild.php b/themes/default/ranking/guild.php index 29038c6f2..fb7b25210 100644 --- a/themes/default/ranking/guild.php +++ b/themes/default/ranking/guild.php @@ -19,10 +19,10 @@ > - emblem_len): ?> + emblem): ?> - emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($guilds[$i]->guild_id, $guilds[$i]->name) ?> diff --git a/themes/default/ranking/zeny.php b/themes/default/ranking/zeny.php index 545822518..dc17780ff 100644 --- a/themes/default/ranking/zeny.php +++ b/themes/default/ranking/zeny.php @@ -53,10 +53,10 @@ base_level) ?> job_level) ?> guild_name): ?> - guild_emblem_len): ?> + emblem): ?> - guild_emblem_len) echo ' colspan="2"' ?>> + emblem) echo ' colspan="2"' ?>> actionAllowed('guild', 'view') && $auth->allowedToViewGuild): ?> linkToGuild($chars[$i]->guild_id, $chars[$i]->guild_name) ?>