本文整理汇总了PHP中active_addon函数的典型用法代码示例。如果您正苦于以下问题:PHP active_addon函数的具体用法?PHP active_addon怎么用?PHP active_addon使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了active_addon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: alt_name_hover
function alt_name_hover()
{
global $roster;
$alt_hover = '';
if (active_addon('memberslist')) {
$sql = "SELECT `main_id` FROM `" . $roster->db->table('alts', 'memberslist') . "` WHERE `member_id` = " . $roster->data['member_id'] . ";";
$main_id = $roster->db->query_first($sql);
if ($main_id != 0) {
// we know the main, get alt info
$sql = "SELECT `m`.`name`, `m`.`level`, `m`.`class`, `a`.* FROM `" . $roster->db->table('alts', 'memberslist') . "` AS a, `" . $roster->db->table('players') . "` AS m " . " WHERE `a`.`member_id` = `m`.`member_id` " . " AND `a`.`main_id` = {$main_id};";
$qry = $roster->db->query($sql);
$alts = $roster->db->fetch_all($qry, SQL_ASSOC);
if (isset($alts[1])) {
$html = $caption = '';
foreach ($alts as $alt) {
if ($alt['main_id'] == $alt['member_id']) {
$caption = 'Alts of: <a href="' . makelink('char-info&a=c:' . $alt['member_id']) . '">' . $alt['name'] . ' (' . $roster->locale->act['level'] . ' ' . $alt['level'] . ' ' . $alt['class'] . ')</a>';
} else {
$html .= '<a href="' . makelink('char-info&a=c:' . $alt['member_id']) . '">' . $alt['name'] . ' (' . $roster->locale->act['level'] . ' ' . $alt['level'] . ' ' . $alt['class'] . ')</a><br />';
}
}
setTooltip('alt_html', $html);
setTooltip('alt_cap', $caption);
$alt_hover = ' style="cursor:pointer;" onmouseover="return overlib(overlib_alt_html,CAPTION,overlib_alt_cap);" ' . 'onclick="return overlib(overlib_alt_html,CAPTION,overlib_alt_cap,STICKY,OFFSETX,-10,OFFSETY,-10,NOCLOSE);" ' . 'onmouseout="return nd();"';
}
}
}
$roster->tpl->assign_var('ALT_TOOLTIP', $alt_hover);
}
示例2: getAV
function getAV($user)
{
global $roster;
$user_is_active = active_addon('user');
$siggen_is_active = active_addon('siggen');
$av = null;
if ($user_is_active == 1 && $siggen_is_active == 1) {
$query = 'SELECT * FROM `' . $roster->db->table('user_members') . '` AS user ' . 'LEFT JOIN `' . $roster->db->table('profile', 'user') . '` AS profile ON `user`.`id` = `profile`.`uid` ' . 'WHERE `user`.`usr` = "' . $user . '" ';
$result = $roster->db->query($query);
$rw = $roster->db->fetch($result);
if (!empty($rw['avatar'])) {
$av = '<img src="' . urldecode($rw['avatar']) . '" ></a>';
}
}
return $av;
}
示例3: exit
# You should have received a copy of the Affero General Public License
# along with this program; if not, download it from http://www.affero.org/
// Multiple edits done for WoWRoster
if (!defined('IN_ROSTER')) {
exit('Detected invalid access to this file!');
}
include ROSTER_LIB . 'item.php';
if (isset($_GET['mode'])) {
$gbank_mode = $_GET['mode'] == 'inv' ? '2' : '1';
$gbank_mode = $_GET['mode'] == 'full' ? '1' : '2';
} else {
$gbank_mode = $addon['config']['guildbank_ver'];
}
$columns = $gbank_mode == '2' ? '15' : '2';
$roster->output['title'] = $roster->locale->act['guildbank'];
$roster->tpl->assign_vars(array('U_FULL' => makelink('&mode=full'), 'U_INV' => makelink('&mode=inv'), 'S_MONEY' => (bool) $addon['config']['bank_money'], 'S_INFO_ADDON' => active_addon('info'), 'S_COLUMNS' => $columns, 'S_MODE' => $gbank_mode, 'L_GUILDBANK' => $roster->locale->act['guildbank'], 'L_LIST' => $roster->locale->act['gbank_list'], 'L_INV' => $roster->locale->act['gbank_inv'], 'L_TOTAL_MONEY' => $roster->locale->act['guildbank_totalmoney'], 'L_LAST_UPDATED' => $roster->locale->act['lastupdate']));
$muleNameQuery = "SELECT m.member_id, m.name AS member_name, m.note AS member_note, m.officer_note AS member_officer_note, p.money_g AS gold, p.money_s AS silver, p.money_c AS copper, p.clientLocale, p.dateupdatedutc" . " FROM `" . $roster->db->table('players') . "` AS p, `" . $roster->db->table('members') . "` AS m" . " WHERE m." . $addon['config']['banker_fieldname'] . " LIKE '%" . $addon['config']['banker_rankname'] . "%' AND p.member_id = m.member_id AND m.guild_id = " . $roster->data['guild_id'] . " ORDER BY m.name;";
$muleNames = $roster->db->query($muleNameQuery);
if ($addon['config']['bank_money']) {
$mulemoney = $roster->db->fetch($roster->db->query("SELECT SUM( p.money_g ) AS gold, SUM( p.money_s ) AS silver, SUM( p.money_c ) AS copper" . " FROM `" . $roster->db->table('players') . "` AS p, `" . $roster->db->table('members') . "` AS m" . " WHERE m." . $addon['config']['banker_fieldname'] . " LIKE '%" . $addon['config']['banker_rankname'] . "%'" . " AND p.member_id = m.member_id AND m.guild_id = " . $roster->data['guild_id'] . " ORDER BY m.name;"));
$addsilver = 0;
if ($mulemoney['copper'] >= 100) {
$mulemoney['copper'] = $mulemoney['copper'] / 100;
$addsilver = (int) $mulemoney['copper'];
$mulemoney['copper'] = explode('.', $mulemoney['copper']);
$mulemoney['copper'] = $mulemoney['copper'][1];
}
$mulemoney['silver'] = $mulemoney['silver'] + $addsilver;
$addgold = 0;
if ($mulemoney['silver'] >= 100) {
$mulemoney['silver'] = $mulemoney['silver'] / 100;
示例4: processAddon
/**
* Addon installer/upgrader/uninstaller
*
*/
function processAddon()
{
global $roster, $installer;
$addon_name = $_POST['addon'];
if (preg_match('/[^a-zA-Z0-9_]/', $addon_name)) {
$installer->seterrors($roster->locale->act['invalid_char_module'], $roster->locale->act['installer_error']);
return;
}
// Check for temp tables
//$old_error_die = $roster->db->error_die(false);
if (false === $roster->db->query("CREATE TEMPORARY TABLE `test` (id int);")) {
$installer->temp_tables = false;
$roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '0' WHERE `id` = 1180;");
} else {
$installer->temp_tables = true;
}
//$roster->db->error_die($old_error_die);
// Include addon install definitions
$addonDir = ROSTER_ADDONS . $addon_name . DIR_SEP;
$addon_install_file = $addonDir . 'inc' . DIR_SEP . 'install.def.php';
$install_class = $addon_name . 'Install';
if (!file_exists($addon_install_file)) {
$installer->seterrors(sprintf($roster->locale->act['installer_no_installdef'], $addon_name), $roster->locale->act['installer_error']);
return;
}
require $addon_install_file;
$addon = new $install_class();
$addata = escape_array((array) $addon);
$addata['basename'] = $addon_name;
if ($addata['basename'] == '') {
$installer->seterrors($roster->locale->act['installer_no_empty'], $roster->locale->act['installer_error']);
return;
}
// Get existing addon record if available
$query = 'SELECT * FROM `' . $roster->db->table('addon') . '` WHERE `basename` = "' . $addata['basename'] . '";';
$result = $roster->db->query($query);
if (!$result) {
$installer->seterrors(sprintf($roster->locale->act['installer_fetch_failed'], $addata['basename']) . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error']);
return;
}
$previous = $roster->db->fetch($result);
$roster->db->free_result($result);
// Give the installer the addon data
$installer->addata = $addata;
$success = false;
// 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 . $addata['basename'] . DIR_SEP . 'locale' . DIR_SEP . $lang . '.php', $lang);
}
// Collect data for this install type
switch ($_POST['type']) {
case 'install':
if ($previous) {
$installer->seterrors(sprintf($roster->locale->act['installer_addon_exist'], $installer->addata['basename'], $previous['fullname']));
break;
}
// check to see if any requred addons if so and not enabled disable addon after install and give a message
if (isset($installer->addata['requires'])) {
if (!active_addon($installer->addata['requires'])) {
$installer->addata['active'] = false;
$installer->setmessages('Addon Dependency "' . $installer->addata['requires'] . '" not active or installed, "' . $installer->addata['fullname'] . '" has been disabled');
break;
}
}
$query = 'INSERT INTO `' . $roster->db->table('addon') . '` VALUES (NULL,"' . $installer->addata['basename'] . '","' . $installer->addata['version'] . '","' . (int) $installer->addata['active'] . '",0,"' . $installer->addata['fullname'] . '","' . $installer->addata['description'] . '","' . $roster->db->escape(serialize($installer->addata['credits'])) . '","' . $installer->addata['icon'] . '","' . $installer->addata['wrnet_id'] . '",NULL);';
$result = $roster->db->query($query);
if (!$result) {
$installer->seterrors('DB error while creating new addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
break;
}
$installer->addata['addon_id'] = $roster->db->insert_id();
// We backup the addon config table to prevent damage
$installer->add_backup($roster->db->table('addon_config'));
$success = $addon->install();
// Delete the addon record if there is an error
if (!$success) {
$query = 'DELETE FROM `' . $roster->db->table('addon') . "` WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
$result = $roster->db->query($query);
} else {
$installer->sql[] = 'UPDATE `' . $roster->db->table('addon') . '` SET `active` = ' . (int) $installer->addata['active'] . " WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
$installer->sql[] = "INSERT INTO `" . $roster->db->table('permissions') . "` VALUES ('', 'roster', '" . $installer->addata['addon_id'] . "', 'addon', '" . $installer->addata['fullname'] . "', 'addon_access_desc' , '" . $installer->addata['basename'] . "_access');";
}
break;
case 'upgrade':
if (!$previous) {
$installer->seterrors(sprintf($roster->locale->act['installer_no_upgrade'], $installer->addata['basename']));
break;
}
/* Carry Over from AP branch
if( !in_array($previous['basename'],$addon->upgrades) )
{
$installer->seterrors(sprintf($roster->locale->act['installer_not_upgradable'],$addon->fullname,$previous['fullname'],$previous['basename']));
break;
//.........这里部分代码省略.........
示例5: spec_icon
/**
* Controls Output of the Talent Spec Column
*
* @param array $row - of character data
* @return string - Formatted output
*/
function spec_icon($row)
{
global $roster, $addon;
$cell_value = '';
// Don't proceed for characters without data
if (!isset($row['talents']) || $row['talents'] == '') {
return '<img class="membersRowimg" width="' . $addon['config']['icon_size'] . '" height="' . $addon['config']['icon_size'] . '" src="' . $roster->config['img_url'] . 'pixel.gif" alt="" />';
}
$lang = $row['clientLocale'];
$talents = explode(',', $row['talents']);
$spec = $specicon = '';
$tooltip = array();
$specpoint = 0;
foreach ($talents as $talent) {
list($name, $points, $icon) = explode('|', $talent);
$tooltip[] = $points;
if ($points > $specpoint) {
$specpoint = $points;
$spec = $name;
$specicon = $icon;
}
}
$tooltip = implode(' / ', $tooltip);
$specicon = '<img class="membersRowimg" width="' . $addon['config']['icon_size'] . '" height="' . $addon['config']['icon_size'] . '" src="' . $roster->config['img_url'] . 'spec/' . $specicon . '.' . $roster->config['img_suffix'] . '" alt="" ' . makeOverlib($tooltip, $spec, '', 1, '', ',RIGHT,WRAP') . ' />';
if (active_addon('info')) {
$cell_value .= '<a href="' . makelink('char-info-talents&a=c:' . $row['member_id']) . '">' . $specicon . '</a>';
} else {
$cell_value .= $specicon;
}
return $cell_value;
}
示例6: array
$resulta = $roster->db->query($querya);
if ($resulta) {
$row = $roster->db->fetch($resulta);
$rank = $row['guild_rank'];
} else {
$rank = '';
}
$data = array('usr' => $_POST['username'], 'pass' => $pass, 'email' => $email, 'regIP' => $_SERVER['REMOTE_ADDR'], 'dt' => $roster->db->escape(gmdate('Y-m-d H:i:s')), 'access' => '0:' . $rank, 'active' => '1');
$query = 'INSERT INTO `' . $roster->db->table('user_members') . '` ' . $roster->db->build_query('INSERT', $data);
// user link table i was hoping to NOT use this....
if ($roster->db->query($query)) {
$uuid = $roster->db->insert_id();
$roster->set_message('You are registered and can now login', 'User Register:', 'notice');
$querya = "SELECT `name`,`guild_id`,`server`,`region`,`member_id` FROM `" . $roster->db->table('members') . "` WHERE `name` = '" . $_POST['username'] . "';";
$resulta = $roster->db->query($querya);
if (active_addon('user')) {
$a = "INSERT INTO `" . $roster->db->table('profile', 'user') . "` (`uid`, `signature`, `avatar`, `avsig_src`, `show_fname`, `show_lname`, `show_email`, `show_city`, `show_country`, `show_homepage`, `show_notes`, `show_joined`, `show_lastlogin`, `show_chars`, `show_guilds`, `show_realms`) VALUES ('{$uuid}', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0');";
$aa = $roster->db->query($a);
}
if (!$resulta) {
die_quietly($roster->db->error, 'user Profile', __FILE__, __LINE__, $querya);
}
echo $roster->auth->getLoginForm();
return;
} else {
$roster->set_message('There was a DB error while creating your user.', '', 'error');
$roster->set_message('<pre>' . $roster->db->error() . '</pre>', 'MySQL Said', 'error');
}
}
} else {
$roster->set_message($roster->locale->act['user_user']['msg31'], $roster->locale->act['user_page']['register'], 'error');
示例7: exit
* WoWRoster.net WoWRoster
*
* Lists quests for each character
*
*
* @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 QuestList
*/
if (!defined('IN_ROSTER')) {
exit('Detected invalid access to this file!');
}
$roster->output['title'] = $roster->locale->act['questlist'];
$roster->tpl->assign_vars(array('S_INFO_ADDON' => active_addon('info'), 'S_SHOW' => false, 'L_QUEST_LIST' => $roster->locale->act['questlist'], 'L_QUEST_LIST_HELP' => $roster->locale->act['questlist_help'], 'L_SEARCH_ZONE' => $roster->locale->act['search_by_zone'], 'L_SEARCH_QUEST' => $roster->locale->act['search_by_quest'], 'L_NAME' => $roster->locale->act['name'], 'L_QUEST_DATA' => $roster->locale->act['quest_data'], 'L_COMPLETE' => $roster->locale->act['complete'], 'L_FAILED' => $roster->locale->act['failed'], 'L_DAILY' => $roster->locale->act['daily']));
$zoneid = isset($_GET['zoneid']) ? $_GET['zoneid'] : '';
$questid = isset($_GET['questid']) ? $_GET['questid'] : '';
// The next two lines call the function selectQuery and use it to populate and return the code that lists the dropboxes for quests and for zones
selectQuery('`' . $roster->db->table('quests') . "` AS quests LEFT JOIN `" . $roster->db->table('quest_data') . "` AS quest_data ON `quests`.`quest_id` = `quest_data`.`quest_id` LEFT JOIN `" . $roster->db->table('players') . "` AS players ON `players`.`member_id` = `quests`.`member_id` WHERE `players`.`server` = '" . $roster->db->escape($roster->data['server']) . "' AND `quests`.`member_id` = `players`.`member_id`", 'DISTINCT `quest_data`.`zone`', 'zone', $zoneid, '&zoneid');
selectQuery('`' . $roster->db->table('quests') . "` AS quests LEFT JOIN `" . $roster->db->table('quest_data') . "` AS quest_data ON `quests`.`quest_id` = `quest_data`.`quest_id` LEFT JOIN `" . $roster->db->table('players') . "` AS players ON `players`.`member_id` = `quests`.`member_id` WHERE `players`.`server` = '" . $roster->db->escape($roster->data['server']) . "' AND `quests`.`member_id` = `players`.`member_id`", 'DISTINCT `quest_data`.`quest_name`', 'quest_name', $questid, '&questid');
if (!empty($zoneid)) {
$sql = "SELECT DISTINCT `zone` FROM `" . $roster->db->table('quest_data') . "` WHERE `zone` = '{$zoneid}' ORDER BY `zone`;";
$zone = $roster->db->query_first($sql) or die_quietly($roster->db->error(), 'Database Error', __FILE__, __LINE__, $sql);
// Set our questlink caption name
setTooltip('questlink', $roster->locale->act['quest_links']);
$roster->tpl->assign_vars(array('S_SHOW' => true, 'ZONE_NAME' => $zone));
$qquery = "SELECT *" . " FROM `" . $roster->db->table('quest_data') . "`" . " WHERE `zone` = '" . $zoneid . "'" . " ORDER BY `quest_name`;";
$qresult = $roster->db->query($qquery) or die_quietly($roster->db->error(), 'Database Error', __FILE__, __LINE__, $qquery);
while ($qrow = $roster->db->fetch($qresult)) {
$query = "SELECT `q`.*, `p`.`name`, `p`.`server`, `p`.`member_id`, `p`.`level`" . " FROM `" . $roster->db->table('quests') . "` AS q, `" . $roster->db->table('players') . "` AS p" . " WHERE `p`.`server` = '" . $roster->db->escape($roster->data['server']) . "' AND `q`.`quest_id` = '" . $qrow['quest_id'] . "' AND `q`.`member_id` = `p`.`member_id`" . " ORDER BY `p`.`level` DESC, `p`.`name` ASC;";
示例8: selectGen
/**
* Make select box of characters for main selection
*/
function selectGen($uid)
{
global $roster, $addon, $user, $uid;
$query = "SELECT `avsig_src` FROM `" . $roster->db->table('profile', 'user') . "` WHERE `uid` = " . $uid . ";";
$result = $roster->db->query($query);
if (!$result) {
die_quietly($roster->db->error, 'user Profile', __FILE__, __LINE__, $query);
}
$src = '';
while ($row = $roster->db->fetch($result)) {
$src = $row['avsig_src'];
}
$input_field = '<select name="select:avsig_src">' . "\n";
$sigGen = active_addon('siggen');
if ($sigGen == 1 && $src == 'SigGen') {
$input_field .= ' <option value="SigGen" selected="selected">SigGen</option>' . "\n";
$input_field .= ' <option value="default">Default</option>' . "\n";
} elseif ($sigGen == 1 && $src == 'default' || $src == '') {
$input_field .= ' <option value="default" selected="selected">Default</option>' . "\n";
$input_field .= ' <option value="SigGen">SigGen</option>' . "\n";
} else {
$input_field .= ' <option value="default" selected="selected">Default</option>' . "\n";
}
$input_field .= '</select>';
return $input_field;
}
示例9: exit
* Completely rewritten by vgjunkie 2006-09-14
*
* LICENSE: Licensed under the Creative Commons
* "Attribution-NonCommercial-ShareAlike 2.5" license
*
* @copyright 2002-2008 WoWRoster.net
* @license http://creativecommons.org/licenses/by-nc-sa/2.5 Creative Commons "Attribution-NonCommercial-ShareAlike 2.5"
* @version SVN: $Id: index.php 1791 2008-06-15 16:59:24Z Zanix $
* @link http://www.wowroster.net
* @package Professions
*/
if (!defined('IN_ROSTER')) {
exit('Detected invalid access to this file!');
}
$roster->output['title'] = $roster->locale->act['professions'];
$roster->tpl->assign_vars(array('S_HIDE' => $addon['config']['collapse_list'], 'S_INFO_ADDON' => active_addon('info'), 'L_PROFESSIONS' => $roster->locale->act['professions'], 'L_LEVEL' => $roster->locale->act['level'], 'L_NAME' => $roster->locale->act['name']));
// Build a list of "Skills" to look for
$inClause = "'";
foreach ($roster->multilanguages as $lang) {
$inClause .= implode("', '", $roster->locale->wordings[$lang]['tsArray']);
$inClause .= "', '";
}
$inClause .= "'";
// If we don't want to show skills with a "1" value, uncomment this line (make option in config?)
$showNewSkill = $addon['config']['show_new_skills'] ? " AND SUBSTRING_INDEX(`s`.`skill_level`, ':', 1 ) > 1 " : '';
// Gather a list of players that have the skills we are looking for
$query = "SELECT `s`.*, `p`.`name`, `p`.`clientLocale`, `p`.`member_id` FROM `" . $roster->db->table('skills') . "` AS s, `" . $roster->db->table('players') . "` AS p" . " WHERE `p`.`member_id` = `s`.`member_id`" . " AND `p`.`guild_id` = '" . $roster->data['guild_id'] . "'" . $showNewSkill . " AND `skill_name` IN ({$inClause})" . " ORDER BY `s`.`skill_type`, `s`.`skill_name`,(mid(`skill_level` FROM 1 FOR (locate(':', `skill_level`)-1)) + 0) DESC, `p`.`name`;";
$result = $roster->db->query($query) or die_quietly($roster->db->error(), 'Database Error', __FILE__, __LINE__, $query);
if ($roster->db->num_rows($result)) {
while ($row = $roster->db->fetch($result)) {
$skill_name = $row['skill_name'];
示例10: tradeskill_icons
/**
* Controls Output of the Tradeskill Icons Column
*
* @param array $row - of character data
* @return string - Formatted output
*/
function tradeskill_icons($row)
{
global $roster;
//$addon = getaddon('memberslist');
$cell_value = '';
// Don't proceed for characters without data
if ($row['clientLocale'] == '') {
return '<div> </div>';
}
$lang = $row['clientLocale'];
$profs = explode(',', $row['professions']);
foreach ($profs as $prof) {
$r_prof = explode('|', $prof);
$toolTip = isset($r_prof[1]) ? str_replace(':', '/', $r_prof[1]) : '';
$toolTiph = $r_prof[0];
if ($r_prof[0] == $roster->locale->wordings[$lang]['riding']) {
if ($row['class'] == $roster->locale->wordings[$lang]['Paladin'] || $row['class'] == $roster->locale->wordings[$lang]['Warlock']) {
$icon = $roster->locale->wordings[$lang]['ts_ridingIcon'][$row['class']];
} else {
$icon = $roster->locale->wordings[$lang]['ts_ridingIcon'][$row['race']];
}
} else {
$icon = isset($roster->locale->wordings[$lang]['ts_iconArray'][$r_prof[0]]) ? $roster->locale->wordings[$lang]['ts_iconArray'][$r_prof[0]] : '';
}
// Don't add professions we don't have an icon for. This keeps other skills out.
if ($icon != '') {
$icon = '<img class="membersRowimg" width="20" height="20" src="' . $roster->config['interface_url'] . 'Interface/Icons/' . $icon . '.' . $roster->config['img_suffix'] . '" alt="" ' . makeOverlib($toolTip, $toolTiph, '', 2, '', ',RIGHT,WRAP') . ' />';
if (active_addon('info')) {
$cell_value .= '<a href="' . makelink('char-info-recipes&a=c:' . $row['member_id'] . '#' . strtolower(str_replace(' ', '', $r_prof[0]))) . '">' . $icon . '</a>';
} else {
$cell_value .= $icon;
}
}
}
return $cell_value;
}
示例11: roster_add_js
}
}
if ($stage == 1) {
$roster->tpl->assign_vars(array('STAGE' => $stage, 'TEXT' => 'stage 1'));
$js = "\n\t\n\t\t\n\t";
roster_add_js($js, 'inline', 'header', false, false);
}
if ($stage == 3) {
$roster->tpl->assign_vars(array('STAGE' => $stage, 'TEXT' => 'Select the character to be your main char'));
$query = "SELECT * FROM `" . $roster->db->table('user_link', 'user') . "` WHERE `uid` = '" . $roster->auth->user['id'] . "';";
$result = $roster->db->query($query);
if (!$result) {
die_quietly($roster->db->error, 'claim alt', __FILE__, __LINE__, $query);
}
while ($row = $roster->db->fetch($result)) {
$roster->tpl->assign_block_vars('chars', array('THUMB' => 'http://us.battle.net/static-render/us/' . $row['thumbnail'], 'NAME' => $row['name'], 'ID' => $row['link_id'], 'LEVEL' => $row['level'], 'RACE' => $row['race'], 'GENDER' => $row['gender'], 'SERVER' => $row['realm'], 'GUILD' => $row['guild'], 'IS_MAIN' => (bool) $row['is_main'], 'CLASS' => $roster->locale->act['id_to_class'][$row['class']], 'PROFILE' => active_addon('info') && $row['server'] && $row['member_id'] != 0 ? makelink('char-info&a=c:' . $row['member_id']) : ''));
}
}
$roster->tpl->set_filenames(array('alt' => $addon['basename'] . '/alt.html'));
$roster->tpl->display('alt');
function getcharid($name, $server)
{
global $roster, $addon;
$mid = array();
$sql = 'SELECT `member_id`,`name`,`server`,`guild_id` FROM `' . $roster->db->table('members') . '` WHERE `name` = "' . $name . '" AND `server` = "' . $server . '"';
$query = $roster->db->query($sql);
while ($row = $roster->db->fetch($query)) {
$mid = array('member_id' => $row['member_id'], 'name' => $row['name'], 'server' => $row['server'], 'guild_id' => $row['guild_id']);
}
return $mid;
}
示例12: spec_icon
/**
* Controls Output of the Talent Spec Column
*
* @param array $row - of character data
* @return string - Formatted output
*/
function spec_icon($row)
{
global $roster;
$cell_value = '';
// Don't proceed for characters without data
if (!isset($row['talents']) || $row['talents'] == '') {
return '<img class="middle" width="24" height="24" src="' . $roster->config['img_url'] . 'pixel.gif" alt="" />';
}
$talents = explode(',', $row['talents']);
$talent2 = explode(',', $row['talents2']);
$_d = array();
foreach ($talent2 as $tal) {
list($name, $role, $icon) = explode('|', $tal);
$_d[$name]['role'] = $role;
$_d[$name]['name'] = $name;
$_d[$name]['icon'] = $icon;
}
$_t = array();
$specicon = '';
$notalent = true;
foreach ($talents as $talent) {
list($_s, $name, $points, $icon, $_b) = explode('|', $talent);
$_t[$_b]['tip'][] = $name . ' - ' . $points;
if (!isset($_t[$_b]['point']) || $points > $_t[$_b]['point']) {
$_t[$_b]['point'] = $points;
$_t[$_b]['name'] = $name;
$_t[$_b]['icon'] = strtolower($_d[$name]['icon']);
$notalent = false;
}
}
if (!$notalent) {
$tooltip = $icon = '';
foreach ($_t as $idx => $build) {
$icon = '<span class="item-sm"><img src="' . $roster->config['interface_url'] . 'Interface/Icons/' . $build['icon'] . '.' . $roster->config['img_suffix'] . '" alt="" /><span class="mask"></span></span> ';
$tooltip .= $icon . implode(' / ', $build['tip']) . '<br />';
}
$tooltip = '<div style="font-size:12px;font-weight:bold;">' . $tooltip . '</div>';
$specicon = '<div class="item-sm" ' . makeOverlib($tooltip, $_t[1]['name'], '', 2, '', ',WRAP') . '><img src="' . $roster->config['interface_url'] . 'Interface/Icons/' . $_t[1]['icon'] . '.' . $roster->config['img_suffix'] . '" alt="" /><div class="mask"></div></div>';
}
if (active_addon('info')) {
$cell_value .= '<a href="' . makelink('char-info&a=c:' . $row['member_id'] . '&t=talents') . '">' . $specicon . '</a>';
} else {
$cell_value .= $specicon;
}
return $cell_value;
}
示例13: charsPage
function charsPage()
{
global $roster, $addon, $user;
// Disallow viewing of the page
if (!$roster->auth->allow_login) {
print '<span class="title_text">' . $roster->locale->act['user_page']['chars'] . '</span><br />' . $roster->auth->getMessage() . $roster->auth->getLoginForm();
} else {
$query = "SELECT * FROM `" . $roster->db->table('user_link', 'user') . "` WHERE `uid` = '" . $roster->auth->user['id'] . "';";
$result = $roster->db->query($query);
if (!$result) {
die_quietly($roster->db->error, 'claim alt', __FILE__, __LINE__, $query);
}
while ($row = $roster->db->fetch($result)) {
$roster->tpl->assign_block_vars('chars', array('THUMB' => 'http://us.battle.net/static-render/us/' . $row['thumbnail'], 'NAME' => $row['name'], 'LEVEL' => $row['level'], 'RACE' => $row['race'], 'GENDER' => $row['gender'], 'SERVER' => $row['realm'], 'GUILD' => $row['guild'], 'IS_MAIN' => (bool) $row['is_main'], 'CLASS' => $roster->locale->act['id_to_class'][$row['class']], 'PROFILE' => active_addon('info') && $row['realm'] && $row['member_id'] != 0 ? makelink('char-info&a=c:' . $row['member_id']) : ''));
}
$roster->tpl->set_filenames(array('user_chars' => $addon['basename'] . '/chars.html'));
$roster->tpl->display('user_chars');
}
}
示例14: processPlugin
function processPlugin()
{
global $roster, $installer;
$addon_name = $_POST['addon'];
$addon_parent = $_POST['addonparent'];
$addon_file = $_POST['addonfile'];
if (preg_match('/[^a-zA-Z0-9_]/', $addon_name)) {
$installer->seterrors($roster->locale->act['invalid_char_module'], $roster->locale->act['installer_error']);
return;
}
if (false === $roster->db->query("CREATE TEMPORARY TABLE `test` (id int);")) {
$installer->temp_tables = false;
$roster->db->query("UPDATE `" . $roster->db->table('config') . "` SET `config_value` = '0' WHERE `id` = 1180;");
} else {
$installer->temp_tables = true;
}
$addonDir = ROSTER_PLUGINS . $addon_name . DIR_SEP;
$addon_install_file = $addonDir . 'install.def.php';
$install_class = $addon_name . 'Install';
if (!file_exists($addon_install_file)) {
$installer->seterrors(sprintf($roster->locale->act['installer_no_installdef'], $addon_name), $roster->locale->act['installer_error']);
return;
}
require $addon_install_file;
$addon = new $install_class();
$addata = escape_array((array) $addon);
$addata['basename'] = $addon_name;
if ($addata['basename'] == '') {
$installer->seterrors($roster->locale->act['installer_no_empty'], $roster->locale->act['installer_error']);
return;
}
// Get existing addon record if available
$query = 'SELECT * FROM `' . $roster->db->table('plugin') . '` WHERE `basename` = "' . $addata['basename'] . '";';
$result = $roster->db->query($query);
if (!$result) {
$installer->seterrors(sprintf($roster->locale->act['installer_fetch_failed'], $addata['basename']) . '.<br />MySQL said: ' . $roster->db->error(), $roster->locale->act['installer_error']);
return;
}
$previous = $roster->db->fetch($result);
$roster->db->free_result($result);
// Give the installer the addon data
$installer->addata = $addata;
$success = false;
// Collect data for this install type
switch ($_POST['type']) {
case 'install':
if ($previous) {
$installer->seterrors(sprintf($roster->locale->act['installer_addon_exist'], $installer->addata['basename'], $previous['fullname']));
break;
}
// check to see if any requred addons if so and not enabled disable addon after install and give a message
if (isset($installer->addata['requires'])) {
if (!active_addon($installer->addata['requires'])) {
$installer->addata['active'] = false;
$installer->setmessages('Addon Dependency "' . $installer->addata['requires'] . '" not active or installed, "' . $installer->addata['fullname'] . '" has been disabled');
break;
}
}
$query = 'INSERT INTO `' . $roster->db->table('plugin') . '` VALUES
(NULL,"' . $installer->addata['basename'] . '",
"' . $installer->addata['parent'] . '",
"' . $installer->addata['scope'] . '",
"' . $installer->addata['version'] . '",
"' . (int) $installer->addata['active'] . '",
0,
"' . $installer->addata['fullname'] . '",
"' . $installer->addata['description'] . '",
"' . $roster->db->escape(serialize($installer->addata['credits'])) . '",
"' . $installer->addata['icon'] . '",
"' . $installer->addata['wrnet_id'] . '",NULL);';
$result = $roster->db->query($query);
if (!$result) {
$installer->seterrors('DB error while creating new addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
break;
}
$installer->addata['addon_id'] = $roster->db->insert_id();
// We backup the addon config table to prevent damage
$installer->add_backup($roster->db->table('plugin_config'));
$success = $addon->install();
// Delete the addon record if there is an error
if (!$success) {
$query = 'DELETE FROM `' . $roster->db->table('plugin') . "` WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
$result = $roster->db->query($query);
} else {
$installer->sql[] = 'UPDATE `' . $roster->db->table('plugin') . '` SET `active` = ' . (int) $installer->addata['active'] . " WHERE `addon_id` = '" . $installer->addata['addon_id'] . "';";
}
break;
case 'upgrade':
if (!$previous) {
$installer->seterrors(sprintf($roster->locale->act['installer_no_upgrade'], $installer->addata['basename']));
break;
}
$query = "UPDATE `" . $roster->db->table('plugin') . "` SET `basename`='" . $installer->addata['basename'] . "', `version`='" . $installer->addata['version'] . "', `active`=" . (int) $installer->addata['active'] . ", `fullname`='" . $installer->addata['fullname'] . "', `description`='" . $installer->addata['description'] . "', `credits`='" . serialize($installer->addata['credits']) . "', `icon`='" . $installer->addata['icon'] . "', `wrnet_id`='" . $installer->addata['wrnet_id'] . "' WHERE `addon_id`=" . $previous['addon_id'] . ';';
$result = $roster->db->query($query);
if (!$result) {
$installer->seterrors('DB error while updating the addon record. <br /> MySQL said:' . $roster->db->error(), $roster->locale->act['installer_error']);
break;
}
$installer->addata['addon_id'] = $previous['addon_id'];
// We backup the addon config table to prevent damage
//.........这里部分代码省略.........
示例15: setAvSig
function setAvSig($id = '', $mid, $src = '')
{
global $roster, $addon, $user;
//echo $id.' - '.$mid.'<br>';
if (!is_null($id) || $id > 0) {
$uid = $id;
} else {
$uid = $user->session->getVal('uid');
}
$user = $user->user->getUser($uid);
if ($mid > 0 && $mid != '') {
$sql = 'SELECT `name` FROM `' . $roster->db->table('members') . '` WHERE `member_id` = ' . $mid;
$query = $roster->db->query($sql);
while ($row = $roster->db->fetch($query)) {
$char = $row['name'];
}
} elseif ($mid != '') {
$char = $mid;
}
$hasMain = $this->getMain($uid);
if (is_null($src)) {
$this->getConfigData($uid);
$src = $this->configData['avsig_src'];
}
$is_active = active_addon('siggen');
$c = array('signature', 'avatar');
foreach ($c as $case) {
if ($hasMain == false) {
die_quietly("You do not have a main character set. Please set your main character and try again.");
} else {
if ($is_active == 1 && $src == 'SigGen') {
$sql = 'SELECT `region`, `realm` FROM `' . $roster->db->table('user_link', 'user') . '` WHERE `uid` = ' . $uid . ' AND `member_id` = ' . $mid;
$query = $roster->db->query($sql);
while ($row = $roster->db->fetch($query)) {
$link = makelink('util-siggen-' . $case . '&member=' . $char . '@' . $row['region'] . '-' . $row['realm'], 'url');
}
} elseif ($is_active == 0 && $src == 'SigGen') {
die_quietly("SigGen is not installed! Please install SigGen and try again.<br />");
} elseif ($src == 'default') {
$sql = 'SELECT `race`, `sex` FROM `' . $roster->db->table('players') . '` WHERE `member_id` = ' . $mid;
$query = $roster->db->query($sql);
while ($row = $roster->db->fetch($query)) {
$link = $addon['image_url'] . str_replace(' ', '', $row['race']) . '-' . $row['sex'] . '.png';
}
}
}
switch ($case) {
case 'signature':
$sql = 'UPDATE `' . $roster->db->table('profile', 'user') . '` SET `signature` = "' . urlencode($link) . '" WHERE `uid` = ' . $uid;
$roster->db->query($sql);
break;
case 'avatar':
$sql = 'UPDATE `' . $roster->db->table('profile', 'user') . '` SET `avatar` = "' . urlencode($link) . '" WHERE `uid` = ' . $uid;
$roster->db->query($sql);
break;
default:
$sql = 'UPDATE `' . $roster->db->table('profile', 'user') . '` SET `avatar` = "' . urlencode($link) . '" WHERE `uid` = ' . $uid;
$roster->db->query($sql);
break;
}
}
//echo 'i worked<br>';
return true;
}