Ejemplo n.º 1
0
 /**
  * Private call to populate the xml property.
  * returns true on successful request
  * false otherwise
  *
  * @param string $url
  * @param int $timeout
  * @param string $user_agent
  * @return bool
  */
 function _requestXml($url, $timeout = false, $user_agent = false)
 {
     $this->xml = '';
     // clear xml if any
     if ($timeout === false) {
         $timeout = $this->xml_timeout;
     }
     if ($user_agent === false) {
         $user_agent = $this->user_agent;
     }
     $this->xml = urlgrabber($url, $timeout, $user_agent);
     if (!empty($this->xml)) {
         return true;
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
}
// If a FileDiff is requested, display the header of the file and display Warning / Confirmation
if (isset($_POST['filename']) && isset($_POST['downloadsvn'])) {
    if ($_POST['downloadsvn'] == 'confirmation') {
        //Do confirmation stuff
        $filename = $_POST['filename'];
        if (is_file($filename)) {
            $md5local = md5_file($filename);
        } else {
            $md5local = "Local File does not exist yet";
        }
        $md5remote = urlgrabber(ROSTER_SVNREMOTE . '?getfile=' . $filename . '&mode=md5');
        if ($md5remote === false) {
            roster_die("[ERROR] Cannot Read MD5 Remote File\n");
        }
        $filesvnsource = urlgrabber(ROSTER_SVNREMOTE . '?getfile=' . $filename . '&mode=diff');
        if ($filesvnsource === false) {
            roster_die("[ERROR] Cannot Read Remote File\n");
        }
        if (file_exists($filename) && is_file($filename) && filesize($filename)) {
            $rhheaderlocal = fopen($filename, 'rb');
            if ($rhheaderlocal === false) {
                roster_die("[ERROR] Cannot Read Local File\n");
            } else {
                $filelocalsource = '';
                while (!feof($rhheaderlocal)) {
                    $filelocalsource .= fread($rhheaderlocal, filesize($filename));
                }
            }
            fclose($rhheaderlocal);
            // Perform a DIFF check on the local and remote file
Ejemplo n.º 3
0
/**
 * Writes a file from the SVN copy
 * (Not currently used)
 *
 * @param string $filename
 * @return bool
 */
function downloadsvn($filename)
{
    $file_source = ROSTER_SVNREMOTE . '?getfile=' . $filename . '&mode=full';
    $file_source = str_replace("\r\n", "\n", urlgrabber($file_source));
    if ($file_source === false) {
        roster_die("[ERROR] Cannot Read File");
    }
    file_writer($filename, $file_source);
    return true;
}
Ejemplo n.º 4
0
// ----[ End Check log-in ]---------------------------------
define('IN_ROSTER_ADMIN', true);
include_once ROSTER_ADMIN . 'pages.php';
$header = $menu = $footer = $body = '';
// ----[ Check for latest WoWRoster Version ]------------------
if ($roster->config['check_updates'] && isset($roster->config['versioncache'])) {
    $cache = unserialize($roster->config['versioncache']);
    if ($roster->config['versioncache'] == '') {
        $cache['timestamp'] = 0;
        $cache['ver_latest'] = '';
        $cache['ver_info'] = '';
        $cache['ver_date'] = '';
    }
    if ($cache['timestamp'] + 60 * 60 * $roster->config['check_updates'] <= time()) {
        $cache['timestamp'] = time();
        $content = urlgrabber(ROSTER_UPDATECHECK);
        if (preg_match('#<version>(.+)</version>#i', $content, $version)) {
            $cache['ver_latest'] = $version[1];
        }
        if (preg_match('#<info>(.+)</info>#i', $content, $info)) {
            $cache['ver_info'] = $info[1];
        }
        if (preg_match('#<updated>(.+)</updated>#i', $content, $info)) {
            $cache['ver_date'] = $info[1];
        }
        $roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '" . serialize($cache) . "' WHERE `id` = '6' LIMIT 1;");
    }
    if (version_compare($cache['ver_latest'], ROSTER_VERSION, '>')) {
        $cache['ver_date'] = date($roster->locale->act['phptimeformat'], $cache['ver_date'] + 0);
        $roster->set_message(sprintf($roster->locale->act['new_version_available'], 'WoWRoster', $cache['ver_latest'], $cache['ver_date'], 'http://www.wowroster.net'), $roster->locale->act['update'] . ': WoWRoster v' . $cache['ver_info']);
    }
Ejemplo n.º 5
0
            $i++;
            break;
        case $roster->locale->act['Jewelcrafting']:
            $allrecipes[$i] = urlgrabber('http://wow.allakhazam.com/db/skill.html?line=755&source=live&tier=apprentice&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=755&source=live&tier=journeyman&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=755&source=live&tier=expert&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=755&source=live&tier=artisan&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=755&source=live&tier=master&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $i++;
            break;
        case $roster->locale->act['Inscription']:
            $allrecipes[$i] = urlgrabber('http://wow.allakhazam.com/db/skill.html?line=773&source=live&tier=apprentice&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=773&source=live&tier=journeyman&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=773&source=live&tier=expert&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=773&source=live&tier=artisan&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $allrecipes[$i] .= urlgrabber('http://wow.allakhazam.com/db/skill.html?line=773&source=live&tier=master&locale=' . $roster->data['clientLocale'], $addon['config']['mr_urlgrabber_timeout']);
            $i++;
            break;
        default:
            $allrecipes[$i] = '';
            $i++;
            break;
    }
}
foreach ($allrecipes as $index => $allrecipesperskill) {
    preg_match_all('/(?<=\\<tr class=\\"[dl]r\\"\\>)((.(?!\\<\\/tr))*)/si', $allrecipesperskill, $matches);
    foreach ($matches[0] as $nr => $recipe) {
        preg_match_all('/(\\<td[\\w \\\'\\"=]*\\>)(.*)(?=\\<\\/td)/mi', $recipe, $lines) . "\n";
        //		aprint($lines);
        $parsedrecipes[$index][$nr]['icon'] = strtolower($lines[2][0]);
        //		preg_match('/(\<a[^\>]* href=\"([^\"]*)\"\>)([^<]*)/i',$parsedrecipes[$index][$nr]['icon'],$match);
Ejemplo n.º 6
0
 function char($char, $memberid)
 {
     //print_r($this->data);
     global $roster, $addon;
     $this->messages .= '<li>Updating Achievements: ';
     $sql = '';
     $sqll = "DELETE FROM `" . $roster->db->table('data', $this->data['basename']) . "` Where `member_id` = '" . $memberid . "';";
     $resultl = $roster->db->query($sqll) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $sqll);
     $sqlll = "DELETE FROM `" . $roster->db->table('summary', $this->data['basename']) . "` Where `member_id` = '" . $memberid . "';";
     $resultll = $roster->db->query($sqlll) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $sqlll);
     foreach ($this->pages as $cat => $title) {
         $url = $x = $xy = '';
         $url = $this->base_url . 'character-achievements.xml?r=' . $char['Server'] . '&n=' . $char['Name'] . '&c=' . $cat . '';
         require_once ROSTER_LIB . 'armory.class.php';
         $this->armory = new RosterArmory();
         //echo $url.' - '.$cat.' - '.$title['0'].'<br>';
         $xy = urlgrabber($url, '25', 'Opera/9.22 (X11; Linux i686; U; en)');
         $x = $this->armory->fetchArmoryachive($url, $char['Name'], $char['Guild']['Name'], $char['Server'], $item_id = false, 'array');
         foreach ($x['div']['0']['child']['div'] as $g => $h) {
             $this->order++;
             $achv_cat_sub = $title[$g];
             foreach ($h['child']['div'] as $a => $b) {
                 $achv_points = '';
                 $achv_icon = '';
                 $achv_title = '';
                 $achv_disc = '';
                 $achv_date = '';
                 $achv_title = '';
                 $achv_id = '';
                 $achv_reward_title = '';
                 $achv_criteria = '';
                 $achv_progress = '';
                 $achv_progress_width = '';
                 $order = '';
                 $a = '';
                 if (isset($b['child']['div']['0']['child']['div']['0']['data'])) {
                     $achv_points = $b['child']['div']['0']['child']['div']['0']['data'];
                 } else {
                     $achv_points = '';
                 }
                 if (isset($b['child']['div']['1']['attribs']['style'])) {
                     $f = str_replace('background-image:url("/wow-icons/_images/51x51/', '', $b['child']['div']['1']['attribs']['style']);
                     $f = str_replace('.jpg")', '', $f);
                     $achv_icon = $f;
                 } else {
                     $achv_icon = '';
                 }
                 if (isset($b['child']['ul']['0']['child']['div']['0']['child']['div']['0']['child']['div']['2']['child']['div']['1']['data'])) {
                     $achv_progress = $b['child']['ul']['0']['child']['div']['0']['child']['div']['0']['child']['div']['2']['child']['div']['1']['data'];
                 } else {
                     $achv_progress = '';
                 }
                 if (isset($b['child']['ul']['0']['child']['div']['0']['child']['div']['0']['child']['div']['2']['child']['div']['0']['attribs']['style'])) {
                     $achv_progress_width = $b['child']['ul']['0']['child']['div']['0']['child']['div']['0']['child']['div']['2']['child']['div']['0']['attribs']['style'];
                 } else {
                     $achv_progress_width = '';
                 }
                 //echo '<pre>';
                 //print_r($b['child']['div']['0']);
                 if ($cat == '81' && $achv_icon == '' && isset($b['child']['div']['0']['attribs']['style'])) {
                     $f = str_replace('background-image:url("/wow-icons/_images/51x51/', '', $b['child']['div']['0']['attribs']['style']);
                     $f = str_replace('.jpg")', '', $f);
                     $achv_icon = $f;
                 } else {
                     //$achv_icon = '';
                 }
                 foreach ($b['child']['div'] as $ac => $ar) {
                     if (isset($ar['data'])) {
                         if ($ar['attribs']['class'] == 'achv_title') {
                             $achv_title = $ar['data'];
                         }
                     } else {
                         $achv_title = '';
                     }
                     if (isset($ar['data'])) {
                         if ($ar['attribs']['class'] == 'achv_desc') {
                             $achv_disc = $ar['data'];
                         }
                     } else {
                         $achv_disc = '';
                     }
                     if (isset($ar['data'])) {
                         $achv_date = '';
                         if ($ar['attribs']['class'] == 'achv_reward_bg') {
                             $achv_reward_title = $ar['data'];
                         }
                         if ($ar['attribs']['class'] == 'achv_date') {
                             if (isset($ar['data'])) {
                                 list($month, $day, $year) = explode("-", $ar['data'], 3);
                                 $achv_date = $year . '-' . $month . '-' . $day;
                             } else {
                                 $achv_date = $ar['data'];
                             }
                         }
                     } else {
                         $achv_date = '';
                     }
                 }
                 if (isset($b['attribs']['class'])) {
                     $achv_complete = $b['attribs']['class'];
                 } else {
                     $achv_complete = '';
                 }
                 if (isset($b['attribs']['id'])) {
                     $achv_id = $b['attribs']['id'];
                 } else {
                     $achv_id = '';
                 }
                 if (isset($b['child']['ul']['0']['child']['li'])) {
                     if (is_array($b['child']['ul']['0']['child']['li'])) {
                         foreach ($b['child']['ul']['0']['child']['li'] as $e => $f) {
                             $cd = '';
                             if ($f['attribs']['class'] == 'c_list_col criteriamet') {
                                 $cd = '( Completed )';
                             }
                             $achv_criteria .= $f['data'] . ' ' . $cd . '<br>';
                             $cd = '';
                         }
                     } else {
                         $achv_criteria .= $b['child']['ul']['0']['child']['div']['0']['child']['div']['0']['child']['div']['2']['child']['div']['1']['data'];
                     }
                 }
                 $this->achnum++;
                 if ($achv_title != '' && $achv_disc != '') {
                     $sql = "INSERT INTO `" . $roster->db->table('data', $this->data['basename']) . "` \n                    (`id`,`member_id`,`guild_id`,`achv_cat`,`achv_cat_title`,`achv_cat_sub`,`achv_cat_sub2`,\n                    `achv_id`,`achv_points`,`achv_icon`,`achv_title`,`achv_reward_title`,`achv_disc`,`achv_date`,\n                    `achv_criteria`,`achv_progress`,`achv_progress_width`,`achv_complete`) \n                    VALUES \n                    (null,'" . $memberid . "','" . $this->data['guild_id'] . "','" . $cat . "','" . $title['0'] . "',\n                        '" . addslashes($achv_cat_sub) . "','" . $this->order . "','" . $achv_id . "','" . $achv_points . "',\n                        '" . addslashes($achv_icon) . "','" . $achv_id . "title','" . addslashes($achv_reward_title) . "','" . $achv_id . "disc',\n                        '" . addslashes($achv_date) . "','" . addslashes($achv_criteria) . "','" . $achv_progress . "','" . $achv_progress_width . "','" . $achv_complete . "');";
                     $result = $roster->db->query($sql) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $sql);
                 }
             }
         }
     }
     // now get summery data
     $url = $this->base_url . 'character-achievements.xml?r=' . $char['Server'] . '&n=' . $char['Name'] . '';
     include 'addons/' . $this->data['basename'] . '/inc/Snoopy.class.php';
     $this->snoopy = new Snoopy();
     if ($this->snoopy->fetch($url)) {
         $text = $this->snoopy->results;
     }
     preg_match_all('|<div class="null_progress">(.+?)</div>|', $text, $match2);
     $feats = $match2[1][0];
     preg_match_all('|<div class="prog_int_text">(.+?)</div>|', $text, $match);
     ///echo '<pre>';
     // print_r($match2);
     $total = $match[1][0];
     $general = $match[1][1];
     $quests = $match[1][2];
     $exploration = $match[1][3];
     $pvp = $match[1][4];
     $dn_raids = $match[1][5];
     $prof = $match[1][6];
     $rep = $match[1][7];
     $world_events = $match[1][8];
     preg_match_all('/\\(?[0-9]{2}[-. ]?[0-9]{2}[-. ]?[0-9]{4}\\)/', $text, $date);
     preg_match_all('|class="s_ach_stat">(?<points>\\d+)|', $text, $point);
     preg_match_all('|<span>(.+?)</span><span class="achv_desc">(.+?)</span>|', $text, $disc);
     $sql7 = "INSERT INTO `" . $roster->db->table('summary', $this->data['basename']) . "` \n                  (`id`,`member_id`,`guild_id`,`total`,\n                    `general`,`quests`,`exploration`,`pvp`,`dn_raids`,`prof`,`rep`,`world_events`,`feats`,\n                    `title_1`,`disc_1`,`date_1`,`points_1`,`title_2`,`disc_2`,`date_2`,`points_2`,\n                    `title_3`,`disc_3`,`date_3`,`points_3`,`title_4`,`disc_4`,`date_4`,`points_4`,\n                    `title_5`,`disc_5`,`date_5`,`points_5`\n                    ) \n                    VALUES \n                    (null,'" . $memberid . "','" . $this->data['guild_id'] . "','" . $total . "','" . $general . "','" . $quests . "'," . "'" . $exploration . "','" . $pvp . "','" . $dn_raids . "','" . $prof . "','" . $rep . "','" . $world_events . "','" . $feats . "'," . "'" . addslashes($disc[1][0]) . "','" . addslashes($disc[2][0]) . "','" . $date[0][0] . "','" . $point[1][0] . "'," . "'" . addslashes($disc[1][1]) . "','" . addslashes($disc[2][1]) . "','" . $date[0][1] . "','" . $point[1][1] . "'," . "'" . addslashes($disc[1][2]) . "','" . addslashes($disc[2][2]) . "','" . $date[0][2] . "','" . $point[1][2] . "'," . "'" . addslashes($disc[1][3]) . "','" . addslashes($disc[2][3]) . "','" . $date[0][3] . "','" . $point[1][3] . "'," . "'" . addslashes($disc[1][4]) . "','" . addslashes($disc[2][4]) . "','" . $date[0][4] . "','" . $point[1][4] . "');";
     $result7 = $roster->db->query($sql7) or die_quietly($roster->db->error(), 'Database Error', basename(__FILE__), __LINE__, $sql7);
     $this->messages .= $this->achnum . '</li>';
     return true;
 }
Ejemplo n.º 7
0
/**
 * Checks an addon download id on the wowroster.net rss feed
 * And informs if there is an update
 *
 * @param string $name | name of the download
 * @param string $url | url
 */
function updateCheck($addon)
{
    global $roster;
    if ($roster->config['check_updates'] && isset($addon['wrnet_id']) && !empty($addon['wrnet_id'])) {
        $cache = unserialize($addon['versioncache']);
        if ($addon['versioncache'] == '') {
            $cache['timestamp'] = 0;
            $cache['ver_latest'] = '';
            $cache['ver_info'] = '';
            $cache['ver_link'] = '';
            $cache['ver_date'] = '';
        }
        if ($cache['timestamp'] + 60 * 60 * $roster->config['check_updates'] <= time()) {
            $cache['timestamp'] = time();
            $content = urlgrabber(sprintf(ROSTER_ADDONUPDATEURL, $addon['wrnet_id']));
            if (preg_match('#<version>(.+)</version>#i', $content, $info)) {
                $cache['ver_latest'] = $info[1];
            }
            if (preg_match('#<info>(.+)</info>#i', $content, $info)) {
                $cache['ver_info'] = $info[1];
            }
            if (preg_match_all('#<link>(.+)</link>#i', $content, $info)) {
                $cache['ver_link'] = $info[1][2];
            }
            if (preg_match('#<updated>(.+)</updated>#i', $content, $info)) {
                $cache['ver_date'] = $info[1];
            }
            $roster->db->query("UPDATE `" . $roster->db->table('addon') . "` SET `versioncache` = '" . serialize($cache) . "' WHERE `addon_id` = '" . $addon['addon_id'] . "' LIMIT 1;");
        }
        if (version_compare($cache['ver_latest'], $addon['version'], '>')) {
            // Save current locale array
            // Since we add all locales for localization, we save the current locale array
            // This is in case one addon has the same locale strings as another, and keeps them from overwritting one another
            $localetemp = $roster->locale->wordings;
            foreach ($roster->multilanguages as $lang) {
                $roster->locale->add_locale_file(ROSTER_ADDONS . $addon['basename'] . DIR_SEP . 'locale' . DIR_SEP . $lang . '.php', $lang);
            }
            $name = isset($roster->locale->act[$addon['fullname']]) ? $roster->locale->act[$addon['fullname']] : $addon['fullname'];
            // Restore our locale array
            $roster->locale->wordings = $localetemp;
            unset($localetemp);
            $cache['ver_date'] = date($roster->locale->act['phptimeformat'], $cache['ver_date'] + 3600 * $roster->config['localtimeoffset']);
            $roster->set_message(sprintf($roster->locale->act['new_version_available'], $name, $cache['ver_latest'], $cache['ver_date'], $cache['ver_link']), $roster->locale->act['update'] . ': ' . $name . $cache['ver_info']);
        }
    }
}
Ejemplo n.º 8
0
$sql = $roster->db->query($querystr);
if ($sql && $roster->db->num_rows($sql) > 0) {
    $realmData = $roster->db->fetch($sql, SQL_ASSOC);
} else {
    $realmData['server_name'] = '';
    $realmData['server_region'] = '';
    $realmData['servertype'] = '';
    $realmData['serverstatus'] = '';
    $realmData['serverpop'] = '';
    $realmData['timestamp'] = '0';
}
//==========[ STATUS GENERATION CODE ]=================================================
// Check timestamp, update when ready
$current_time = date('i') * 1;
if ($current_time >= $realmData['timestamp'] + $roster->config['rs_timer'] || $current_time < $realmData['timestamp']) {
    $xmlsource = urlgrabber($xmlsource);
    $simpleParser = new SimpleParser();
    $simpleParser->parse($xmlsource);
    $err = 1;
    if ($xmlsource != false) {
        if ($region == 'US') {
            foreach ($simpleParser->data->rs->r as $value) {
                if (str_replace(' ', '', $value->n) == str_replace(' ', '', $realmname)) {
                    $err = 0;
                    switch (strtoupper($value->s)) {
                        case '0':
                            $realmData['serverstatus'] = 'DOWN';
                            break;
                        case '1':
                            $realmData['serverstatus'] = 'UP';
                            break;