public static function LoadTemplate($template_name, $overall = false)
 {
     if ($overall) {
         $template = __ARMORYDIRECTORY__ . '/admin/template/overall/overall_' . $template_name . '.php';
     } else {
         $template = __ARMORYDIRECTORY__ . '/admin/template/' . $template_name . '.php';
     }
     if (file_exists($template)) {
         include $template;
     } else {
         Armory::Log()->writeError('%s : unable to find template "%s" (template theme: %s, overall: %d, path: %s)!', __METHOD__, $template_name, self::GetTemplateTheme(), (int) $overall, $template);
     }
 }
Beispiel #2
0
 /**
  * Build opponents list for current arena team
  * @category Arenateams class
  * @access   public
  * @return   array
  **/
 public function BuildOpposingTeamList()
 {
     if (!$this->arenateamid) {
         Armory::Log()->writeError('%s : arenateamid not provided', __METHOD__);
         return false;
     }
     $game_ids = Armory::$cDB->select("SELECT DISTINCT `gameid` FROM `armory_game_chart` WHERE `teamid`=%d", $this->arenateamid);
     if (!$game_ids) {
         Armory::Log()->writeLog('%s : unable to find any game for teamId %d', __METHOD__, $this->arenateamid);
         return false;
     }
     $all_games = array();
     $counter = count($game_ids);
     foreach ($game_ids as $game) {
         $all_games[] = $game['gameid'];
     }
     $game_chart = Armory::$cDB->select("\n        SELECT\n        `armory_game_chart`.`gameid`,\n        `armory_game_chart`.`teamid`,\n        `armory_game_chart`.`guid`,\n        COUNT(`armory_game_chart`.`teamid`) AS `countTeam`,\n        `arena_team`.`name`,\n        `arena_team`.`type`\n        FROM `armory_game_chart` AS `armory_game_chart`\n        LEFT JOIN `arena_team` AS `arena_team` ON `arena_team`.`arenateamid`=`armory_game_chart`.`teamid`\n        WHERE `armory_game_chart`.`gameid` IN (%s) AND `armory_game_chart`.`teamid` <> %d\n        GROUP BY `armory_game_chart`.`gameid`", $all_games, $this->arenateamid);
     if (!$game_chart) {
         Armory::Log()->writeError('%s : game_ids were fetched from DB, but script was unable to get data for these matches from characters DB (arenateamid:%d)', __METHOD__, $this->arenateamid);
         return false;
     }
     $chart_data = array();
     foreach ($game_chart as $team) {
         if (!isset($chart_data[$team['teamid']])) {
             // Do not add same teams more than 1 time
             $rating_change = Armory::$cDB->select("SELECT `gameid`, `changeType`, `ratingChange` FROM `armory_game_chart` WHERE `teamid`=%d AND `gameid` IN (%s)", $team['teamid'], $all_games);
             $rd = 0;
             if ($rating_change) {
                 $exists = array();
                 foreach ($rating_change as $rCh) {
                     if (!isset($exists[$rCh['gameid']])) {
                         if ($rCh['changeType'] == 1) {
                             $rd += $rCh['ratingChange'];
                         } else {
                             $rd -= $rCh['ratingChange'];
                         }
                         $exists[$rCh['gameid']] = true;
                     }
                 }
             }
             $losses = Armory::$cDB->selectCell("SELECT COUNT(distinct(`gameid`)) FROM `armory_game_chart` WHERE `changeType`=1 AND `teamid`='%d' AND `gameid` IN (%s)", $team['teamid'], $all_games);
             $wins = Armory::$cDB->selectCell("SELECT COUNT(distinct(`gameid`)) FROM `armory_game_chart` WHERE `changeType`=2 AND `teamid`='%d' AND `gameid` IN (%s)", $team['teamid'], $all_games);
             $chart_data[$team['teamid']] = array('deleted' => $this->TeamExists($team['teamid']) ? 'false' : 'true', 'games' => $losses + $wins, 'losses' => $losses, 'rd' => $rd, 'realm' => Armory::$currentRealmInfo['name'], 'teamName' => $team['name'], 'teamUrl' => sprintf("r=%s&ts=%d&t=%s", urlencode(Armory::$currentRealmInfo['name']), $team['type'], urlencode($team['name'])), 'wins' => $wins);
             $chart_data[$team['teamid']]['winPer'] = Utils::GetPercent($chart_data[$team['teamid']]['games'], $chart_data[$team['teamid']]['wins']);
         }
     }
     return $chart_data;
 }
Beispiel #3
0
 /**
  * @return array
  **/
 public function GetRandomSuffixData()
 {
     if ($this->m_server != SERVER_MANGOS) {
         Armory::Log()->writeError('%s : this method is usable with MaNGOS servers only.', __METHOD__);
         return false;
     }
     return array($this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_8_1), $this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_9_1), $this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_10_1));
 }
Beispiel #4
0
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **/
if (!defined('__ARMORY__')) {
    die('Direct access to this file not allowed!');
}
session_start();
if (!@(include 'classes/class.armory.php')) {
    die('<b>Error:</b> unable to load Armory class!');
}
if (!@(include 'revision_nr.php')) {
    die('<b>Error:</b> unable to load revision_nr.php!');
}
$_SESSION['last_url'] = str_replace('.php', '.xml', $_SERVER['PHP_SELF']) . '?' . str_replace('locale=', 'l=', $_SERVER['QUERY_STRING']);
$armory = new Armory();
/* Check DbVersion */
$dbVersion = $armory->aDB->selectCell("SELECT `version` FROM `ARMORYDBPREFIX_db_version`");
if ($dbVersion != DB_VERSION) {
    if (!$dbVersion) {
        if (isset($armory->armoryconfig['checkVersionType']) && $armory->armoryconfig['checkVersionType'] == 'log') {
            $armory->Log()->writeError('ArmoryChecker: wrong Armory DB name!');
        } else {
            echo '<b>Fatal error</b>: wrong Armory DB name<br/>';
        }
    }
    $errorDBVersion = sprintf('Current version is %s but expected %s.<br />
    Apply all neccessary updates from \'sql/updates\' folder and refresh this page.', $dbVersion ? "'" . $dbVersion . "'" : 'not defined', "'" . DB_VERSION . "'");
    if (isset($armory->armoryconfig['checkVersionType']) && $armory->armoryconfig['checkVersionType'] == 'log') {
        $armory->Log()->writeError('ArmoryChecker : DB_VERSION error: %s', defined('DB_VERSION') ? $errorDBVersion : 'DB_VERSION constant not defined!');
    } else {
Beispiel #5
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **/
define('__ARMORY__', true);
if (!@(include 'includes/armory_loader.php')) {
    die('<b>Fatal error:</b> unable to load system files.');
}
header('Content-type: text/xml');
$page_element = array('globalSearch' => 1, 'lang' => Armory::GetLocale(), 'requestUrl' => 'login-status.xml');
$xml->XMLWriter()->startElement('page');
foreach ($page_element as $page_key => $page_value) {
    $xml->XMLWriter()->writeAttribute($page_key, $page_value);
}
$xml->XMLWriter()->startElement('loginStatus');
if (isset($_SESSION['username'])) {
    $xml->XMLWriter()->writeAttribute('username', $_SESSION['username']);
} else {
    $xml->XMLWriter()->writeAttribute('username', null);
}
$xml->XMLWriter()->endElement();
//loginStatus
$xml->XMLWriter()->endElement();
//page
echo $xml->StopXML();
Beispiel #6
0
 /**
  * Returns server type ID
  * @category Utils class
  * @access   public
  * @param    string $server
  * @return   int
  **/
 public function GetServerTypeByString($server)
 {
     $server = strtolower($server);
     if ($server == 'mangos') {
         return SERVER_MANGOS;
     } elseif ($server == 'trinity') {
         return SERVER_TRINITY;
     }
     Armory::Log()->writeError('%s : unsupported server type ("%s")!', __METHOD__, $server);
     return UNK_SERVER;
 }
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 **/
define('__ARMORY__', true);
define('__ARMORYDIRECTORY__', dirname(dirname(__FILE__)));
if (!@(include __ARMORYDIRECTORY__ . '/includes/classes/class.armory.php')) {
    die('<b>Error:</b> unable to load Armory class!');
}
$update_type = 'echo';
// Change to 'echo' to show query in you browser. Or choose 'update' to execute all queries directly to DB.
Armory::InitializeArmory();
echo '<title>World of Warcraft Armory</title>';
$check_builded = Armory::$aDB->selectCell("SELECT `loot_builded` FROM `ARMORYDBPREFIX_db_version`");
if ($check_builded === 1) {
    die("You've already builded loot tables for bosses. If you want to re-build list, change field `loot_builded` to 0 in `armory_db_version` table: <br /><code>UPDATE `armory_db_version` SET `loot_builded`=0;</code>");
}
// Select all ids
$instance_data = Armory::$aDB->select("SELECT `id`, `name_id`, `type` FROM `ARMORYDBPREFIX_instance_data`");
if (!$instance_data) {
    die('Error: can not find any boss data!');
}
foreach ($instance_data as $data) {
    switch ($data['type']) {
        case 'npc':
            if (isset($data['name_id']) && $data['name_id'] > 0) {
                $data['id'] = $data['name_id'];
Beispiel #8
0
    if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.arenateams.php')) {
        die('<b>Error:</b> unable to load arenateams class!');
    }
    $arenateams = new Arenateams();
}
if (defined('load_search_class')) {
    if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.search.php')) {
        die('<b>Error:</b> unable to load search engine class!');
    }
    $search = new SearchMgr();
}
if (defined('load_itemprototype_class')) {
    if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.itemprototype.php')) {
        die('<b>Error:</b> unable to load ItemPrototype class!');
    }
    // Do not create class instance here. It should be created in Characters or Items classes.
}
if (defined('load_item_class')) {
    if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.item.php')) {
        die('<b>Error:</b> unable to load Item class!');
    }
    // Do not create class instance here. It should be created in Characters or Items classes.
}
// Start XML parser
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.xmlhandler.php')) {
    die('<b>Error:</b> unable to load XML Handler class!');
}
$xml = new XMLHandler(Armory::GetLocale());
if (!defined('RSS_FEED')) {
    $xml->StartXML();
}
Beispiel #9
0
    $xml->XMLWriter()->writeAttribute('name', Armory::$aDB->selectCell("SELECT `name_" . Armory::GetLocale() . "` FROM `ARMORYDBPREFIX_petcalc` WHERE `id` < 0 AND `key`='tenacity'"));
    $xml->XMLWriter()->writeAttribute('order', 1);
    $pet_tenacity = $utils->GetPetTalentCalculatorData('tenacity');
    foreach ($pet_tenacity as $tenacity) {
        $xml->XMLWriter()->startElement('family');
        foreach ($tenacity as $tenacity_key => $tenacity_value) {
            $xml->XMLWriter()->writeAttribute($tenacity_key, $tenacity_value);
        }
        $xml->XMLWriter()->endElement();
        //family
    }
    $xml->XMLWriter()->endElement();
    //petTalentTab
    $xml->XMLWriter()->startElement('petTalentTab');
    $xml->XMLWriter()->writeAttribute('key', 'Ferocity');
    $xml->XMLWriter()->writeAttribute('name', Armory::$aDB->selectCell("SELECT `name_" . Armory::GetLocale() . "` FROM `ARMORYDBPREFIX_petcalc` WHERE `id` < 0 AND `key`='ferocity'"));
    $xml->XMLWriter()->writeAttribute('order', 0);
    $pet_ferocity = $utils->GetPetTalentCalculatorData('ferocity');
    foreach ($pet_ferocity as $ferocity) {
        $xml->XMLWriter()->startElement('family');
        foreach ($ferocity as $ferocity_key => $ferocity_value) {
            $xml->XMLWriter()->writeAttribute($ferocity_key, $ferocity_value);
        }
        $xml->XMLWriter()->endElement();
        //family
    }
    $xml->XMLWriter()->endElement();
    //petTalentTab
}
$xml->XMLWriter()->endElement();
//talentTabs or petTalentTabs
Beispiel #10
0
 /**
  * Sets locale
  * @category Armory class
  * @access   public
  * @return   bool
  **/
 public static function SetLocale($locale, $locale_id)
 {
     self::$_locale = $locale;
     self::$_loc = $locale_id;
     return true;
 }
 protected function _query($safe_sql, $queryType)
 {
     // Execute query and calculate execution time
     $make_array = array();
     $query_start = microtime(true);
     $this->queryCount++;
     $performed_query = mysql_query($safe_sql, $this->connectionLink);
     if (!$performed_query) {
         if (!$this->disableNextError) {
             Armory::Log()->writeLog('%s : unable to execute SQL query (%s). MySQL error: %s', __METHOD__, $safe_sql, mysql_error($this->connectionLink) ? sprintf('"%s" (Error #%d)', mysql_error($this->connectionLink), mysql_errno($this->connectionLink)) : 'none');
         }
         if ($this->disableNextError) {
             $this->disableNextError = false;
         }
         return false;
     }
     $result = false;
     switch ($queryType) {
         case QueryType::SINGLE_CELL:
             $row = mysql_fetch_row($performed_query);
             $result = $row[0];
             break;
         case QueryType::SINGLE_ROW:
             $result = mysql_fetch_assoc($performed_query);
             if (is_array($result)) {
                 foreach ($result as $rKey => $rValue) {
                     if (is_string($rKey)) {
                         $make_array[$rKey] = $rValue;
                     }
                 }
                 $result = $make_array;
             }
             break;
         case QueryType::MULTIPLY_ROW:
             $result = array();
             while ($_result = mysql_fetch_assoc($performed_query)) {
                 if (is_array($_result)) {
                     foreach ($_result as $rKey => $rValue) {
                         if (is_string($rKey)) {
                             $make_array[$rKey] = $rValue;
                         }
                     }
                     $result[] = $make_array;
                 } else {
                     $result[] = $_result;
                 }
             }
             break;
         case QueryType::OBJECT_QUERY:
             $result = array();
             while ($_result = mysql_fetch_object($performed_query)) {
                 $result[] = $_result;
             }
             break;
         case QueryType::SQL_QUERY:
             $result = true;
             break;
         default:
             $result = false;
             break;
     }
     $query_end = microtime(true);
     $queryTime = round($query_end - $query_start, 4);
     Armory::Log()->writeSql('[%s ms]: %s', $queryTime, $safe_sql);
     $this->queryTimeGeneration += $queryTime;
     return $result;
 }
Beispiel #12
0
$xml->LoadXSLT('items/info.xsl');
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'item-info.xml');
$xml->XMLWriter()->writeAttribute('requestQuery', 'i=' . $itemID);
if (!$items->IsItemExists($itemID)) {
    $xml->XMLWriter()->startElement('itemInfo');
    $xml->XMLWriter()->endElement();
    //itemInfo
    echo $xml->StopXML();
    exit;
}
// Do not query all rows - item data generated by item-tooltip.php
$data = $items->GetItemData($itemID);
$item_data = array('icon' => $items->GetItemIcon($itemID, $data['displayid']), 'id' => $itemID, 'level' => $data['ItemLevel'], 'name' => Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'en_us' ? $data['name'] : $items->GetItemName($itemID), 'quality' => $data['Quality'], 'type' => null);
$xml->XMLWriter()->startElement('itemInfo');
$xml->XMLWriter()->startElement('item');
foreach ($item_data as $item_data_key => $item_data_value) {
    $xml->XMLWriter()->writeAttribute($item_data_key, $item_data_value);
}
$extended_cost = $mangos->GetVendorExtendedCost($itemID);
if ($data['SellPrice'] > 0 || $data['BuyPrice'] || $extended_cost > 0) {
    $xml->XMLWriter()->startElement('cost');
    if ($data['SellPrice'] > 0) {
        $xml->XMLWriter()->writeAttribute('sellPrice', $data['SellPrice']);
    }
    if ($data['BuyPrice'] > 0 && $items->IsVendorItem($itemID)) {
        $xml->XMLWriter()->writeAttribute('buyPrice', $data['BuyPrice']);
    }
    $cost_info = $mangos->GetExtendedCost($extended_cost);
 protected function ConvertArray($source)
 {
     if (!is_array($source)) {
         Armory::Log()->writeError('%s : source must have array type!', __METHOD__);
         return null;
     }
     $returnString = null;
     $count = count($source);
     for ($i = 0; $i < $count; $i++) {
         if (!isset($source[$i])) {
             continue;
         }
         if ($i) {
             $returnString .= ", '" . $this->SanitizeString($source[$i]) . "'";
         } else {
             $returnString .= "'" . $this->SanitizeString($source[$i]) . "'";
         }
     }
     return $returnString;
 }
    $xml->XMLWriter()->endElement();
    //title
    $xml->XMLWriter()->startElement('updated');
    $xml->XMLWriter()->text($fdate);
    $xml->XMLWriter()->endElement();
    //updated
    $xml->XMLWriter()->startElement('published');
    $xml->XMLWriter()->text($fdate);
    $xml->XMLWriter()->endElement();
    //published
    $xml->XMLWriter()->startElement('id');
    $xml->XMLWriter()->text(sprintf('%s@%s_%s_%s', strtolower(urlencode($characters->GetName())), strtolower(urlencode($characters->GetRealmName())), $feed['hard_data'], date('dmYHis', $feed['hard_date'])));
    $xml->XMLWriter()->endElement();
    //id
    $xml->XMLWriter()->startElement('link');
    $xml->XMLWriter()->writeAttribute('href', sprintf('character-feed.xml?r=%s&cn=%s&locale=%s', urldecode($characters->GetRealmName()), urldecode($characters->GetName()), Armory::GetLocale()));
    $xml->XMLWriter()->endElement();
    //link
    $xml->XMLWriter()->startElement('content');
    $xml->XMLWriter()->writeAttribute('type', 'html');
    $xml->XMLWriter()->writeCData($feed['desc']);
    $xml->XMLWriter()->endElement();
    //content
    $xml->XMLWriter()->endElement();
    //entry
}
$xml->XMLWriter()->endElement();
//feed
$xml_cache_data = $xml->StopXML();
echo $xml_cache_data;
if (Armory::$armoryconfig['useCache'] == true && !isset($_GET['skipCache'])) {
 private function GenerateAchievements()
 {
     if (!is_array($this->achievements_storage)) {
         Armory::Log()->writeError('%s : unable to generate achievements ID: achievements storage is empty!', __METHOD__);
         return false;
     }
     $this->achievements_id = array();
     $ach_storage = array();
     $criterias_storage = array();
     $latest_count = 0;
     foreach ($this->achievements_storage as $achievement) {
         if ($latest_count < 6) {
             $this->latest_achievements[] = $achievement;
             $latest_count++;
         }
         $ach_storage[$achievement['achievement']] = $achievement;
         $this->achievements_id[] = $achievement['achievement'];
     }
     foreach ($this->achievements_progress_storage as $criteria) {
         $criterias_storage[$criteria['criteria']] = $criteria;
     }
     $this->achievements_storage = $ach_storage;
     $this->achievements_progress_storage = $criterias_storage;
     unset($ach_storage, $criterias_storage);
     return true;
 }
 public function LoadItem($item_entry, $itemGuid = 0, $ownerGuid = 0)
 {
     $item_row = Armory::$wDB->selectRow("SELECT * FROM `item_template` WHERE `entry` = '%d' LIMIT 1", $item_entry);
     if (!$item_row) {
         Armory::Log()->writeError('%s : item #%d (GUID: %d) was not found in `item_template` table.', __METHOD__, $item_entry, $itemGuid);
         return false;
     }
     // FlagsExtra check
     if (isset($item_row['FlagsExtra'])) {
         $item_row['Flags2'] = $item_row['FlagsExtra'];
         unset($item_row['FlagsExtra']);
         // For compatibility
     }
     // Assign variables
     foreach ($item_row as $field => $value) {
         $this->{$field} = $value;
     }
     // Create arrays
     // Item mods
     for ($i = 0; $i < MAX_ITEM_PROTO_STATS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'stat_type' . $key})) {
             $this->ItemStat[$i] = array('type' => $this->{'stat_type' . $key}, 'value' => $this->{'stat_value' . $key});
         }
     }
     // Item damages
     for ($i = 0; $i < MAX_ITEM_PROTO_DAMAGES + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'dmg_type' . $key})) {
             $this->Damage[$i] = array('type' => $this->{'dmg_type' . $key}, 'min' => $this->{'dmg_min' . $key}, 'max' => $this->{'dmg_max' . $key});
         }
     }
     // Item spells
     for ($i = 0; $i < MAX_ITEM_PROTO_SPELLS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'spellid_' . $key})) {
             $this->Spells[$i] = array('spellid' => $this->{'spellid_' . $key}, 'trigger' => $this->{'spelltrigger_' . $key}, 'charges' => $this->{'spellcharges_' . $key}, 'ppmRate' => $this->{'spellppmRate_' . $key}, 'cooldown' => $this->{'spellcooldown_' . $key}, 'category' => $this->{'spellcategory_' . $key}, 'categorycooldown' => $this->{'spellcategorycooldown_' . $key});
         }
     }
     // Item sockets
     for ($i = 0; $i < MAX_ITEM_PROTO_SOCKETS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'socketColor_' . $key})) {
             $this->Socket[$i] = array('color' => $this->{'socketColor_' . $key}, 'content' => $this->{'socketContent_' . $key});
         }
     }
     $this->m_guid = $itemGuid;
     // Can have NULL value.
     $this->m_owner = $ownerGuid;
     // Can have NULL value.
     $this->loaded = true;
     return true;
 }
Beispiel #17
0
 /**
  * Returns array with guild rank IDs.
  * @category Guilds class
  * @access   public
  * @return   array
  **/
 public function GetGuildRanks()
 {
     if (!$this->guildId) {
         Armory::Log()->writeError('%s : guildId not defined', __METHOD__);
         return false;
     }
     return Armory::$cDB->select("SELECT `rid` AS `id`, `rname` AS `name` FROM `guild_rank` WHERE `guildid`=%d", $this->guildId);
 }
Beispiel #18
0
 /**
  * Returns extended cost info for $costId cost.
  * @category Mangos class
  * @access   public
  * @param    int $costId
  * @return   array
  **/
 public function GetExtendedCost($costId)
 {
     if ($costId == 0) {
         return false;
     }
     if ($costId < 0) {
         $costId = abs($costId);
     }
     $costInfo = Armory::$aDB->selectRow("SELECT * FROM `ARMORYDBPREFIX_extended_cost` WHERE `id`=%d LIMIT 1", $costId);
     if (!$costInfo) {
         Armory::Log()->writeError('%s : wrong cost id: #%d', __METHOD__, $costId);
         return false;
     }
     $extended_cost = array();
     for ($i = 1; $i < 6; $i++) {
         if ($costInfo['item' . $i] > 0) {
             $extended_cost[$i]['count'] = $costInfo['item' . $i . 'count'];
             $extended_cost[$i]['icon'] = Items::GetItemIcon($costInfo['item' . $i]);
             $extended_cost[$i]['id'] = $costInfo['item' . $i];
         }
     }
     return $extended_cost;
 }
Beispiel #19
0
 /**
  * Returns array with item sources (for search results)
  * @category Search class
  * @access   private
  * @param    array $items
  * @return   array
  **/
 private function GetItemSourceArray($items)
 {
     // Get item IDs first
     $result_ids = array();
     foreach ($items as $item) {
         $curr_item_id = 0;
         if (!isset($item['id']) && !isset($item['entry'])) {
             continue;
         } elseif (isset($item['id'])) {
             $curr_item_id = $item['id'];
         } elseif (isset($item['entry'])) {
             $curr_item_id = $item['entry'];
         }
         if ($curr_item_id == 0) {
             continue;
         }
         $result_ids[] = $curr_item_id;
     }
     // Get item sources
     $data = Armory::$aDB->select("\n        SELECT\n        `ARMORYDBPREFIX_source`.`item`,\n        `ARMORYDBPREFIX_source`.`source`,\n        `ARMORYDBPREFIX_source`.`areaKey`,\n        `ARMORYDBPREFIX_source`.`areaUrl`,\n        `ARMORYDBPREFIX_source`.`isHeroic`,\n        `ARMORYDBPREFIX_instance_template`.`name_%s` AS `areaName`,\n        `ARMORYDBPREFIX_instance_template`.`id` AS `areaId`\n        FROM `ARMORYDBPREFIX_source` AS `ARMORYDBPREFIX_source`\n        LEFT JOIN `ARMORYDBPREFIX_instance_template` AS `ARMORYDBPREFIX_instance_template` ON `ARMORYDBPREFIX_instance_template`.`key`=`ARMORYDBPREFIX_source`.`areaKey`\n        WHERE `ARMORYDBPREFIX_source`.`item` IN (%s)", Armory::GetLocale(), $result_ids);
     if (!$data) {
         Armory::Log()->writeError('%s : unable to get item sources from DB!', __METHOD__);
         return false;
     }
     $sources_result = array();
     foreach ($data as $entry) {
         if (!isset($sources_result[$entry['item']])) {
             $sources_result[$entry['item']] = $entry;
         }
     }
     return $sources_result;
 }
Beispiel #20
0
<!-- CONTENT START -->
    <div class="grid_16" id="content">
   <!-- CONTENT TITLE -->
    <div class="grid_9">
    <h1 class="content_edit">News Manager</h1>
    </div>
<!--    TEXT CONTENT OR ANY OTHER CONTENT START     -->
    <div class="grid_15" id="textcontent">
    <?php 
$news_item = Template::GetPageData('news_item');
if (is_array($news_item)) {
    $title = '';
    if (isset($news_item['title_' . Armory::GetLocale()]) && $news_item['title_' . Armory::GetLocale()] != null) {
        $title = $news_item['title_' . Armory::GetLocale()];
    } else {
        $title = isset($news_item['title_en_gb']) ? $news_item['title_en_gb'] : null;
    }
    echo '<h2>' . $title . '</h2>';
} else {
    echo '<h2><a href="?action=news&subaction=add">Add New Item</a><br />Select Item to Edit:</h2>';
    $armory_news = Utils::GetArmoryNews(true);
    if (is_array($armory_news)) {
        $count = count($armory_news);
        echo '<ul>';
        for ($i = 0; $i < $count; ++$i) {
            echo sprintf('<li><a href="?action=news&subaction=edit&itemid=%d">%s</a> (%s)</li>', $armory_news[$i]['id'], $armory_news[$i]['title'], $armory_news[$i]['date']);
        }
        echo '</ul>';
    }
}
?>
                Armory::Log()->writeLog('character-select-submit : realm %s not found in database!', $realmName);
                continue;
            } elseif (!isset(Armory::$realmData[$realm_id])) {
                Armory::Log()->writeLog('character-select-submit : connection data to realm %s (ID: %d) not found!', $realmName, $realm_id);
                continue;
            }
            $realm_info = Armory::$realmData[$realm_id];
            $db = new Armory::$dbClass($realm_info['host_characters'], $realm_info['user_characters'], $realm_info['pass_characters'], $realm_info['port_characters'], $realm_info['name_characters'], $realm_info['charset_characters']);
            if (!$db) {
                // Error message will appear in ArmoryDatabaseHandler::ArmoryDatabaseHandler();
                continue;
            }
            $char_data = $db->selectRow("SELECT `guid`, `name`, `class`, `race`, `gender`, `level`, `account` FROM `characters` WHERE `name`='%s' AND `account`=%d LIMIT 1", $utils->escape($_GET['cn' . $i]), $_SESSION['accountId']);
            if (!$char_data) {
                Armory::Log()->writeLog('character-select-submit : unable to get character data from DB (name: %s, accountId: %d)', $_GET['cn' . $i], $_SESSION['accountId']);
                continue;
            }
            $char_data['realm_id'] = $realm_id;
            if (isset($_GET['cn1']) && $i == 1) {
                $char_data['selected'] = 1;
            } else {
                $char_data['selected'] = $i;
            }
            $char_data['num'] = $i;
            $utils->AddCharacterAsSelected($char_data, $realm_id, $i);
        }
    }
} else {
    Armory::Log()->writeLog('character-select-submit : $_GET variable not found!');
}
exit;
Beispiel #22
0
 public static function LoadTableFromDB($table)
 {
     if (!self::$db) {
         Armory::Log()->writeError('%s : DB is not initialized!', __METHOD__);
         return false;
     }
     self::$db_table = $table;
     $table_data = self::$db->select("DESCRIBE %s", self::$db_table);
     if (!$table_data) {
         return false;
     }
     $td = array();
     $i = 0;
     foreach ($table_data as $tbl) {
         $td[] = array('name' => $tbl['Field'], 'key' => $tbl['Key'] == 'PRI' ? true : false);
     }
     return $td;
 }
Beispiel #23
0
 /**
  * Return item handler by item entry (from item storage)
  * Note: m_items must be initialized in Characters::BuildCharacter()!
  * @category Characters class
  * @access   public
  * @param    int $entry
  * @return   object
  **/
 public function GetItemByEntry($entry)
 {
     if (!is_array($this->m_items)) {
         Armory::Log()->writeError('%s : m_items must be an array!', __METHOD__);
         return false;
     }
     foreach ($this->m_items as $mItem) {
         if ($mItem->GetEntry() == $entry) {
             return $mItem;
         }
     }
     return false;
 }
Beispiel #24
0
}
// Get page cache
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);
        exit;
    }
}
// Load XSLT template
$xml->LoadXSLT('guild/roster.xsl');
/** Header **/
$xml->XMLWriter()->startElement('page');
$xml->XMLWriter()->writeAttribute('globalSearch', 1);
$xml->XMLWriter()->writeAttribute('lang', Armory::GetLocale());
$xml->XMLWriter()->writeAttribute('requestUrl', 'guild-info.xml');
$xml->XMLWriter()->startElement('tabInfo');
$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->GetGuildName())) : null);
$xml->XMLWriter()->endElement();
//tabInfo
if (!$isGuild) {
    $xml->XMLWriter()->startElement('characterInfo');
    $xml->XMLWriter()->writeAttribute('errCode', 'noCharacter');
    $xml->XMLWriter()->endElement();
    // characterInfo
    $xml->XMLWriter()->endElement();
    //page
Beispiel #25
0
 public function GenerateEnchantmentSpellData($spellID)
 {
     if (Armory::GetLocale() == 'en_gb' || Armory::GetLocale() == 'ru_ru') {
         $tmp_locale = Armory::GetLocale();
     } else {
         $tmp_locale = 'en_gb';
     }
     $spell_info = Armory::$aDB->selectRow("SELECT `SpellName_%s`, `Description_%s`, `SpellName_en_gb`, `Description_en_gb` FROM `ARMORYDBPREFIX_spell` WHERE `id`=%d LIMIT 1", $tmp_locale, $tmp_locale, $spellID);
     if (!isset($spell_info['Description_' . $tmp_locale]) || empty($spell_info['Description_' . $tmp_locale])) {
         // Try to find en_gb locale
         if (isset($spell_info['Description_en_gb']) && !empty($spell_info['Description_en_gb'])) {
             $tmp_locale = 'en_gb';
         } else {
             return false;
         }
     }
     $data = array('name' => $spell_info['SpellName_' . $tmp_locale], 'desc' => str_replace(array('&quot;', '&lt;br&gt;', '<br>'), array('"', '', ''), $spell_info['Description_' . $tmp_locale]));
     return $data;
 }