Esempio n. 1
0
// get the vars from the get global
$get_char = isset($_GET['char']) ? urldecode($_GET['char']) : '';
$get_realm = urldecode(stripslashes($_GET['realm']));
$get_region = array_key_exists('region', $_GET) ? $_GET['region'] : '';
$get_prop = isset($_GET['prop']) ? $_GET['prop'] : 'char';
$get_guild = isset($_GET['guild']) ? urldecode($_GET['guild']) : '';
if ($get_guild != '') {
    $get_prop = 'guild';
}
if (empty($get_guild) && empty($get_char) || empty($get_realm)) {
    $cache->close();
    exit;
}
if ($get_prop == 'char') {
    $uniquekey = $cache->generateKey($get_char, $get_realm, $get_region);
    $result = $cache->getArmory($uniquekey, $armory_char_cache);
    if ($result) {
        header("Content-Type: text/html");
        print utf8_encode(stripslashes($result['tooltip']));
    } else {
        print "Tooltip information not found.<br/>Cache time may have expired, try reloading the page.<br/>Unique Key: {$uniquekey}<br/>Name: {$get_char}<br/>Realm: {$get_realm}<br/>Region: {$get_region}";
    }
}
if ($get_prop == 'guild') {
    $uniquekey = $cache->generateKey($get_guild, $get_realm, $get_region);
    $result = $cache->getGuild($uniquekey, $armory_guild_cache);
    if ($result) {
        header("Content-Type: text/html");
        print utf8_encode(stripslashes($result['tooltip']));
    } else {
        print "Tooltip information not found.<br/><strong>Key:</strong> " . $uniquekey;
Esempio n. 2
0
 /**
  * Parse Text
  * @access public
  **/
 public function parse($name, $args = array())
 {
     if (trim($name) == '') {
         return false;
     }
     $cache = new wowhead_cache();
     // they specified a realm/region
     if (array_key_exists('loc', $args)) {
         $aLoc = explode(',', $args['loc']);
         $this->region = $aLoc[0];
         $this->realm = $aLoc[1];
     }
     // they specified a language
     if (array_key_exists('lang', $args)) {
         $this->lang = $args['lang'];
     }
     // see if they want icons
     if (array_key_exists('noicons', $args)) {
         $this->icons = false;
     }
     if (array_key_exists('noclass', $args)) {
         $this->class_icon = false;
     }
     if (array_key_exists('norace', $args)) {
         $this->race_icon = false;
     }
     if (array_key_exists('gearlist', $args)) {
         $this->type = 'armory_gearlist';
     }
     if (array_key_exists('recruit', $args)) {
         $this->type = 'armory_recruit';
     }
     // load the language pack
     $this->language->loadLanguage($this->lang);
     $this->char_url = $this->characterURL($name);
     if (WOWHEAD_DEBUG == true) {
         print $this->char_url;
     }
     $this->now = mktime();
     $uniquekey = $cache->generateKey($name, $this->realm, $this->region);
     $result = $cache->getArmory($uniquekey, $this->char_cache);
     if (!$result) {
         $xml_data = $this->getXML($this->characterURL($name));
         if (!($xml = @simplexml_load_string($xml_data, 'SimpleXMLElement'))) {
             // failed to get the xml, most likely blocked by the armory or character not found
             $cache->close();
             return $this->generateError($this->language->words['armory_blocked']);
         }
         // make sure the character does exist
         if (array_key_exists('errcode', $xml->characterInfo)) {
             $cache->close();
             return $this->generateError($this->language->words['char_not_found']);
         } elseif (!$xml->characterInfo->characterTab) {
             $cache->close();
             return $this->generateError($this->language->words['char_no_data']);
         }
         $this->ctab = $xml->characterInfo->characterTab;
         $this->char = $xml->characterInfo->character;
         $this->cinfo = $xml->characterInfo;
         // get character stats
         $this->stats = $this->generateStats();
         // get character talents
         $this->char_data['talents'] = $this->generateTalents();
         // get professions
         $this->char_data['prof'] = $this->generateProfessions();
         // get avatar
         $this->char_data['avatar'] = $this->generateAvatar();
         // generate achievements
         $this->char_data['achieve'] = $this->generateAchievements();
         // generate average item level
         if ($this->item_level == true) {
             $this->char_data['itemlevel'] = $this->generateItemLevel();
         }
         // finalize the character and add other randomness
         $this->finalizeChar();
         // save to cache
         $cache->saveArmory(array('uniquekey' => $uniquekey, 'name' => $this->char_data['name'], 'class' => $this->char_data['class'], 'genderid' => $this->char_data['genderid'], 'raceid' => $this->char_data['raceid'], 'classid' => $this->char_data['classid'], 'realm' => $this->realm, 'region' => $this->region, 'tooltip' => $this->generateTooltip()));
         unset($xml);
         $cache->close();
         // generate html
         return $this->generateHTML(array('realm' => $this->realm, 'region' => $this->region, 'name' => $this->char_data['name'], 'icons' => $this->getIcons($this->char_data['raceid'], $this->char_data['genderid'], $this->char_data['classid']), 'link' => $this->characterURL($this->char_data['name']), 'class' => 'armory_tt_class_' . strtolower(str_replace(' ', '', $this->char_data['class'])), 'image' => $this->icon_url . 'images/wait.gif'), $this->type);
     } else {
         $cache->close();
         return $this->generateHTML(array('realm' => $this->realm, 'region' => $this->region, 'name' => $result['name'], 'icons' => $this->getIcons($result['raceid'], $result['genderid'], $result['classid']), 'link' => $this->characterURL($result['name']), 'class' => 'armory_tt_class_' . strtolower(str_replace(' ', '', $result['class'])), 'image' => $this->icon_url . 'images/wait.gif'), $this->type);
     }
 }