Permalink
Browse files

[456] Find realm ID in Armory::$realmData, not in DB. Drop `armory_re…

…alm_data` table. Load only necessary data from DB in Characters::BuildCharacter(). Small code improvements.
  • Loading branch information...
1 parent d2f61d1 commit adcc3c4945a6b09fdd96d0d270954f872ebccb0f @Shadez committed Jan 17, 2011
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -76,7 +76,7 @@
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
$achievements = $characters->GetAchievementMgr();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
@@ -86,15 +86,15 @@
$cache_id = $utils->GenerateCacheId('character-achievements-c'.$achievement_category, $utils->GenerateCacheIdForComparisons($comparisonData));
}
else {
- $cache_id = $utils->GenerateCacheId('character-achievements-c'.$achievement_category, $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-achievements-c'.$achievement_category, $characters->GetName(), $characters->GetRealmName());
}
}
else {
if(is_array($comparisonData)) {
$cache_id = $utils->GenerateCacheId('character-achievements', $utils->GenerateCacheIdForComparisons($comparisonData));
}
else {
- $cache_id = $utils->GenerateCacheId('character-achievements', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-achievements', $characters->GetName(), $characters->GetRealmName());
}
}
if($cache_data = $utils->GetCache($cache_id)) {
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -47,12 +47,12 @@
$realmId = $utils->GetRealmIdByName($_GET['r']);
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($characters->GetGUID() > 0 && $isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-arenateams', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-arenateams', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 465
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -45,12 +45,12 @@
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
$achievements = $characters->GetAchievementMgr();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-calendar', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-calendar', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -48,9 +48,11 @@
$_GET['r'] = false;
}
$realmId = $utils->GetRealmIdByName($_GET['r']);
+$characters->SetOptions(LOAD_NOTHING);
+$characters->SetOptions(array('load_feeds' => true));
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
header('Content-type: text/xml');
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -42,9 +42,11 @@
$_GET['r'] = false;
}
$realmId = $utils->GetRealmIdByName($_GET['r']);
+$characters->SetOptions(LOAD_NOTHING);
+$characters->SetOptions(array('load_feeds' => true));
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
@@ -61,7 +63,7 @@
$cache_name = 'character-feed-data';
}
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId($cache_name, $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId($cache_name, $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -83,7 +85,7 @@
}
$xml->XMLWriter()->startElement('character');
$xml->XMLWriter()->writeAttribute('name', $characters->GetName());
- $xml->XMLWriter()->writeAttribute('characterUrl', sprintf('r=%s&cn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($characters->GetName())));
+ $xml->XMLWriter()->writeAttribute('characterUrl', sprintf('r=%s&cn=%s', urlencode($characters->GetRealmName()), urlencode($characters->GetName())));
$xml->XMLWriter()->endElement(); //character
if(isset($feed_item['title'])) {
$xml->XMLWriter()->startElement('title');
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -44,7 +44,7 @@
$realmId = $utils->GetRealmIdByName($_GET['r']);
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
$tabUrl = $characters->GetUrlString();
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -45,12 +45,12 @@
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
$achievements = $characters->GetAchievementMgr();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-model-embed', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-model-embed', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -42,14 +42,15 @@
$_GET['r'] = false;
}
$realmId = $utils->GetRealmIdByName($_GET['r']);
+$characters->SetOptions(LOAD_NOTHING);
$characters->BuildCharacter($name, $realmId, true, true, 1);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-model', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-model', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -64,7 +65,7 @@
$xml->XMLWriter()->startElement('tabInfo');
$xml->XMLWriter()->writeAttribute('tab', 'character');
$xml->XMLWriter()->writeAttribute('tabGroup', 'character');
-$xml->XMLWriter()->writeAttribute('tabUrl', ($isCharacter) ? sprintf('r=%s&cn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($characters->GetName())) : null);
+$xml->XMLWriter()->writeAttribute('tabUrl', ($isCharacter) ? sprintf('r=%s&cn=%s', urlencode($characters->GetRealmName()), urlencode($characters->GetName())) : null);
$xml->XMLWriter()->endElement(); //tabInfo
if(!$isCharacter) {
$xml->XMLWriter()->startElement('characterInfo');
@@ -126,7 +127,7 @@
);
$xml->XMLWriter()->startElement('character');
-if($utils->IsAccountHaveCurrentCharacter($characters->GetGUID(), Armory::$currentRealmInfo['id'])) {
+if($utils->IsAccountHaveCurrentCharacter($characters->GetGUID(), $characters->GetRealmID())) {
$xml->XMLWriter()->writeAttribute('owned', 1);
}
$xml->XMLWriter()->startElement('models');
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -45,12 +45,12 @@
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
$achievements = $characters->GetAchievementMgr();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-reputation', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-reputation', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -47,14 +47,15 @@
$_GET['r'] = false;
}
$realmId = $utils->GetRealmIdByName($_GET['r']);
+$characters->SetOptions(LOAD_ALL);
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-sheet', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-sheet', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 465
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -67,14 +67,13 @@
$i++;
}
}
- //
$name = $comparisonData[0]['name'];
}
$realmId = $utils->GetRealmIdByName($_GET['r']);
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
$achievements = $characters->GetAchievementMgr();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
@@ -84,15 +83,15 @@
$cache_id = $utils->GenerateCacheId('character-statistics-c'.$achievement_category, $utils->GenerateCacheIdForComparisons($comparisonData));
}
else {
- $cache_id = $utils->GenerateCacheId('character-statistics-c'.$achievement_category, $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-statistics-c'.$achievement_category, $characters->GetName(), $characters->GetRealmName());
}
}
else {
if(is_array($comparisonData)) {
$cache_id = $utils->GenerateCacheId('character-statistics', $utils->GenerateCacheIdForComparisons($comparisonData));
}
else {
- $cache_id = $utils->GenerateCacheId('character-statistics', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-statistics', $characters->GetName(), $characters->GetRealmName());
}
}
if($cache_data = $utils->GetCache($cache_id)) {
View
@@ -46,12 +46,12 @@
$realmId = $utils->GetRealmIdByName($_GET['r']);
$characters->BuildCharacter($name, $realmId, true, true);
$isCharacter = $characters->CheckPlayer();
-if($_GET['r'] === false || !Armory::$currentRealmInfo) {
+if($_GET['r'] === false || !$characters->GetRealmName()) {
$isCharacter = false;
}
// Get page cache
if($isCharacter && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('character-talents', $characters->GetName(), Armory::$currentRealmInfo['name']);
+ $cache_id = $utils->GenerateCacheId('character-talents', $characters->GetName(), $characters->GetRealmName());
if($cache_data = $utils->GetCache($cache_id)) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 455
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -37,8 +37,7 @@
else {
$guilds->guildName = false;
}
-$serverType = Armory::$aDB->selectCell("SELECT `type` FROM `ARMORYDBPREFIX_realm_data` WHERE `name` = '%s' LIMIT 1", $utils->escape($_GET['r']));
-$isGuild = $guilds->InitGuild($serverType);
+$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 455
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -36,8 +36,7 @@
else {
$guilds->guildName = false;
}
-$serverType = Armory::$aDB->selectCell("SELECT `type` FROM `ARMORYDBPREFIX_realm_data` WHERE `name` = '%s' LIMIT 1", $utils->escape($_GET['r']));
-$isGuild = $guilds->InitGuild($serverType);
+$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 450
+ * @revision 456
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -36,8 +36,7 @@
else {
$guilds->guildName = false;
}
-$serverType = Armory::$aDB->selectCell("SELECT `type` FROM `ARMORYDBPREFIX_realm_data` WHERE `name` = '%s' LIMIT 1", $utils->escape($_GET['r']));
-$isGuild = $guilds->InitGuild($serverType);
+$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
Oops, something went wrong.

0 comments on commit adcc3c4

Please sign in to comment.