Esempio n. 1
0
 /**
  * Constructor
  *
  * @param array $data
  * @return char
  */
 function char($data)
 {
     global $roster, $addon;
     if (empty($data)) {
         roster_die('The member is not in the database', $roster->locale->act['roster_error']);
     }
     $this->data = $data;
     $this->locale = $roster->locale->wordings[$this->data['clientLocale']];
     // Get display column names
     $query = 'SELECT * FROM `' . $roster->db->table('default', $addon['basename']) . '`;';
     $result = $roster->db->query($query);
     $disp_defaults = $roster->db->fetch_all($result, SQL_ASSOC);
     $disp_defaults = $disp_defaults[0];
     // Get permission data for this member id
     $querystr = "SELECT * FROM `" . $roster->db->table('display', $addon['basename']) . "`" . " WHERE `member_id` = '" . $this->data['member_id'] . "';";
     $results = $roster->db->query($querystr);
     $row = $roster->db->fetch($results, SQL_ASSOC);
     foreach ($disp_defaults as $name => $value) {
         if ($addon['config'][$name] == -1) {
             $addon['config'][$name] = $row[$name];
         }
     }
     if (isset($roster->data['armoryurl']) && $roster->data['armoryurl'] != '') {
         $model_url = $roster->data['armoryurl'] . '/character-model-embed.xml?r=' . $this->data['server'] . '&cn=' . $this->data['name'] . '&rhtml=true';
     }
     $ximg_url = null;
     if (file_exists($addon['dir'] . 'chars/thumb-' . $this->data['member_id'] . '.jpg')) {
         $ximg_url = $addon['url_path'] . 'chars/thumb-' . $this->data['member_id'] . '.jpg';
     }
     /**
      * Assigning everything this file may need to the template
      * The only tpl vars not here are ones that need to be generated in their respective methods
      */
     $roster->tpl->assign_vars(array('S_MAX_LEVEL' => ROSTER_MAXCHARLEVEL, 'S_MODEL_TAB' => $ximg_url != '' ? true : false, 'MODEL_URL' => $model_url != '' ? $model_url : false, 'S_CHAR_IMG' => $ximg_url != '' ? $ximg_url : false, 'XIMG_URL' => $ximg_url, 'S_PLAYED' => $roster->auth->getAuthorized($addon['config']['show_played']), 'S_MONEY' => $roster->auth->getAuthorized($addon['config']['show_money']), 'S_PET_TAB' => $roster->auth->getAuthorized($addon['config']['show_pets']), 'S_COMPAN_TAB' => $roster->auth->getAuthorized($addon['config']['show_companions']), 'S_REP_TAB' => $roster->auth->getAuthorized($addon['config']['show_reputation']), 'S_SKILL_TAB' => $roster->auth->getAuthorized($addon['config']['show_skills']), 'S_PVP_TAB' => $roster->auth->getAuthorized($addon['config']['show_honor']), 'S_TALENT_TAB' => $roster->auth->getAuthorized($addon['config']['show_talents']), 'S_GLYPH_TAB' => $roster->auth->getAuthorized($addon['config']['show_glyphs']), 'S_SPELL_TAB' => $roster->auth->getAuthorized($addon['config']['show_spellbook']), 'S_BONUS_TAB' => $roster->auth->getAuthorized($addon['config']['show_item_bonuses']), 'S_PET_TALENT_TAB' => $roster->auth->getAuthorized($addon['config']['show_pet_talents']), 'S_PET_SPELL_TAB' => $roster->auth->getAuthorized($addon['config']['show_pet_spells']), 'S_CURRENCY_TAB' => $roster->auth->getAuthorized($addon['config']['show_currency']), 'S_PETS' => false, 'S_MOUNTS' => false, 'S_COMPANIONS' => false, 'L_CHAR_POWER' => $this->data['power'], 'L_CHAR_POWER_ID' => strtolower($this->data['power']), 'HEALTH' => $this->data['health'], 'POWER' => $this->data['mana'], 'TALENT_POINTS' => $this->data['talent_points'], 'MONEY_G' => $this->data['money_g'], 'MONEY_S' => $this->data['money_s'], 'MONEY_C' => $this->data['money_c']));
 }
Esempio n. 2
0
 /**
  * Sets up plugin data for use in the plugin framework
  *
  * @param string $pluginname | The name of the plugin
  * @return array $plugin  | The plugin's database record
  *
  * @global array $plugin_conf | The plugin's config data is added to this global array.
  */
 function getplugin($pluginname)
 {
     global $roster, $accounts;
     if (!isset($accounts->plugin_data[$pluginname])) {
         roster_die(sprintf($roster->locale->act['plugin_not_installed'], $pluginname), $roster->locale->act['plugin_error']);
     }
     $plugin = $accounts->plugin_data[$pluginname];
     // Get the plugin's location
     $plugin['dir'] = $addon['inc_dir'] . DIR_SEP . 'plugin' . DIR_SEP . $plugin['basename'];
     // Get the plugin's url
     $plugin['url'] = $addon['inc_dir'] . DIR_SEP . 'plugin' . DIR_SEP . $plugin['basename'] . '/';
     $plugin['url_full'] = ROSTER_URL . $plugin['url'];
     $plugin['url_path'] = ROSTER_PATH . $plugin['url'];
     // Get plugin's url to images directory
     $plugin['image_url'] = ROSTER_URL . $plugin['url'] . 'images/';
     $plugin['image_path'] = ROSTER_PATH . $plugin['url'] . 'images/';
     // Get the plugin's css style
     $plugin['css_file'] = $plugin['dir'] . 'style.css';
     if (file_exists($plugin['css_file'])) {
         $plugin['css_url'] = $plugin['url_path'] . 'style.css';
     } else {
         $plugin['css_url'] = '';
     }
     // Get the plugin's inc dir
     $plugin['inc_dir'] = $plugin['dir'] . 'inc' . DIR_SEP;
     // Get the plugin's conf file
     $plugin['conf_file'] = $plugin['inc_dir'] . DIR_SEP . 'conf.php';
     // Get the plugin's search file
     $plugin['search_file'] = $plugin['inc_dir'] . DIR_SEP . 'search.inc.php';
     // Get the plugin's locale dir
     $plugin['locale_dir'] = $plugin['dir'] . 'locale' . DIR_SEP;
     // Get the plugin's admin dir
     $plugin['admin_dir'] = $plugin['dir'] . 'admin' . DIR_SEP;
     // Get the plugin's trigger file
     $plugin['trigger_file'] = $plugin['inc_dir'] . 'update_hook.php';
     // Get the plugin's ajax functions file
     $plugin['ajax_file'] = $plugin['inc_dir'] . 'ajax.php';
     // Get config values for the default profile and insert them into the array
     $plugin['config'] = '';
     $query = "SELECT `config_name`, `config_value` FROM `" . $roster->db->table('plugin_config', $addon['basename']) . "` WHERE `plugin_id` = '" . $plugin['plugin_id'] . "' ORDER BY `id` ASC;";
     $result = $roster->db->query($query);
     if (!$result) {
         die_quietly($roster->db->error(), $roster->locale->act['plugin_error'], __FILE__, __LINE__, $query);
     }
     if ($roster->db->num_rows($result) > 0) {
         while ($row = $roster->db->fetch($result, SQL_ASSOC)) {
             $plugin['config'][$row['config_name']] = $row['config_value'];
         }
         $roster->db->free_result($result);
     }
     return $plugin;
 }
Esempio n. 3
0
    if (file_exists($addon['conf_file'])) {
        include_once $addon['conf_file'];
    }
    // The addon will now assign its output to $content
    $content = '';
    ob_start();
    require $path;
    $content .= ob_get_clean();
    // Pass all the css to roster_add_css() which is a placeholder in roster_header for more css style defines
    if ($addon['css_url'] != '') {
        roster_add_css($addon['css_url'], 'theme');
    }
    if ($addon['tpl_css_url'] != '') {
        roster_add_css($addon['tpl_css_url'], 'theme');
    }
    if ($roster->output['show_header']) {
        include_once ROSTER_BASE . 'header.php';
    }
    if ($roster->output['show_menu']) {
        $roster_menu = new RosterMenu();
        $roster_menu->makeMenu($roster->output['show_menu']);
        $roster_menu->displayMenu();
    }
    echo $content;
    if ($roster->output['show_footer']) {
        include_once ROSTER_BASE . 'footer.php';
    }
} else {
    roster_die(sprintf($roster->locale->act['addon_disabled'], $addon['basename']), $roster->locale->act['addon_error']);
}
$roster->db->close_db();
Esempio n. 4
0
 /**
  * Process character data
  */
 function processMyProfile()
 {
     global $roster;
     /**
      * Rule #1 Deny everything
      * Rule #2 If it breaks, Zanix did it
      * Rule #3 This works for both new and old CPs lol
      * Rule #4 If Zanix yells at you, you deserve it
      */
     if (isset($this->uploadData['wowrcp']['cpProfile'])) {
         $myProfile = $this->uploadData['wowrcp']['cpProfile'];
     } else {
         return;
     }
     $output = '';
     $this->resetMessages();
     foreach ($myProfile as $realm_name => $realm) {
         $this->current_realm = $realm_name;
         if (isset($realm['Character']) && is_array($realm['Character'])) {
             $characters = $realm['Character'];
             // Start update triggers
             if ($roster->config['use_update_triggers']) {
                 $output .= $this->addon_hook('char_pre', $characters);
             }
             foreach ($characters as $char_name => $char) {
                 $this->current_member = $char_name;
                 if ($roster->config['use_api_onupdate'] == 1) {
                     $char['API'] = $roster->api->Char->getCharInfo($realm_name, $char_name, 'ALL');
                 }
                 // CP Version Detection, don't allow lower than minVer
                 if (version_compare($char['CPversion'], $roster->config['minCPver'], '>=')) {
                     // Get the region
                     if (isset($char['timestamp']['init']['datakey'])) {
                         list($region) = explode(':', $char['timestamp']['init']['datakey']);
                         $region = strtoupper($region);
                     } else {
                         $region = '';
                     }
                     // Official realms don't trigger this. I looked up and verified the asian ones as well.
                     if (strlen($region) > 2) {
                         roster_die('You are not playing on an official realm, and your data is incompatible with WoWRoster<br /><br />' . 'This message exists because we are getting annoyed by the occasional person who can\'t get WoWRoster to work with a private server, ' . 'when we clearly state that WoWRoster will not work on private servers.<br />' . 'You are on your own if you want WoWRoster to work with a private server. Good luck fixing it!', 'Invalid Region/Realm');
                     }
                     $this->current_region = $region;
                     // Get the CP timestamp
                     $timestamp = $char['timestamp']['init']['DateUTC'];
                     $realm_escape = $roster->db->escape($realm_name);
                     // Is this char already in the members table?
                     $query = "SELECT `guild_id`, `member_id`" . " FROM `" . $roster->db->table('members') . "`" . " WHERE `name` = '" . $char_name . "'" . " AND `server` = '" . $realm_escape . "'" . " AND `region` = '" . $region . "';";
                     if (!$roster->db->query_first($query)) {
                         // Allowed char detection
                         $query = "SELECT `type`, COUNT(`rule_id`)" . " FROM `" . $roster->db->table('upload') . "`" . " WHERE (`type` = 2 OR `type` = 3)" . " AND '" . $char_name . "' LIKE `name`" . " AND '" . $realm_escape . "' LIKE `server`" . " AND '" . $region . "' LIKE `region`" . " GROUP BY `type`" . " ORDER BY `type` DESC;";
                         /**
                          * This might need explaining. The query potentially returns 2 rows:
                          * First the number of matching deny rows, then the number of matching
                          * accept rows. If there are deny rows, `type`=3 in the first row, and
                          * we reject the upload. If there are no deny rows, but there are accept
                          * rows, `type`=2 in the first row, and we accept the upload. If there are
                          * no relevant rows at all, query_first will return false, and we reject
                          * the upload.
                          */
                         if ($roster->db->query_first($query) !== '2') {
                             $output .= '<span class="red">' . sprintf($roster->locale->act['not_accepted'], $roster->locale->act['character'], $char_name, $region, $realm_name) . "</span><br />\n";
                             continue;
                         } else {
                             // Fabricate a guild update
                             // We can probably use the $char['Guild'] block for this info instead of Guildless I suppose....
                             $guilddata['Faction'] = $char['FactionEn'];
                             $guilddata['FactionEn'] = $char['FactionEn'];
                             $guilddata['Locale'] = $char['Locale'];
                             $guilddata['Info'] = '';
                             $guildId = $this->update_guild($realm_name, 'GuildLess-' . substr($char['FactionEn'], 0, 1), strtotime($timestamp), $guilddata, $region);
                             unset($guilddata);
                             // Copy the array so we can set Online to 1 until I can find a better way to set last online time
                             // We could probably get away with just setting 'Online' in the $char array, but I dont wanna risk tainting the data
                             $chartemp = $char;
                             $chartemp['Online'] = '1';
                             $this->update_guild_member($guildId, $char_name, $realm_name, $region, $chartemp, strtotime($timestamp), array());
                             unset($chartemp);
                             array_pop($this->messages);
                         }
                     } else {
                         $guildId = $roster->db->query_first($query);
                     }
                     $time = $roster->db->query_first("SELECT `dateupdatedutc` FROM `" . $roster->db->table('players') . "`" . " WHERE '" . $char_name . "' LIKE `name`" . " AND '" . $realm_escape . "' LIKE `server`" . " AND '" . $region . "' LIKE `region`;");
                     // Check if the profile is old
                     if ($time != '' && strtotime($time) - strtotime($timestamp) > 0) {
                         $current = date($roster->locale->act['phptimeformat'], strtotime($time));
                         $update = date($roster->locale->act['phptimeformat'], strtotime($timestamp));
                         $output .= '<span class="red">' . sprintf($roster->locale->act['not_update_char_time'], $char_name, $update, $current) . "</span><br />\n";
                         continue;
                     }
                     $output .= '<strong>' . sprintf($roster->locale->act['upload_data'], $roster->locale->act['character'], $char_name, $realm_name, $region) . "</strong>\n";
                     $memberid = $this->update_char($guildId, $region, $realm_name, $char_name, $char);
                     $output .= "<ul>\n" . $this->getMessages() . "</ul>\n";
                     $this->resetMessages();
                     // Start update triggers
                     if ($memberid !== false && $roster->config['use_update_triggers']) {
                         $output .= $this->addon_hook('char', $char, $memberid);
                     }
                 } else {
                     $output .= '<span class="red">' . sprintf($roster->locale->act['not_updating'], 'WoWRoster-Profiler', $char_name, $char['CPversion']) . "</span><br />\n";
                     $output .= sprintf($roster->locale->act['CPver_err'], $roster->config['minCPver']) . "\n";
                 }
             }
             // Start update triggers
             if ($roster->config['use_update_triggers']) {
                 $output .= $this->addon_hook('char_post', $characters);
             }
         }
     }
     return $output;
 }
Esempio n. 5
0
 /**
  * The standard upgrader
  * This parses the requested sql file for database upgrade
  * Most upgrades will use this function
  */
 function standard_upgrader()
 {
     global $roster;
     $ver = str_replace('.', '', $this->versions[$this->index]);
     $db_structure_file = ROSTER_LIB . 'dbal' . DIR_SEP . 'structure' . DIR_SEP . 'upgrade_' . $ver . '.sql';
     if (file_exists($db_structure_file)) {
         // Parse structure file and create database tables
         $sql = @fread(@fopen($db_structure_file, 'r'), @filesize($db_structure_file));
         $sql = preg_replace('#renprefix\\_(\\S+?)([\\s\\.,]|$)#', $roster->db->prefix . '\\1\\2', $sql);
         $sql = remove_remarks($sql);
         $sql = parse_sql($sql, ';');
         $sql_count = count($sql);
         for ($i = 0; $i < $sql_count; $i++) {
             $roster->db->query($sql[$i]);
         }
         unset($sql);
     } else {
         roster_die('Could not obtain SQL structure/data', $roster->locale->act['upgrade_wowroster']);
     }
     $roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '" . ROSTER_VERSION . "' WHERE `id` = '4' LIMIT 1;");
     $roster->db->query("ALTER TABLE `" . $roster->db->table('config') . "` ORDER BY `id`;");
     return;
 }
Esempio n. 6
0
        $rogue_sql = "SELECT count(`member_id`) FROM `" . $roster->db->table('members') . "` WHERE `class` IN('" . $rogues . "') AND `guild_id` =  " . $guildset . " AND `level` >= " . $alldata[0]['min_level'];
        $shaman_sql = "SELECT count(`member_id`) FROM `" . $roster->db->table('members') . "` WHERE `class` IN('" . $shamans . "') AND `guild_id` =  " . $guildset . " AND `level` >= " . $alldata[0]['min_level'];
        $warlock_sql = "SELECT count(`member_id`) FROM `" . $roster->db->table('members') . "` WHERE `class` IN('" . $warlocks . "') AND `guild_id` =  " . $guildset . " AND `level` >= " . $alldata[0]['min_level'];
        $warrior_sql = "SELECT count(`member_id`) FROM `" . $roster->db->table('members') . "` WHERE `class` IN('" . $warriors . "') AND `guild_id` =  " . $guildset . " AND `level` >= " . $alldata[0]['min_level'];
        // Actual Count
        $druid_count = $roster->db->query_first($druid_sql);
        $hunter_count = $roster->db->query_first($hunter_sql);
        $mage_count = $roster->db->query_first($mage_sql);
        $paladin_count = $roster->db->query_first($paladin_sql);
        $priest_count = $roster->db->query_first($priest_sql);
        $rogue_count = $roster->db->query_first($rogue_sql);
        $shaman_count = $roster->db->query_first($shaman_sql);
        $warlock_count = $roster->db->query_first($warlock_sql);
        $warrior_count = $roster->db->query_first($warrior_sql);
    } else {
        roster_die('There was an error in the query', 'ERROR');
    }
    $formbody = "<br /><div id=\"ar_disp\">\n" . border('sblue', 'start', $roster->locale->act['admin']['autorecruit_title']) . "\n<table cellspacing=\"0\" cellpadding=\"0\" class=\"bodyline\">\n";
    $formbody .= '
	<tr>
		<th class="membersHeader">' . $roster->locale->act['admin']['setting'] . '</th>
		<th class="membersHeaderRight" colspan="2">' . $roster->locale->act['admin']['threshold'] . '</th>
	</tr>
	<tr>
		<td class="membersRow1">' . $roster->locale->act['admin']['app_link'] . '</td>
		<td class="membersRowRight1" colspan="2"><input name="ar_app_link" type="text" size="40" maxlength="80" value="' . $alldata[0]['app_link'] . '"/></td>
	</tr>
	<tr>
		<td class="membersRow2">' . $roster->locale->act['admin']['min_level'] . '</td>
		<td class="membersRowRight2" colspan="2"><input name="ar_min_level" type="text" size="5" maxlength="2" value="' . $alldata[0]['min_level'] . '"/></td>
	</tr>
Esempio n. 7
0
 */
$roster->get_scope_data();
/**
 * Include Login class, external or Roster's
 */
if (file_exists(ROSTER_ADDONS . $roster->config['external_auth'] . DIR_SEP . 'inc' . DIR_SEP . 'login.php')) {
    require_once ROSTER_ADDONS . $roster->config['external_auth'] . DIR_SEP . 'inc' . DIR_SEP . 'login.php';
} else {
    $roster->config['external_auth'] = 'roster';
    require_once ROSTER_LIB . 'login.php';
}
$roster->auth = new RosterLogin();
/**
 * Assign initial template vars
 */
$roster->tpl->assign_vars(array('S_SEO_URL' => $roster->config['seo_url'], 'S_HEADER_LOGO' => !empty($roster->config['logo']) ? true : false, 'U_MAKELINK' => makelink(), 'U_LINKFORM' => linkform(), 'ROSTER_URL' => ROSTER_URL, 'ROSTER_PATH' => ROSTER_PATH, 'WEBSITE_ADDRESS' => $roster->config['website_address'], 'HEADER_LOGO' => $roster->config['logo'], 'IMG_URL' => $roster->config['img_url'], 'INTERFACE_URL' => $roster->config['interface_url'], 'IMG_SUFFIX' => $roster->config['img_suffix'], 'ROSTER_VERSION' => $roster->config['version'], 'ROSTER_CREDITS' => sprintf($roster->locale->act['roster_credits'], makelink('credits')), 'XML_LANG' => substr($roster->config['locale'], 0, 2), 'T_BORDER_WHITE' => border('swhite', 'start'), 'T_BORDER_GRAY' => border('sgray', 'start'), 'T_BORDER_GOLD' => border('sgold', 'start'), 'T_BORDER_RED' => border('sred', 'start'), 'T_BORDER_ORANGE' => border('sorange', 'start'), 'T_BORDER_YELLOW' => border('syellow', 'start'), 'T_BORDER_GREEN' => border('sgreen', 'start'), 'T_BORDER_PURPLE' => border('spurple', 'start'), 'T_BORDER_BLUE' => border('sblue', 'start'), 'T_BORDER_END' => border('sgray', 'end'), 'PAGE_TITLE' => '', 'ROSTER_HEAD' => '', 'ROSTER_BODY' => '', 'ROSTER_ONLOAD' => '', 'ROSTER_MENU_BEFORE' => ''));
/**
 * If the version doesnt match the one in constants, redirect to upgrader
 */
if (empty($roster->config['version']) || version_compare($roster->config['version'], ROSTER_VERSION, '<')) {
    require ROSTER_PAGES . 'upgrade.php';
    die;
}
/**
 * If the install directory or files exist, die()
 */
if (file_exists(ROSTER_BASE . 'install.php')) {
    if (!file_exists(ROSTER_BASE . 'version_match.php')) {
        roster_die($roster->locale->act['remove_install_files_text'], $roster->locale->act['remove_install_files'], 'sred');
    }
}
Esempio n. 8
0
/**
 * WoWRoster.net WoWRoster
 *
 *
 * @copyright  2002-2011 WoWRoster.net
 * @license    http://www.gnu.org/licenses/gpl.html   Licensed under the GNU General Public License v3.
 * @version    SVN: $Id$
 * @link       http://www.wowroster.net
 * @package    IntanceKeys
 */
if (!defined('IN_ROSTER')) {
    exit('Detected invalid access to this file!');
}
if (!active_addon('memberslist')) {
    // Memberslist not installed. Just die for now.
    roster_die("You will need to install memberslist to use the keys addon display component");
}
$memberslist_addon = getaddon('memberslist');
// Include addon's locale files if they exist
foreach ($roster->multilanguages as $lang) {
    $roster->locale->add_locale_file($memberslist_addon['locale_dir'] . $lang . '.php', $lang);
}
// Apply memberslist style
roster_add_css($memberslist_addon['tpl_css_url'], 'theme');
include_once $memberslist_addon['inc_dir'] . 'memberslist.php';
include_once ROSTER_LIB . 'item.php';
$memberlist = new memberslist(array(), $memberslist_addon);
// First define static data
$mainSelect = 'SELECT ' . '`members`.`member_id`, ' . '`members`.`name`, ' . '`members`.`class`, ' . '`members`.`level`, ' . '`members`.`zone`, ' . '`members`.`online`, ' . '`members`.`last_online`, ' . "UNIX_TIMESTAMP(`members`.`last_online`) AS 'last_online_stamp', " . "DATE_FORMAT(  DATE_ADD(`members`.`last_online`, INTERVAL " . $roster->config['localtimeoffset'] . " HOUR ), '" . $roster->locale->act['timeformat'] . "' ) AS 'last_online_format', " . '`members`.`note`, ' . '`members`.`guild_title`, ' . '`alts`.`main_id`, ' . '`guild`.`update_time`, ' . "IF( `members`.`note` IS NULL OR `members`.`note` = '', 1, 0 ) AS 'nisnull', " . '`members`.`officer_note`, ' . "IF( `members`.`officer_note` IS NULL OR `members`.`officer_note` = '', 1, 0 ) AS 'onisnull', " . '`members`.`guild_rank`, ' . '`players`.`server`, ' . '`players`.`race`, ' . '`players`.`sex`, ' . '`players`.`exp`, ' . '`players`.`clientLocale`, ' . '`players`.`lifetimeRankName`, ' . '`players`.`lifetimeHighestRank`, ' . "IF( `players`.`lifetimeHighestRank` IS NULL OR `players`.`lifetimeHighestRank` = '0', 1, 0 ) AS 'risnull', " . '`players`.`hearth`, ' . "IF( `players`.`hearth` IS NULL OR `players`.`hearth` = '', 1, 0 ) AS 'hisnull', " . "UNIX_TIMESTAMP( `players`.`dateupdatedutc`) AS 'last_update_stamp', " . "DATE_FORMAT(  DATE_ADD(`players`.`dateupdatedutc`, INTERVAL " . $roster->config['localtimeoffset'] . " HOUR ), '" . $roster->locale->act['timeformat'] . "' ) AS 'last_update_format', " . "IF( `players`.`dateupdatedutc` IS NULL OR `players`.`dateupdatedutc` = '', 1, 0 ) AS 'luisnull', ";
$mainTables = 'FROM `' . $roster->db->table('members') . '` AS members ' . 'LEFT JOIN `' . $roster->db->table('alts', $memberslist_addon['basename']) . '` AS alts ON `members`.`member_id` = `alts`.`member_id` ' . 'INNER JOIN `' . $roster->db->table('players') . '` AS players ON `members`.`member_id` = `players`.`member_id` ' . 'INNER JOIN `' . $roster->db->table('guild') . '` AS guild ON `members`.`guild_id` = `guild`.`guild_id` ' . 'INNER JOIN `' . $roster->db->table('keycache', $addon['basename']) . '` AS keycache ON `members`.`member_id` = `keycache`.`member_id` ';
$where[] = '`members`.`guild_id` = "' . $roster->data['guild_id'] . '"';
Esempio n. 9
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;
}
Esempio n. 10
0
 /**
  * Process character data
  */
 function processMyProfile()
 {
     global $roster;
     $output = '';
     $myProfile = $this->uploadData['characterprofiler']['myProfile'];
     $this->resetMessages();
     foreach ($myProfile as $realm_name => $realm) {
         $this->current_realm = $realm_name;
         if (isset($realm['Character']) && is_array($realm['Character'])) {
             $characters = $realm['Character'];
             // Start update triggers
             if ($roster->config['use_update_triggers']) {
                 $output .= $this->addon_hook('char_pre', $characters);
             }
             foreach ($characters as $char_name => $char) {
                 $this->current_member = $char_name;
                 // CP Version Detection, don't allow lower than minVer
                 if (version_compare($char['CPversion'], $roster->config['minCPver'], '>=')) {
                     // Get the region
                     if (isset($char['timestamp']['init']['datakey'])) {
                         list($region) = explode(':', $char['timestamp']['init']['datakey']);
                         $region = strtoupper($region);
                         $region = substr($region, 0, 2);
                     } else {
                         $region = '';
                     }
                     // Official realms don't trigger this. I looked up and verified the asian ones as well.
                     if (strlen($region) > 2) {
                         roster_die("Invalid realm. You are not playing on an official realm, and your realm setup is incompatible with roster. Good luck fixing it up.<br/><br/>I'm adding this message cause I'm getting annoyed by the occasional person who can't get roster to work on his private server");
                     }
                     $this->current_region = $region;
                     // take the current time
                     $timestamp = $char['timestamp']['init']['DateUTC'];
                     $realm_escape = $roster->db->escape($realm_name);
                     // Is this char already in the members table?
                     $query = "SELECT `guild_id`, `member_id`" . " FROM `" . $roster->db->table('members') . "`" . " WHERE `name` = '" . $char_name . "'" . " AND `server` = '" . $realm_escape . "'" . " AND `region` = '" . $region . "';";
                     if (!$roster->db->query_first($query)) {
                         // Allowed char detection
                         $query = "SELECT `type`, COUNT(`rule_id`)" . " FROM `" . $roster->db->table('upload') . "`" . " WHERE (`type` = 2 OR `type` = 3)" . " AND '" . $char_name . "' LIKE `name` " . " AND '" . $realm_escape . "' LIKE `server` " . " AND '" . $region . "' LIKE `region` " . " GROUP BY `type` " . " ORDER BY `type` DESC;";
                         /**
                          * This might need explaining. The query potentially returns 2 rows:
                          * First the number of matching deny rows, then the number of matching
                          * accept rows. If there are deny rows, `type`=3 in the first row, and
                          * we reject the upload. If there are no deny rows, but there are accept
                          * rows, `type`=2 in the first row, and we accept the upload. If there are
                          * no relevant rows at all, query_first will return false, and we reject
                          * the upload.
                          */
                         if ($roster->db->query_first($query) !== '2') {
                             $output .= sprintf($roster->locale->act['not_accepted'], $roster->locale->act['character'], $char_name, $region, $realm_name) . "<br />\n";
                             continue;
                         } else {
                             // Fabricate a guild update
                             $guilddata['Faction'] = $char['FactionEn'];
                             $guilddata['FactionEn'] = $char['FactionEn'];
                             $guilddata['Locale'] = $char['Locale'];
                             $guilddata['Info'] = '';
                             $guildId = $this->update_guild($realm_name, 'GuildLess-' . substr($char['FactionEn'], 0, 1), strtotime($timestamp), $guilddata, $region);
                             unset($guilddata);
                             // Copy the array so we can set Online to 1 until I can find a better way to set last online time
                             // We could probably get away with just setting 'Online' in the $char array, but I dont wanna risk tainting the data
                             $chartemp = $char;
                             $chartemp['Online'] = '1';
                             $this->update_guild_member($guildId, $char_name, $realm_name, $region, $chartemp, strtotime($timestamp), array());
                             unset($chartemp);
                             array_pop($this->messages);
                         }
                     } else {
                         $guildId = $roster->db->query_first($query);
                     }
                     $time = $roster->db->query_first("SELECT `dateupdatedutc` FROM `" . $roster->db->table('players') . "` WHERE\t'" . $char_name . "' LIKE `name` " . " AND '" . $realm_escape . "' LIKE `server` " . " AND '" . $region . "' LIKE `region`;");
                     // Check if the profile is old
                     if ($time != '' && strtotime($time) - strtotime($timestamp) > 0) {
                         $output .= sprintf($roster->locale->act['not_update_char_time'], $char_name) . "<br />\n";
                         continue;
                     }
                     $output .= '<strong>' . sprintf($roster->locale->act['upload_data'], $roster->locale->act['character'], $char_name, $realm_name, $region) . "</strong>\n";
                     $memberid = $this->update_char($guildId, $region, $realm_name, $char_name, $char);
                     $output .= "<ul>\n" . $this->getMessages() . "</ul>\n";
                     $this->resetMessages();
                     // Start update triggers
                     if ($memberid !== false && $roster->config['use_update_triggers']) {
                         $output .= $this->addon_hook('char', $char, $memberid);
                     }
                 } else {
                     $output .= '<span class="red">' . sprintf($roster->locale->act['not_updating'], 'CharacterProfiler', $char_name, $char['CPversion']) . "</span><br />\n";
                     $output .= sprintf($roster->locale->act['CPver_err'], $roster->config['minCPver']) . "\n";
                 }
             }
             // Start update triggers
             if ($roster->config['use_update_triggers']) {
                 $output .= $this->addon_hook('char_post', $characters);
             }
         }
     }
     return $output;
 }
Esempio n. 11
0
        print '<input type="hidden" name="filename" value="' . $filename . '" />';
        print '<input type="hidden" name="downloadsvn" value="savefile" />';
        print '<input type="button" value="[ RETURN TO ROSTERDIAG ]" onclick="history.go(-1);return false;" />';
        print '</form></td></tr></table>';
        print border('sblue', 'end');
        print '</td></tr></table><br />';
        if (isset($_POST['downmode']) && $_POST['downmode'] == 'install') {
            $diffwindow = 'File Contents:&nbsp;&nbsp;';
        } else {
            $diffwindow = 'File Differences for file:&nbsp;&nbsp;';
        }
        print border('sblue', 'start', $diffwindow . $filename, '90%');
        print $diffcheck;
        print border('sblue', 'end');
    } else {
        roster_die('If you get this page, you probably are trying to exploit the system!', 'UNSPECIFIED ACTION');
    }
    return;
}
// Diplay Password Box
if (!$roster->auth->getAuthorized(ROSTERLOGIN_ADMIN)) {
    echo '<br />' . $roster->auth->getLoginForm(ROSTERLOGIN_ADMIN);
}
echo "<br />\n";
// Display config errors
echo ConfigErrors();
echo "<br />\n";
// Table display fix
echo "<table cellspacing=\"6\"><tr><td valign=\"top\">\n";
// Display basic server info
$rowstripe = 0;
Esempio n. 12
0
<?php

/** 
 *
 */
if (!defined('ROSTER_INSTALLED')) {
    exit('Detected invalid access to this file!');
}
if (!isset($user)) {
    include_once $addon['inc_dir'] . 'users.lib.php';
    $user = new user();
}
//global $roster, $addon, $user;
// --[ Get path info based on scope ]--
if (!isset($roster->pages[2])) {
    $roster->pages[2] = 'main';
}
if ($roster->pages[2] == '') {
    // Send a 404. Then the browser knows what's going on as well.
    header('HTTP/1.0 404 Not Found');
    roster_die(sprintf($roster->locale->act['page_not_exist'], ROSTER_PAGE_NAME), $roster->locale->act['roster_error']);
}
$page = $roster->pages[2];
$user->page->getPage($page);
Esempio n. 13
0
 /**
  * Figure out the page to load, and put it in $this->pages and ROSTER_PAGE_NAME
  */
 function get_page_name()
 {
     // cmslink function to resolve SEO linking etc.
     parse_params();
     // --[ Determine the module request ]--
     if (isset($_GET[ROSTER_PAGE]) && !empty($_GET[ROSTER_PAGE])) {
         $page = $_GET[ROSTER_PAGE];
     } elseif (!strpos($this->config['default_page'], '&amp;')) {
         $page = $this->config['default_page'];
     } else {
         // --[ Insert directly into GET request ]--
         list($page, $gets) = explode('&amp;', $this->conf['default_page'], 2);
         foreach (explode('&amp;', $gets) as $get) {
             list($key, $value) = explode('=', $get, 2);
             $_GET[$key] = $value;
         }
     }
     // --[ We only accept certain characters in our page ]--
     if (preg_match('/[^a-zA-Z0-9_-]/', $page)) {
         roster_die($this->locale->act['invalid_char_module'], $this->locale->act['roster_error']);
     }
     define('ROSTER_PAGE_NAME', $page);
     $this->pages = explode('-', $page);
     if (in_array($this->pages[0], array('util', 'user', 'realm', 'guild', 'char'))) {
         $this->scope = $this->pages[0];
     } else {
         $this->scope = 'page';
     }
 }
Esempio n. 14
0
            $numcl = $res['CLIENTCOUNT'];
            for ($i = 1; $i == $numcl;) {
                foreach ($clientarr as $key => $value) {
                    if ($key == 'CLIENT:_ADMIN') {
                        unset($clientarr[$key]);
                        // Drop the bad key
                        $clientarr['ADMIN'] = $value;
                        // Replace with the good one
                    }
                }
                $clients[$i] = array();
                foreach ($cfields as $value) {
                    $clients[$i][$value] = $clientarr[$value];
                }
                $i++;
            }
            $display = '';
            foreach ($res as $key => $value) {
                $display .= '<u><b>' . $key . '</b></u>:  ' . $value . '<br>';
            }
            print $display . '<u><b>Client Fields</u></b>: ';
            print_r($cfields);
            print '<br><u><b>Client Array</u></b>: ';
            print_r($clientarr);
            print '<br><u><b>Clients</u></b>: ';
            print_r($clients);
        }
    }
} else {
    roster_die('Please check your GuildSpeak server settings and try again.', 'GuildSpeak Error', 'sred');
}
Esempio n. 15
0
 /**
  * Get the data for the current scope and assign it to $this->data
  */
 function get_scope_data()
 {
     // --[ Resolve the anchor ]--
     $this->anchor = isset($_GET['a']) ? $_GET['a'] : '';
     if (empty($this->anchor)) {
         $this->atype = 'none';
     } elseif (strpos($this->anchor, ':') !== FALSE) {
         list($this->atype, $this->anchor) = explode(':', $this->anchor);
         switch ($this->atype) {
             case 'r':
             case 'realm':
                 $this->atype = 'realm';
                 break;
             case 'g':
             case 'guild':
                 $this->atype = 'guild';
                 break;
             case 'c':
             case 'char':
                 $this->atype = 'char';
                 break;
             default:
                 $this->atype = 'none';
                 break;
         }
     } elseif (strpos($this->anchor, '@') === FALSE) {
         $this->atype = 'realm';
     } else {
         // There is no way to see from the anchor if this is a guild anchor or a char anchor. To keep
         // it simple, we'll just assume it's an anchor for the current scope.
         $this->atype = $this->scope;
     }
     if ($this->atype == 'none' && in_array($this->scope, array('guild', 'realm'))) {
         // No anchor at all, but for realm/guild we have a default
         $defquery = "SELECT `name`, `server`, `region`" . " FROM `" . $this->db->table('upload') . "`" . " WHERE `default` = '1' LIMIT 1;";
         $this->db->query($defquery);
         $data = $this->db->fetch();
         if ($data) {
             $name = $this->db->escape($data['name']);
             $realm = $this->db->escape($data['server']);
             $region = $this->db->escape($data['region']);
             $this->atype = 'default';
             $this->anchor = $name . '@' . $region . '-' . $realm;
         } else {
             $this->atype = 'none';
             $this->anchor = '';
             roster_die(sprintf($this->locale->act['nodefguild'], makelink('rostercp-upload')), $this->locale->act['nodata_title']);
         }
     }
     // --[ Build the query ]--
     switch ($this->atype) {
         case 'char':
             // Parse the attribute
             if (is_numeric($this->anchor)) {
                 $where = ' `players`.`member_id` = "' . $this->anchor . '"';
             } elseif (strpos($this->anchor, '@') !== false) {
                 list($name, $realm) = explode('@', $this->anchor);
                 if (strpos($realm, '-') !== false) {
                     list($region, $realm) = explode('-', $realm, 2);
                     $where = ' `players`.`name` = "' . $name . '" ' . 'AND `players`.`server` = "' . $realm . '" ' . 'AND `players`.`region` = "' . strtoupper($region) . '" ';
                 } else {
                     $where = ' `players`.`name` = "' . $name . '" ' . 'AND `players`.`server` = "' . $realm . '" ';
                 }
             } else {
                 $name = $this->anchor;
                 $where = ' `players`.`name` = "' . $name . '"';
             }
             // Get the data
             $query = 'SELECT guild.*, members.*, players.*, ' . 'DATE_FORMAT(  DATE_ADD(`players`.`dateupdatedutc`, INTERVAL ' . $this->config['localtimeoffset'] . ' HOUR ), "' . $this->locale->act['timeformat'] . '" ) AS "update_format" ' . 'FROM `' . $this->db->table('players') . '` players ' . 'LEFT JOIN `' . $this->db->table('members') . '` members ON `players`.`member_id` = `members`.`member_id` ' . 'LEFT JOIN `' . $this->db->table('guild') . '` guild ON `players`.`guild_id` = `guild`.`guild_id` ' . 'WHERE ' . $where . ";";
             $result = $this->db->query($query);
             if (!$result) {
                 die_quietly($this->db->error(), 'Database error', __FILE__, __LINE__, $query);
             }
             if (!($this->data = $this->db->fetch($result))) {
                 roster_die('The member ' . $this->anchor . ' is not in the database', $this->locale->act['roster_error']);
             }
             $this->db->free_result($result);
             $this->anchor = $this->data['member_id'];
             break;
             // We have a separate atype for default, but it loads a guild anchor from the uploads table.
         // We have a separate atype for default, but it loads a guild anchor from the uploads table.
         case 'guild':
         case 'default':
             if (in_array($this->scope, array('char'))) {
                 roster_die('The a= parameter does not provide accurate enough data or is badly formatted.', 'WoWRoster');
             }
             // Parse the attribute
             if (is_numeric($this->anchor)) {
                 $where = ' `guild_id` = "' . $this->anchor . '"';
             } elseif (strpos($this->anchor, '@') !== false) {
                 list($name, $realm) = explode('@', $this->anchor);
                 if (strpos($realm, '-') !== false) {
                     list($region, $realm) = explode('-', $realm, 2);
                     $where = ' `guild_name` = "' . $name . '" ' . 'AND `server` = "' . $realm . '" ' . 'AND `region` = "' . strtoupper($region) . '" ';
                 } else {
                     $where = ' `guild_name` = "' . $name . '" ' . 'AND `server` = "' . $realm . '" ';
                 }
             } else {
                 $name = $this->anchor;
                 $where = ' `guild_name` = "' . $name . '"';
             }
             // Get the data
             $query = 'SELECT guild.* ' . "FROM `" . $this->db->table('guild') . "` guild " . "WHERE " . $where . ";";
             $result = $this->db->query($query);
             if (!$result) {
                 die_quietly($this->db->error(), 'Database Error', __FILE__ . '<br />Function: ' . __FUNCTION__, __LINE__, $query);
             }
             if (!($this->data = $this->db->fetch($result))) {
                 roster_die(sprintf($this->locale->act['nodata'], $name, $realm, makelink('update'), makelink('rostercp-upload')), $this->locale->act['nodata_title']);
             }
             $this->db->free_result($result);
             $this->anchor = $this->data['guild_id'];
             break;
         case 'realm':
             if (in_array($this->scope, array('char', 'guild'))) {
                 roster_die('The a= parameter does not provide accurate enough data or is badly formatted.', 'WoWRoster');
             }
             if (strpos($this->anchor, '-') !== false) {
                 list($region, $realm) = explode('-', $this->anchor, 2);
                 $where = ' `server` = "' . $realm . '" ' . 'AND `region` = "' . strtoupper($region) . '"';
             } else {
                 $realm = $this->anchor;
                 $where = ' `server` = "' . $realm . '" ';
             }
             // Check if there's data for this realm
             $query = "SELECT DISTINCT `server`, `region`" . " FROM `" . $this->db->table('guild') . "`" . " WHERE {$where}" . " UNION SELECT DISTINCT `server`, `region`" . " FROM `" . $this->db->table('players') . "`" . " WHERE {$where}" . " LIMIT 1;";
             $result = $this->db->query($query);
             if (!$result) {
                 die_quietly($this->db->error(), 'Database Error', __FILE__ . '<br />Function: ' . __FUNCTION__, __LINE__, $query);
             }
             if (!($this->data = $this->db->fetch($result, SQL_ASSOC))) {
                 roster_die(sprintf($this->locale->act['nodata'], '', $realm, makelink('update'), makelink('rostercp-upload')), $this->locale->act['nodata_title']);
             }
             $this->anchor = $this->data['region'] . '-' . $this->data['server'];
             break;
         default:
             if (in_array($this->scope, array('char', 'guild', 'realm'))) {
                 roster_die('The a= parameter does not provide accurate enough data or is badly formatted.', 'WoWRoster');
             }
             // no anchor passed, and we didn't load defaults so we're in util or page scope. No data needed.
             $this->data = array();
     }
     // Set menu array
     if (isset($this->data['member_id'])) {
         $this->output['show_menu']['char'] = 1;
     }
     $this->output['show_menu'][$this->scope == 'page' ? 'util' : $this->scope] = 1;
 }
Esempio n. 16
0
/**
 * Sets up addon data for use in the addon framework
 *
 * @param string $addonname | The name of the addon
 * @return array $addon  | The addon's database record
 */
function getaddon($addonname)
{
    global $roster;
    if (!isset($roster->addon_data[$addonname])) {
        roster_die(sprintf($roster->locale->act['addon_not_installed'], $addonname), $roster->locale->act['addon_error']);
    }
    $addon = $roster->addon_data[$addonname];
    // Get the addon's location
    $addon['dir'] = ROSTER_ADDONS . $addon['basename'] . DIR_SEP;
    // Get the addons url
    $addon['url'] = 'addons/' . $addon['basename'] . '/';
    $addon['url_full'] = ROSTER_URL . $addon['url'];
    $addon['url_path'] = ROSTER_PATH . $addon['url'];
    // Get addons url to images directory
    $addon['image_url'] = $addon['url_full'] . 'images/';
    $addon['image_path'] = $addon['url_path'] . 'images/';
    // Get the addon's global css style
    $addon['css_file'] = $addon['dir'] . 'style.css';
    if (file_exists($addon['css_file'])) {
        $addon['css_url'] = $addon['url_path'] . 'style.css';
    } else {
        $addon['css_file'] = '';
        $addon['css_url'] = '';
    }
    /**
     * Template paths and urls
     */
    // Get the addon's template path
    $addon['tpl_dir'] = ROSTER_TPLDIR . $roster->config['theme'] . DIR_SEP . $addon['basename'] . DIR_SEP;
    if (!file_exists($addon['tpl_dir'])) {
        $addon['tpl_dir'] = ROSTER_TPLDIR . 'default' . DIR_SEP . $addon['basename'] . DIR_SEP;
        $addon['tpl_url'] = ROSTER_URL . 'templates/default/';
        $addon['tpl_url_path'] = ROSTER_PATH . 'templates/default/';
        if (!file_exists($addon['tpl_dir'])) {
            $addon['tpl_dir'] = $addon['dir'] . 'templates' . DIR_SEP;
            $addon['tpl_url'] = $addon['url_full'] . 'templates/';
            $addon['tpl_url_path'] = $addon['url_path'] . 'templates/';
            if (!file_exists($addon['tpl_dir'])) {
                $addon['tpl_dir'] = '';
                $addon['tpl_url'] = '';
                $addon['tpl_url_path'] = '';
            }
        }
    } else {
        $addon['tpl_url'] = ROSTER_URL . 'templates/' . $roster->config['theme'] . '/' . $addon['basename'] . '/';
        $addon['tpl_url_path'] = ROSTER_PATH . 'templates/' . $roster->config['theme'] . '/' . $addon['basename'] . '/';
    }
    // Get addons url to template images directory
    $addon['tpl_image_url'] = $addon['tpl_url'] . 'images/';
    $addon['tpl_image_path'] = $addon['tpl_url_path'] . 'images/';
    // Get the addon's template based css style
    $addon['tpl_css_file'] = $addon['tpl_dir'] . 'style.css';
    if (file_exists($addon['tpl_css_file'])) {
        $addon['tpl_css_url'] = $addon['tpl_url_path'] . 'style.css';
    } else {
        $addon['tpl_css_file'] = '';
        $addon['tpl_css_url'] = '';
    }
    /**
     * End Template paths and urls
     */
    // Get the addon's inc dir
    $addon['inc_dir'] = $addon['dir'] . 'inc' . DIR_SEP;
    // Get the addon's conf file
    $addon['conf_file'] = $addon['inc_dir'] . 'conf.php';
    // Get the addon's search file
    $addon['search_file'] = $addon['inc_dir'] . 'search.inc.php';
    $addon['search_class'] = $addon['basename'] . 'Search';
    // Get the addon's locale dir
    $addon['locale_dir'] = $addon['dir'] . 'locale' . DIR_SEP;
    // Get the addon's admin dir
    $addon['admin_dir'] = $addon['dir'] . 'admin' . DIR_SEP;
    // Get the addon's trigger file
    $addon['trigger_file'] = $addon['inc_dir'] . 'update_hook.php';
    // Get the addon's ajax functions file
    $addon['ajax_file'] = $addon['inc_dir'] . 'ajax.php';
    // Get config values for the default profile and insert them into the array
    $addon['config'] = '';
    $query = "SELECT `config_name`, `config_value` FROM `" . $roster->db->table('addon_config') . "` WHERE `addon_id` = '" . $addon['addon_id'] . "' ORDER BY `id` ASC;";
    $result = $roster->db->query($query);
    if (!$result) {
        die_quietly($roster->db->error(), $roster->locale->act['addon_error'], __FILE__, __LINE__, $query);
    }
    if ($roster->db->num_rows($result) > 0) {
        while ($row = $roster->db->fetch($result, SQL_ASSOC)) {
            $addon['config'][$row['config_name']] = $row['config_value'];
        }
        $roster->db->free_result($result);
    }
    return $addon;
}