Permalink
Browse files

[483] Allow to browse guilds with different name spellings (Test and …

…TEST for example). Some changes in Guilds class.
  • Loading branch information...
1 parent 308002d commit 8c31ecad0fe34576113fbc1661a1cd5b755b737d @Shadez committed Feb 18, 2011
Showing with 123 additions and 110 deletions.
  1. +17 −23 guild-bank-contents.php
  2. +17 −23 guild-bank-log.php
  3. +15 −21 guild-info.php
  4. +15 −21 guild-stats.php
  5. +58 −21 includes/classes/class.guilds.php
  6. +1 −1 includes/revision_nr.php
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 456
+ * @revision 483
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -31,13 +31,7 @@
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
-if(isset($_GET['gn'])) {
- $guilds->guildName = $utils->escape($_GET['gn']);
-}
-else {
- $guilds->guildName = false;
-}
-$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
+$isGuild = $guilds->InitGuild($_GET['gn'], Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
@@ -51,10 +45,10 @@
exit;
}
if(!isset($_SESSION['accountId'])) {
- header('Location: login.xml?ref=' . urlencode(sprintf('guild-bank-contents.xml?r=%s&gn=%s', Armory::$currentRealmInfo['name'], $guilds->guildName)));
+ header('Location: login.xml?ref=' . urlencode(sprintf('guild-bank-contents.xml?r=%s&gn=%s', Armory::$currentRealmInfo['name'], $guilds->GetGuildName())));
exit;
}
-elseif(!$utils->IsAllowedToGuildBank($guilds->guildId, Armory::$currentRealmInfo['id'])) {
+elseif(!$utils->IsAllowedToGuildBank($guilds->GetGuildID(), Armory::$currentRealmInfo['id'])) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
$xml->XMLWriter()->startElement('page');
@@ -68,8 +62,8 @@
}
// Get page cache
-if($guilds->guildId > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('guild-bank-contents', $guilds->guildName, Armory::$currentRealmInfo['name']);
+if($guilds->GetGuildID() > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
+ $cache_id = $utils->GenerateCacheId('guild-bank-contents', $guilds->GetGuildName(), Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'guilds')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -87,26 +81,26 @@
$xml->XMLWriter()->writeAttribute('subTab', 'guildBankContents');
$xml->XMLWriter()->writeAttribute('tab', 'guild');
$xml->XMLWriter()->writeAttribute('tabGroup', 'guild');
-$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)) : null);
+$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())) : null);
$xml->XMLWriter()->endElement(); //tabInfo
/** Basic info **/
$guilds->BuildGuildInfo();
$guild_emblem = array(
- 'emblemBackground' => $guilds->bgcolor,
- 'emblemBorderColor' => $guilds->bordercolor,
- 'emblemBorderStyle' => $guilds->borderstyle,
- 'emblemIconColor' => $guilds->emblemcolor,
- 'emblemIconStyle' => $guilds->emblemstyle
+ 'emblemBackground' => $guilds->GetEmblemBGColor(),
+ 'emblemBorderColor' => $guilds->GetBorderColor(),
+ 'emblemBorderStyle' => $guilds->GetBorderStyle(),
+ 'emblemIconColor' => $guilds->GetEmblemColor(),
+ 'emblemIconStyle' => $guilds->GetEmblemStyle()
);
$guild_header = array(
'battleGroup' => Armory::$armoryconfig['defaultBGName'],
'count' => $guilds->CountGuildMembers(),
- 'faction' => $guilds->guildFaction,
- 'name' => $guilds->guildName,
- 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)),
+ 'faction' => $guilds->GetGuildFaction(),
+ 'name' => $guilds->GetGuildName(),
+ 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())),
'realm' => Armory::$currentRealmInfo['name'],
'realmUrl' => urlencode(Armory::$currentRealmInfo['name']),
- 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName))
+ 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName()))
);
$xml->XMLWriter()->startElement('guildInfo');
$xml->XMLWriter()->startElement('guildHeader');
@@ -171,7 +165,7 @@
echo $xml_cache_data;
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
- $cache_data = $utils->GenerateCacheData($guilds->guildName, $guilds->guildId, 'guild-bank-contents');
+ $cache_data = $utils->GenerateCacheData($guilds->GetGuildName(), $guilds->GetGuildID(), 'guild-bank-contents');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'guilds');
}
exit;
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 456
+ * @revision 483
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -30,13 +30,7 @@
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
-if(isset($_GET['gn'])) {
- $guilds->guildName = $utils->escape($_GET['gn']);
-}
-else {
- $guilds->guildName = false;
-}
-$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
+$isGuild = $guilds->InitGuild($_GET['gn'], Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
@@ -50,10 +44,10 @@
exit;
}
if(!isset($_SESSION['accountId'])) {
- header('Location: login.xml?ref=' . urlencode(sprintf('guild-bank-log.xml?r=%s&gn=%s', Armory::$currentRealmInfo['name'], $guilds->guildName)));
+ header('Location: login.xml?ref=' . urlencode(sprintf('guild-bank-log.xml?r=%s&gn=%s', Armory::$currentRealmInfo['name'], $guilds->GetGuildName())));
exit;
}
-elseif(!$utils->IsAllowedToGuildBank($guilds->guildId, Armory::$currentRealmInfo['id'])) {
+elseif(!$utils->IsAllowedToGuildBank($guilds->GetGuildID(), Armory::$currentRealmInfo['id'])) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
$xml->XMLWriter()->startElement('page');
@@ -67,8 +61,8 @@
}
// Get page cache
-if($guilds->guildId > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('guild-bank-log', $guilds->guildName, Armory::$currentRealmInfo['name']);
+if($guilds->GetGuildID() > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
+ $cache_id = $utils->GenerateCacheId('guild-bank-log', $guilds->GetGuildName(), Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'guilds')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -86,26 +80,26 @@
$xml->XMLWriter()->writeAttribute('subTab', 'guildBankLog');
$xml->XMLWriter()->writeAttribute('tab', 'guild');
$xml->XMLWriter()->writeAttribute('tabGroup', 'guild');
-$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)) : null);
+$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())) : null);
$xml->XMLWriter()->endElement(); //tabInfo
/** Basic info **/
$guilds->BuildGuildInfo();
$guild_emblem = array(
- 'emblemBackground' => $guilds->bgcolor,
- 'emblemBorderColor' => $guilds->bordercolor,
- 'emblemBorderStyle' => $guilds->borderstyle,
- 'emblemIconColor' => $guilds->emblemcolor,
- 'emblemIconStyle' => $guilds->emblemstyle
+ 'emblemBackground' => $guilds->GetEmblemBGColor(),
+ 'emblemBorderColor' => $guilds->GetBorderColor(),
+ 'emblemBorderStyle' => $guilds->GetBorderStyle(),
+ 'emblemIconColor' => $guilds->GetEmblemColor(),
+ 'emblemIconStyle' => $guilds->GetEmblemStyle()
);
$guild_header = array(
'battleGroup' => Armory::$armoryconfig['defaultBGName'],
'count' => $guilds->CountGuildMembers(),
- 'faction' => $guilds->guildFaction,
- 'name' => $guilds->guildName,
- 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)),
+ 'faction' => $guilds->GetGuildFaction(),
+ 'name' => $guilds->GetGuildName(),
+ 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())),
'realm' => Armory::$currentRealmInfo['name'],
'realmUrl' => urlencode(Armory::$currentRealmInfo['name']),
- 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName))
+ 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName()))
);
$xml->XMLWriter()->startElement('guildInfo');
$xml->XMLWriter()->startElement('guildHeader');
@@ -155,7 +149,7 @@
echo $xml_cache_data;
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
- $cache_data = $utils->GenerateCacheData($guilds->guildName, $guilds->guildId, 'guild-bank-log');
+ $cache_data = $utils->GenerateCacheData($guilds->GetGuildName(), $guilds->GetGuildID(), 'guild-bank-log');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'guilds');
}
exit;
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 456
+ * @revision 483
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -30,13 +30,7 @@
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
-if(isset($_GET['gn'])) {
- $guilds->guildName = $utils->escape($_GET['gn']);
-}
-else {
- $guilds->guildName = false;
-}
-$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
+$isGuild = $guilds->InitGuild($_GET['gn'], Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
@@ -50,8 +44,8 @@
exit;
}
// Get page cache
-if($guilds->guildId > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('guild-info', $guilds->guildName, Armory::$currentRealmInfo['name']);
+if($guilds->GetGuildID() > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
+ $cache_id = $utils->GenerateCacheId('guild-info', $guilds->GetGuildName(), Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'guilds')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -69,7 +63,7 @@
$xml->XMLWriter()->writeAttribute('subTab', 'guildRoster');
$xml->XMLWriter()->writeAttribute('tab', 'guild');
$xml->XMLWriter()->writeAttribute('tabGroup', 'guild');
-$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)) : null);
+$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())) : null);
$xml->XMLWriter()->endElement(); //tabInfo
if(!$isGuild) {
$xml->XMLWriter()->startElement('characterInfo');
@@ -83,21 +77,21 @@
/** Basic info **/
$guilds->BuildGuildInfo();
$guild_emblem = array(
- 'emblemBackground' => $guilds->bgcolor,
- 'emblemBorderColor' => $guilds->bordercolor,
- 'emblemBorderStyle' => $guilds->borderstyle,
- 'emblemIconColor' => $guilds->emblemcolor,
- 'emblemIconStyle' => $guilds->emblemstyle
+ 'emblemBackground' => $guilds->GetEmblemBGColor(),
+ 'emblemBorderColor' => $guilds->GetBorderColor(),
+ 'emblemBorderStyle' => $guilds->GetBorderStyle(),
+ 'emblemIconColor' => $guilds->GetEmblemColor(),
+ 'emblemIconStyle' => $guilds->GetEmblemStyle()
);
$guild_header = array(
'battleGroup' => Armory::$armoryconfig['defaultBGName'],
'count' => $guilds->CountGuildMembers(),
- 'faction' => $guilds->guildFaction,
- 'name' => $guilds->guildName,
- 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)),
+ 'faction' => $guilds->GetGuildFaction(),
+ 'name' => $guilds->GetGuildName(),
+ 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())),
'realm' => Armory::$currentRealmInfo['name'],
'realmUrl' => urlencode(Armory::$currentRealmInfo['name']),
- 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName))
+ 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName()))
);
$xml->XMLWriter()->startElement('guildInfo');
$xml->XMLWriter()->startElement('guildHeader');
@@ -129,7 +123,7 @@
echo $xml_cache_data;
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
- $cache_data = $utils->GenerateCacheData($guilds->guildName, $guilds->guildId, 'guild-info');
+ $cache_data = $utils->GenerateCacheData($guilds->GetGuildName(), $guilds->GetGuildID(), 'guild-info');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'guilds');
}
exit;
View
@@ -3,7 +3,7 @@
/**
* @package World of Warcraft Armory
* @version Release 4.50
- * @revision 456
+ * @revision 483
* @copyright (c) 2009-2011 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
@@ -30,13 +30,7 @@
die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
-if(isset($_GET['gn'])) {
- $guilds->guildName = $utils->escape($_GET['gn']);
-}
-else {
- $guilds->guildName = false;
-}
-$isGuild = $guilds->InitGuild(Armory::$currentRealmInfo['type']);
+$isGuild = $guilds->InitGuild($_GET['gn'], Armory::$currentRealmInfo['type']);
if(!$isGuild) {
// Load XSLT template
$xml->LoadXSLT('error/error.xsl');
@@ -50,8 +44,8 @@
exit;
}
// Get page cache
-if($guilds->guildId > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
- $cache_id = $utils->GenerateCacheId('guild-stats', $guilds->guildName, Armory::$currentRealmInfo['name']);
+if($guilds->GetGuildID() > 0 && $isGuild && Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
+ $cache_id = $utils->GenerateCacheId('guild-stats', $guilds->GetGuildName(), Armory::$currentRealmInfo['name']);
if($cache_data = $utils->GetCache($cache_id, 'guilds')) {
echo $cache_data;
echo sprintf('<!-- Restored from cache; id: %s -->', $cache_id);
@@ -69,26 +63,26 @@
$xml->XMLWriter()->writeAttribute('subTab', 'guildStats');
$xml->XMLWriter()->writeAttribute('tab', 'guild');
$xml->XMLWriter()->writeAttribute('tabGroup', 'guild');
-$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)) : null);
+$xml->XMLWriter()->writeAttribute('tabUrl', ($isGuild) ? sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())) : null);
$xml->XMLWriter()->endElement(); //tabInfo
/** Basic info **/
$guilds->BuildGuildInfo();
$guild_emblem = array(
- 'emblemBackground' => $guilds->bgcolor,
- 'emblemBorderColor' => $guilds->bordercolor,
- 'emblemBorderStyle' => $guilds->borderstyle,
- 'emblemIconColor' => $guilds->emblemcolor,
- 'emblemIconStyle' => $guilds->emblemstyle
+ 'emblemBackground' => $guilds->GetEmblemBGColor(),
+ 'emblemBorderColor' => $guilds->GetBorderColor(),
+ 'emblemBorderStyle' => $guilds->GetBorderStyle(),
+ 'emblemIconColor' => $guilds->GetEmblemColor(),
+ 'emblemIconStyle' => $guilds->GetEmblemStyle()
);
$guild_header = array(
'battleGroup' => Armory::$armoryconfig['defaultBGName'],
'count' => $guilds->CountGuildMembers(),
- 'faction' => $guilds->guildFaction,
- 'name' => $guilds->guildName,
- 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName)),
+ 'faction' => $guilds->GetGuildFaction(),
+ 'name' => $guilds->GetGuildName(),
+ 'nameUrl' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName())),
'realm' => Armory::$currentRealmInfo['name'],
'realmUrl' => urlencode(Armory::$currentRealmInfo['name']),
- 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->guildName))
+ 'url' => sprintf('r=%s&gn=%s', urlencode(Armory::$currentRealmInfo['name']), urlencode($guilds->GetGuildName()))
);
$xml->XMLWriter()->startElement('guildInfo');
$xml->XMLWriter()->startElement('guildHeader');
@@ -120,7 +114,7 @@
echo $xml_cache_data;
if(Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
// Write cache to file
- $cache_data = $utils->GenerateCacheData($guilds->guildName, $guilds->guildId, 'guild-stats');
+ $cache_data = $utils->GenerateCacheData($guilds->GetGuildName(), $guilds->GetGuildID(), 'guild-stats');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data, 'guilds');
}
exit;
Oops, something went wrong.

0 comments on commit 8c31eca

Please sign in to comment.