Skip to content

Commit

Permalink
[192] Partly move SQL queries to classes; MaNGOS core patches updated…
Browse files Browse the repository at this point in the history
… to 9885 revision
  • Loading branch information
Shadez committed May 13, 2010
1 parent 312853e commit ed5cbb7
Show file tree
Hide file tree
Showing 22 changed files with 318 additions and 312 deletions.
6 changes: 3 additions & 3 deletions achievement-firsts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 186
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -42,7 +42,7 @@
$xml->XMLWriter()->writeAttribute('lang', $armory->_locale);
$xml->XMLWriter()->writeAttribute('requestUrl', 'achievement-firsts.xml');
$realmName = (isset($_GET['r'])) ? urldecode($_GET['r']) : $armory->currentRealmInfo['name'];
$isRealm = $armory->aDB->selectCell("SELECT `id` FROM `armory_realm_data` WHERE `name`=?", $realmName);
$isRealm = $utils->IsRealm($realmName);
if($isRealm) {
$xml->XMLWriter()->startElement('realmInfo');
$xml->XMLWriter()->writeAttribute('realm', $realmName);
Expand Down
20 changes: 12 additions & 8 deletions battlegroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 122
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -40,17 +40,21 @@
'display' => $armory->armoryconfig['defaultBGName'],
'ladderUrl' => sprintf('b=%s', urlencode($armory->armoryconfig['defaultBGName'])),
'name' => strtolower($armory->armoryconfig['defaultBGName']),
'sortPosition' => '1'
'sortPosition' => 1
);
foreach($current_BG as $bg_key => $bg_value) {
$xml->XMLWriter()->writeAttribute($bg_key, $bg_value);
}
$xml->XMLWriter()->startElement('realms');
$xml->XMLWriter()->startElement('realm');
$xml->XMLWriter()->writeAttribute('name', $armory->armoryconfig['defaultRealmName']);
$xml->XMLWriter()->writeAttribute('nameEn', $armory->armoryconfig['defaultRealmName']);
$xml->XMLWriter()->writeAttribute('nameUrl', urlencode($armory->armoryconfig['defaultRealmName']));
$xml->XMLWriter()->endElement(); //realm
if(is_array($armory->realmData)) {
foreach($armory->realmData as $realm) {
$xml->XMLWriter()->startElement('realm');
$xml->XMLWriter()->writeAttribute('name', $realm['name']);
$xml->XMLWriter()->writeAttribute('nameEn', $realm['name']);
$xml->XMLWriter()->writeAttribute('nameUrl', 'r='.urlencode($realm['name']));
$xml->XMLWriter()->endElement(); //realm
}
}
$xml->XMLWriter()->endElement(); //realms
$xml->XMLWriter()->endElement(); //battlegroup
$xml->XMLWriter()->endElement(); //battlegroups
Expand Down
135 changes: 64 additions & 71 deletions character-achievements.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 168
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -76,76 +76,74 @@
$xml->XMLWriter()->startElement('achievements');
$xml->XMLWriter()->writeAttribute('lang', $armory->_locale);
$xml->XMLWriter()->writeAttribute('requestUrl', 'character-achievements.xml');

$xml->XMLWriter()->startElement('category');
$faction = ($characters->faction == 1) ? 0 : 1;
$achievements_page = $achievements->LoadAchievementPage($achievement_category, $faction);
//print_r($achievements_list);
$i = 0;
if(isset($achievements_page['completed'])) {
foreach($achievements_page['completed'] as $achievement) {
if($achievement['display'] == 0) {
continue;
}
$xml->XMLWriter()->startElement('achievement');
if(isset($achievement['data'])) {
foreach($achievement['data'] as $a_data_key => $a_data_value) {
$xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value);
}
if(isset($achievements_page['completed'])) {
foreach($achievements_page['completed'] as $achievement) {
if($achievement['display'] == 0) {
continue;
}
$xml->XMLWriter()->startElement('achievement');
if(isset($achievement['data'])) {
foreach($achievement['data'] as $a_data_key => $a_data_value) {
$xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value);
}
if(isset($achievement['criteria']) && is_array($achievement['criteria'])) {
foreach($achievement['criteria'] as $criteria) {
$xml->XMLWriter()->startElement('criteria');
foreach($criteria as $c_key => $c_value) {
$xml->XMLWriter()->writeAttribute($c_key, $c_value);
}
$xml->XMLWriter()->endElement(); //criteria
}
if(isset($achievement['criteria']) && is_array($achievement['criteria'])) {
foreach($achievement['criteria'] as $criteria) {
$xml->XMLWriter()->startElement('criteria');
foreach($criteria as $c_key => $c_value) {
$xml->XMLWriter()->writeAttribute($c_key, $c_value);
}
$xml->XMLWriter()->endElement(); //criteria
}
if(isset($achievement['achievement_tree'])) {
foreach($achievement['achievement_tree'] as $achievement_tree) {
$xml->XMLWriter()->startElement('achievement');
foreach($achievement_tree as $a_tree_key => $a_tree_value) {
$xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value);
}
$xml->XMLWriter()->endElement(); //achievement
}
if(isset($achievement['achievement_tree'])) {
foreach($achievement['achievement_tree'] as $achievement_tree) {
$xml->XMLWriter()->startElement('achievement');
foreach($achievement_tree as $a_tree_key => $a_tree_value) {
$xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value);
}
$xml->XMLWriter()->endElement(); //achievement
}
$xml->XMLWriter()->endElement(); //achievement
}
$xml->XMLWriter()->endElement(); //achievement
}
if(isset($achievements_page['incompleted'])) {
foreach($achievements_page['incompleted'] as $achievement) {
if(isset($achievement['display']) && $achievement['display'] == 0) {
continue;
}
$xml->XMLWriter()->startElement('achievement');
if(isset($achievement['data'])) {
foreach($achievement['data'] as $a_data_key => $a_data_value) {
$xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value);
}
}
if(isset($achievements_page['incompleted'])) {
foreach($achievements_page['incompleted'] as $achievement) {
if(isset($achievement['display']) && $achievement['display'] == 0) {
continue;
}
$xml->XMLWriter()->startElement('achievement');
if(isset($achievement['data'])) {
foreach($achievement['data'] as $a_data_key => $a_data_value) {
$xml->XMLWriter()->writeAttribute($a_data_key, $a_data_value);
}
if(isset($achievement['criteria']) && is_array($achievement['criteria'])) {
foreach($achievement['criteria'] as $criteria) {
$xml->XMLWriter()->startElement('criteria');
foreach($criteria as $c_key => $c_value) {
$xml->XMLWriter()->writeAttribute($c_key, $c_value);
}
$xml->XMLWriter()->endElement(); //criteria
}
if(isset($achievement['criteria']) && is_array($achievement['criteria'])) {
foreach($achievement['criteria'] as $criteria) {
$xml->XMLWriter()->startElement('criteria');
foreach($criteria as $c_key => $c_value) {
$xml->XMLWriter()->writeAttribute($c_key, $c_value);
}
$xml->XMLWriter()->endElement(); //criteria
}
if(isset($achievement['achievement_tree'])) {
foreach($achievement['achievement_tree'] as $achievement_tree) {
$xml->XMLWriter()->startElement('achievement');
foreach($achievement_tree as $a_tree_key => $a_tree_value) {
$xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value);
}
$xml->XMLWriter()->endElement(); //achievement
}
if(isset($achievement['achievement_tree'])) {
foreach($achievement['achievement_tree'] as $achievement_tree) {
$xml->XMLWriter()->startElement('achievement');
foreach($achievement_tree as $a_tree_key => $a_tree_value) {
$xml->XMLWriter()->writeAttribute($a_tree_key, $a_tree_value);
}
$xml->XMLWriter()->endElement(); //achievement
}
$xml->XMLWriter()->endElement(); //achievement
}
$xml->XMLWriter()->endElement(); //achievement
}
}
$xml->XMLWriter()->endElement(); //category
$xml->XMLWriter()->endElement(); //achievements
$xml_cache_data = $xml->StopXML();
Expand All @@ -154,13 +152,9 @@
// Write cache to file
$cache_data = $utils->GenerateCacheData($characters->name, $characters->guid, 'character-achievements');
$cache_handler = $utils->WriteCache($cache_id, $cache_data, $xml_cache_data);
if($cache_handler != 0x01) {
echo sprintf('<!-- Error occured while cache write: %s -->', $cache_handler); //debug
}
}
exit;
}

/** Basic info **/
$tabUrl = false;
$guilds->guid = $characters->guid;
Expand Down Expand Up @@ -199,13 +193,13 @@
'class' => $characters->returnClassText(),
'classId' => $characters->class,
'classUrl' => sprintf('c='),
'faction' => '',
'faction' => null,
'factionId' => $characters->GetCharacterFaction(),
'gender' => '',
'gender' => null,
'genderId' => $characters->gender,
'guildName' => ($guilds->guid) ? $guilds->guildName : '',
'guildUrl' => ($guilds->guid) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : '',
'lastModified' => '',
'guildName' => ($guilds->guid) ? $guilds->guildName : null,
'guildUrl' => ($guilds->guid) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : null,
'lastModified' => null,
'level' => $characters->level,
'name' => $characters->name,
'points' => $achievements->CalculateAchievementPoints(),
Expand All @@ -221,8 +215,8 @@
foreach($character_element as $c_elem_name => $c_elem_value) {
$xml->XMLWriter()->writeAttribute($c_elem_name, $c_elem_value);
}
$xml->XMLWriter()->endElement(); //character
$xml->XMLWriter()->endElement(); //characterInfo
$xml->XMLWriter()->endElement(); //character
$xml->XMLWriter()->endElement(); //characterInfo
$xml->XMLWriter()->startElement('achievements');
$xml->XMLWriter()->startElement('summary');
$xml->XMLWriter()->startElement('c');
Expand All @@ -232,7 +226,7 @@
$xml->XMLWriter()->writeAttribute($info_key, $info_value);
}
}
$xml->XMLWriter()->endElement(); //c
$xml->XMLWriter()->endElement(); //c
$info_categories = array(92, 96, 97, 95, 168, 169, 201, 155, 81);
foreach($info_categories as $achievement_category) {
$xml->XMLWriter()->startElement('category');
Expand All @@ -242,7 +236,7 @@
foreach($current_category as $category_key => $category_value) {
$xml->XMLWriter()->writeAttribute($category_key, $category_value);
}
$xml->XMLWriter()->endElement(); //c
$xml->XMLWriter()->endElement(); //c
}
$xml->XMLWriter()->endElement(); //category
}
Expand All @@ -259,8 +253,7 @@
}
}
}
$xml->XMLWriter()->endElement(); //summary

$xml->XMLWriter()->endElement(); //summary
// root
$xml->XMLWriter()->startElement('rootCategories');
$root_categories = $achievements->BuildCategoriesTree();
Expand All @@ -278,8 +271,8 @@
}
$xml->XMLWriter()->endElement(); //category
}
$xml->XMLWriter()->endElement(); //rootCategories
$xml->XMLWriter()->endElement(); //achievements
$xml->XMLWriter()->endElement(); //rootCategories
$xml->XMLWriter()->endElement(); //achievements
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
Expand Down
16 changes: 8 additions & 8 deletions character-arenateams.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 168
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -83,7 +83,7 @@
if(!$isCharacter) {
$xml->XMLWriter()->startElement('characterInfo');
$xml->XMLWriter()->writeAttribute('errCode', 'noCharacter');
$xml->XMLWriter()->endElement(); // characterInfo
$xml->XMLWriter()->endElement(); //characterInfo
$xml->XMLWriter()->endElement(); //page
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
Expand All @@ -97,13 +97,13 @@
'class' => $characters->returnClassText(),
'classId' => $characters->class,
'classUrl' => sprintf('c='),
'faction' => '',
'faction' => null,
'factionId' => $characters->GetCharacterFaction(),
'gender' => '',
'gender' => null,
'genderId' => $characters->gender,
'guildName' => ($guilds->guildName) ? $guilds->guildName : '',
'guildUrl' => ($guilds->guildName) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : '',
'lastModified' => '',
'guildName' => ($guilds->guildName) ? $guilds->guildName : null,
'guildUrl' => ($guilds->guildName) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : null,
'lastModified' => null,
'level' => $characters->level,
'name' => $characters->name,
'points' => $achievements->CalculateAchievementPoints(),
Expand Down
14 changes: 7 additions & 7 deletions character-calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 168
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -96,13 +96,13 @@
'class' => $characters->returnClassText(),
'classId' => $characters->class,
'classUrl' => sprintf('c='),
'faction' => '',
'faction' => null,
'factionId' => $characters->GetCharacterFaction(),
'gender' => '',
'gender' => null,
'genderId' => $characters->gender,
'guildName' => ($guilds->guid) ? $guilds->guildName : '',
'guildUrl' => ($guilds->guid) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : '',
'lastModified' => '',
'guildName' => ($guilds->guid) ? $guilds->guildName : null,
'guildUrl' => ($guilds->guid) ? sprintf('r=%s&gn=%s', urlencode($armory->currentRealmInfo['name']), urlencode($guilds->guildName)) : null,
'lastModified' => null,
'level' => $characters->level,
'name' => $characters->name,
'points' => $achievements->CalculateAchievementPoints(),
Expand Down
10 changes: 5 additions & 5 deletions character-feed-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @package World of Warcraft Armory
* @version Release Candidate 1
* @revision 163
* @copyright (c) 2009-2010 Shadez
* @revision 192
* @copyright (c) 2009-2010 Shadez
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -84,12 +84,12 @@
if(isset($feed_item['title'])) {
$xml->XMLWriter()->startElement('title');
$xml->XMLWriter()->writeRaw($feed_item['title']);
$xml->XMLWriter()->endElement(); //title
$xml->XMLWriter()->endElement(); //title
}
if(isset($feed_item['desc'])) {
$xml->XMLWriter()->startElement('desc');
$xml->XMLWriter()->writeRaw($feed_item['desc']);
$xml->XMLWriter()->endElement(); //desc
$xml->XMLWriter()->endElement(); //desc
}
if(isset($feed_item['tooltip'])) {
$xml->XMLWriter()->startElement('tooltip');
Expand All @@ -99,7 +99,7 @@
$xml->XMLWriter()->endElement(); //event
}
}
$xml->XMLWriter()->endElement(); //feed
$xml->XMLWriter()->endElement(); //feed
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if($armory->armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
Expand Down
Loading

0 comments on commit ed5cbb7

Please sign in to comment.