/** * View Bossprogress page * @param viewNavigation $Navigation */ public function buildpage(viewNavigation $Navigation) { global $phpbb_root_path, $phpEx, $user, $template, $config; $igame = new \bbdkp\controller\games\Game(); $igame->game_id = $Navigation->getGameId(); $igame->Get(); $Guild = new \bbdkp\controller\guilds\Guilds($Navigation->getGuildId()); $bp = new \bbdkp\controller\Raids\GuildProgress(); $data = $bp->GetProgress($Guild); $numzones = 0; foreach ($data as $zone_id => $zone) { $numzones += 1; } $start = request_var('start', 0); $template->assign_vars(array('S_STYLE' => $config['bbdkp_zone_style'], 'S_BPSHOW' => true, 'GAMELOGO' => $phpbb_root_path . 'images/bbdkp/gameworld/' . $Guild->game_id . '/' . $Guild->game_id . '.png', 'F_BP' => \append_sid("{$phpbb_root_path}dkp.{$phpEx}", 'page=bossprogress&guild_id=' . $Navigation->getGuildId()), 'GAME_ID' => $Navigation->getGameId(), 'GAME_NAME' => $igame->getName(), 'GUILD_ID' => $Guild->guildid, 'PAGE_NUMBER' => \on_page($numzones, 2, $start), 'PAGINATION' => \generate_pagination(append_sid("{$phpbb_root_path}dkp.{$phpEx}", "page=bossprogress&guild_id=" . $Guild->guildid), $numzones, 2, $start, true), 'U_BPIMG' => "{$phpbb_root_path}images/bbdkp/gameworld/{$Navigation->getGameId()}/{$Navigation->getGameId()}.png")); $i = 0; $j = 0; //loop the zones foreach ($data as $zone_id => $zone) { $i += 1; if ($i >= $start) { $j += 1; //show max 2 zones per page if ($j <= 2) { $template->assign_block_vars('zone', array('ZONE_NAME' => $zone['zonename'], 'ZONE_ID' => $zone['zoneid'], 'ZONE_PROGRESSIMG' => $zone['zoneimage'], 'ZONE_BACKGROUNDIMG' => $zone['zonebackground'], 'ZONECOMPLETE' => $zone['zonecomplete'], 'ZONESTATS' => $zone['zonestats'])); foreach ($zone['bosses'] as $boss_id => $boss) { $killdate = ''; if ($boss['bosskilldate'] != '') { $killdate = date($config['bbdkp_date_format'], $boss['bosskilldate']); // convert UNIX timestamp to PHP DateTime } if ($boss['bosskilled'] == 0) { $bossimg = "{$phpbb_root_path}images/bbdkp/gameworld/" . $Guild->game_id . '/bosses/' . $boss['imagename'] . '_b.png'; } else { $bossimg = "{$phpbb_root_path}images/bbdkp/gameworld/" . $Guild->game_id . '/bosses/' . $boss['imagename'] . '.png'; } $template->assign_block_vars('zone.boss', array('BOSS_NAME' => $boss['bossname'], 'BOSS_IMAGENAME' => $bossimg, 'BOSS_ID' => $boss['id'], 'BOSS_WEBID' => $boss['webid'], 'BOSS_TYPE' => $boss['type'], 'BOSS_URL' => sprintf($igame->getBossbaseurl(), $boss['webid']), 'BOSS_URLVIEW' => $phpbb_root_path . "images/bbdkp/icons/view.gif", 'BOSS_KILLED' => $boss['bosskilled'] == 1 ? 'checked="checked"' : '', 'BOSS_SHOW' => $boss['bossshow'] == 1 ? "checked=checked" : '', 'BOSS_KILLDATE' => $killdate, 'BOSS_COUNTER' => $boss['bosscounter'], 'S_BOSS_KILLED' => $boss['bosskilled'])); } } } } page_header($user->lang['MENU_BOSS']); }
function display_bpblock($guild_id) { global $config, $user, $phpbb_root_path, $template, $phpEx; //include the guilds class if (!class_exists('\\bbdkp\\controller\\guilds\\Guilds')) { require "{$phpbb_root_path}includes/bbdkp/controller/guilds/Guilds.{$phpEx}"; } $Guild = new \bbdkp\controller\guilds\Guilds($guild_id); if (!class_exists('\\bbdkp\\controller\\raids\\GuildProgress')) { require "{$phpbb_root_path}includes/bbdkp/controller/raids/BossProgress.{$phpEx}"; } $bp = new \bbdkp\controller\Raids\GuildProgress(); $igame = new \bbdkp\controller\games\Game(); $igame->game_id = $Guild->game_id; $igame->Get(); $data = $bp->GetProgress($Guild); //loop the zones foreach ($data as $zone_id => $zone) { if ((int) $zone['zonecomplete'] <= 0) { $cssclass = 'bpprogress00'; } elseif ((int) $zone['zonecomplete'] <= 25) { $cssclass = 'bpprogress25'; } elseif ((int) $zone['zonecomplete'] <= 50) { $cssclass = 'bpprogress50'; } elseif ((int) $zone['zonecomplete'] <= 75) { $cssclass = 'bpprogress75'; } elseif ((int) $zone['zonecomplete'] <= 99) { $cssclass = 'bpprogress99'; } elseif ((int) $zone['zonecomplete'] >= 100) { $cssclass = 'bpprogress100'; } $template->assign_block_vars('zone', array('ZONE_NAME' => $zone['zonename'], 'ZONE_ID' => $zone['zoneid'], 'ZONECOMPLETE' => $zone['zonecomplete'], 'ZONEKILLS' => $zone['zonekills'], 'BOSSCOUNT' => $zone['zonebosses'], 'ZONE_URL' => sprintf($igame->getZonebaseurl(), $zone['webid']), 'CSSCLASS' => $cssclass)); foreach ($zone['bosses'] as $boss_id => $boss) { $template->assign_block_vars('zone.boss', array('BOSS_NAME' => $boss['bossname'], 'BOSS_URL' => sprintf($igame->getBossbaseurl(), $boss['webid']), 'BOSS_KILLED' => $boss['bosskilled'] == "1" ? "1" : "0")); } } }
public function main($id, $mode) { global $cache, $user, $template, $config, $phpEx, $phpbb_admin_path, $phpbb_root_path; $user->add_lang(array('mods/dkp_admin', 'mods/dkp_common', 'mods/dkp_gameworld')); $template->assign_vars(array('BP_VERS' => $config['bbdkp_gameworld_version'])); $this->page_title = $user->lang['WORLDPROGRESS'] . ' ' . $config['bbdkp_gameworld_version']; $this->game_id = request_var('displaygame', request_var('game_id', '')); $this->igame = new games\Game(); $this->igame->game_id = $this->game_id; $this->igame->Get(); $this->gmlink = '<br /><a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld") . '"><h3>' . $user->lang['RETURN_DKPINDEX'] . '</h3></a>'; $this->zonelink = '<br /><a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&game_id=" . $this->game_id) . '"><h3>' . $user->lang['RETURN_DKPINDEX'] . '</h3></a>'; $this->bosslink = '<br /><a href="' . append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&game_id=" . $this->game_id) . '"><h3>' . $user->lang['RETURN_DKPINDEX'] . '</h3></a>'; foreach ($this->games as $id => $gamename) { $template->assign_block_vars('game_row', array('VALUE' => $id, 'SELECTED' => $id == $this->game_id ? ' selected="selected"' : '', 'OPTION' => $gamename)); } switch ($mode) { case 'gameworldconfig': $submit = isset($_POST['submitsettings']) ? true : false; if ($submit) { set_config('bbdkp_boss_hidenonkilled', isset($_POST['hidenewboss']) ? 1 : 0); set_config('bbdkp_zone_photo', request_var('headertype', 0), 0); set_config('bbdkp_zone_style', request_var('zonestyle', 0)); set_config('bbdkp_zone_progress', request_var('zoneprogress', 0)); set_config('bbdkp_boss_hidenewzone', isset($_POST['hidenewzone']) ? 1 : 0); set_config('bbdkp_zone_block_show', isset($_POST['blockprogressbar']) ? 1 : 0); set_config('bbdkp_portal_bossprogress', request_var('show_bosspblock', 0), true); $cache->destroy('config'); trigger_error($user->lang['ADMIN_UPDATE_GAMEWORLD_SUCCESS'] . $this->gmlink, E_USER_NOTICE); } // display list of games $listgames = new \bbdkp\controller\games\Game(); $gamelist = $listgames->listgames(); foreach ($gamelist as $this->game_id => $game) { $template->assign_block_vars('gamerow', array('ID' => $game['id'], 'NAME' => $game['name'], 'GAME_ID' => $game['game_id'], 'U_VIEW_GAME' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_game&mode=editgames&" . URI_GAME . '=' . $game['game_id']), 'U_VIEW_ZONES' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&" . URI_GAME . '=' . $game['game_id']), 'U_VIEW_BOSSES' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&" . URI_GAME . '=' . $game['game_id']), 'VIEWZONES' => sprintf($user->lang['VIEWZONES'], $game['name']), 'VIEWBOSSES' => sprintf($user->lang['VIEWBOSSES'], $game['name']), 'STATUS' => $game['status'])); } // display the list of zones $bp_styles['0'] = $user->lang['BP_STYLE_BP']; $bp_styles['1'] = $user->lang['BP_STYLE_BPS']; $bp_styles['2'] = $user->lang['BP_STYLE_RP3R']; foreach ($bp_styles as $value => $option) { $template->assign_block_vars('style_row', array('VALUE' => $value, 'SELECTED' => $config['bbdkp_zone_style'] == $value ? ' selected="selected"' : '', 'OPTION' => $option)); } $arrvals = array('GAME_ID' => $this->game_id, 'F_CONFIG' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=gameworldconfig"), 'BP_HIDENONKIBOSS' => $config['bbdkp_boss_hidenonkilled'] == 1 ? 'checked="checked"' : '', 'HEADER_SEL_SEPIA' => $config['bbdkp_zone_photo'] == 0 ? 'selected="selected"' : '', 'HEADER_SEL_BLUE' => $config['bbdkp_zone_photo'] == 1 ? 'selected="selected"' : '', 'HEADER_SEL_NONE' => $config['bbdkp_zone_photo'] == 2 ? 'selected="selected"' : '', 'BP_SHOWSB' => $config['bbdkp_zone_progress'] == 1 ? 'checked="checked"' : '', 'BP_HIDENEWZONE' => $config['bbdkp_boss_hidenewzone'] == 1 ? 'checked="checked"' : '', 'BP_BLOCKSHOWPROGRESSBAR' => $config['bbdkp_zone_block_show'] == 1 ? ' checked="checked"' : '', 'S_BP_SHOW' => true, 'SHOW_BOSS_YES_CHECKED' => $config['bbdkp_portal_bossprogress'] == '1' ? ' checked="checked"' : '', 'SHOW_BOSS_NO_CHECKED' => $config['bbdkp_portal_bossprogress'] == '0' ? ' checked="checked"' : ''); $template->assign_vars($arrvals); $this->tpl_name = 'dkp/acp_gameworld'; break; case 'zonebase': if (isset($_GET['move_up'])) { $this->Zonebase_move('up'); } if (isset($_GET['move_down'])) { $this->Zonebase_move('down'); } if (isset($_POST['bpadd'])) { $this->ShowAddZonebase(); } if (isset($_GET['edit'])) { $this->ShowEditZonebase(); } // user pressed the submit button in the add/edit zone screen if (isset($_POST['addnew'])) { $this->AddNewZonebase(); } if (isset($_POST['zoneparam'])) { $this->UpdateZonebase(); } // user pressed the red cross if (isset($_GET['delete'])) { $this->DeleteZonebase(); } $iZone = new games\Zone($this->game_id); $data = $iZone->GetAllZones(); $numzones = count($data); $start = request_var('start', 0); $arrvals = array('GAME_ID' => $this->game_id, 'GAMELOGO' => $phpbb_root_path . 'images/bbdkp/gameworld/' . $this->game_id . '/' . $this->game_id . '.png', 'GAMENAME' => $this->igame->getName(), 'ZONEBASEURL' => $this->igame->getZonebaseurl(), 'U_BACK1' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&game_id=" . $this->game_id), 'U_BACK2' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=gameworldconfig"), 'PAGINATION' => generate_pagination(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&game_id=" . $this->game_id), $numzones, 30, $start, true), 'PAGE_NUMBER' => on_page($numzones, 2, $start)); $template->assign_vars($arrvals); $i = 0; $j = 0; foreach ($data as $row) { $i += 1; if ($i >= $start) { $j += 1; //show max 10 zones per page if ($j <= 30) { $template->assign_block_vars('gamezone', array('ZONE_ID' => $row['id'], 'ZONE_SEQUENCE' => $row['sequence'], 'ZONE_NAME' => $row['name'], 'ZONE_NAME_SHORT' => $row['name_short'], 'ZONE_IMAGENAME' => $row['imagename'], 'ZONE_WEBID' => $row['webid'], 'ZONE_URL' => sprintf($this->igame->getZonebaseurl(), $row['webid']), 'ZONE_SHOW' => $row['showzone'] == 1 ? 'checked="checked"' : '', 'U_EDIT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&edit=1&id={$row['id']}&game_id=" . $this->game_id), 'U_DELETE' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&delete=1&id={$row['id']}&game_id=" . $this->game_id), 'U_MOVE_UP' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&move_up=1&id={$row['id']}&game_id=" . $this->game_id), 'U_MOVE_DOWN' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=zonebase&move_down=1&id={$row['id']}&game_id=" . $this->game_id))); } } } $this->page_title = $user->lang['RP_ZONE']; $this->tpl_name = 'dkp/acp_gameworld_zonebase'; break; case 'bossbase': if (isset($_POST['bpadd'])) { $this->ShowAddBoss(); } if (isset($_POST['addnew'])) { $this->AddUpdateBoss(); } if (isset($_GET['edit'])) { $this->EditBoss(); } if (isset($_GET['delete'])) { $this->DeleteBoss(); } if (isset($_POST['bpsave'])) { $this->UpdateBossList(); } $izone = new games\Zone($this->game_id); $zonelist = $izone->GetAllZones(); $numzones = count($zonelist); $start = request_var('start', 0); $arrvals = array('GAME_ID' => $this->game_id, 'GAMELOGO' => $phpbb_root_path . 'images/bbdkp/gameworld/' . $this->game_id . '/' . $this->game_id . '.png', 'GAMENAME' => $this->igame->getName(), 'BOSSBASEURL' => $this->igame->getBossbaseurl(), 'F_CONFIG' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase"), 'U_BACK1' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&game_id=" . $this->game_id), 'U_BACK2' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=gameworldconfig"), 'PAGINATION' => generate_pagination(append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&game_id=" . $this->game_id), $numzones, 3, $start, true), 'PAGE_NUMBER' => on_page($numzones, 2, $start)); $template->assign_vars($arrvals); $iboss = new games\Boss($this->game_id); $i = 0; $j = 0; foreach ($zonelist as $row) { $i += 1; if ($i >= $start) { $j += 1; //show max 3 zones per page if ($j <= 3) { $template->assign_block_vars('zone', array('ZONE_NAME' => $row['name'], 'ZONE_IMAGENAME' => $phpbb_root_path . "images/bbdkp/gameworld/" . $this->game_id . "/zones/normal/" . $row['imagename'] . ".jpg")); $bossdata = $iboss->GetAllBosses($row['id']); foreach ($bossdata as $row2) { $template->assign_block_vars('zone.boss', array('BOSS_ID' => $row2['id'], 'BOSS_NAME' => htmlspecialchars($row2['name']), 'BOSS_NAME_SHORT' => htmlspecialchars($row2['name_short']), 'BOSS_IMAGENAME' => $row2['imagename'], 'GAME_ID' => $this->game_id, 'BOSS_WEBID' => $row2['webid'], 'BOSS_URL' => sprintf($this->igame->getBossbaseurl(), $row2['webid']), 'BOSS_URLVIEW' => $phpbb_root_path . "images/bbdkp/icons/view.gif", 'U_EDIT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&edit=1&id={$row2['id']}&game_id=" . $this->game_id), 'U_DELETE' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_gameworld&mode=bossbase&delete=1&id={$row2['id']}&game_id=" . $this->game_id))); } } } } $this->page_title = $user->lang['BOSSPROGRESS']; $this->tpl_name = 'dkp/acp_gameworld_' . $mode; break; } }
/** * get api info * * @param $params * @return bool */ public function GetApiInfo($params) { global $user; $data = 0; if ($this->game_id != 'wow') { return false; } if ($this->guildid == "0") { return false; } $game = new \bbdkp\controller\games\Game(); $game->game_id = $this->game_id; $game->Get(); //is both game and guild armory-enabled and has api key and locale ? if ($game->getArmoryEnabled() == 1 && $this->armory_enabled == 1 && trim($game->getApikey()) != '' && trim($game->getApilocale()) != '') { //available extra fields : 'members', 'achievements','news' $api = new \bbdkp\controller\wowapi\BattleNet('guild', $this->region, $game->getApikey(), $game->getApilocale(), $game->getPrivkey()); $data = $api->Guild->getGuild($this->name, $this->realm, $params); $data = $data['response']; unset($api); if (!isset($data)) { $this->armoryresult = 'KO'; $log_action = array('header' => 'L_ERROR_ARMORY_DOWN', 'L_UPDATED_BY' => $user->data['username'], 'L_GUILD' => $this->name . '-' . $this->realm); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action, 'log_result' => 'L_ERROR')); return false; } //if we get error code if (isset($data['code'])) { if ($data['code'] == '403') { // even if we have active API account, it may be that Blizzard account is inactive $this->armoryresult = 'KO'; $log_action = array('header' => 'L_ERROR_BATTLENET_ACCOUNT_INACTIVE', 'L_UPDATED_BY' => $user->data['username'], 'L_GUILD' => $this->name . '-' . $this->realm); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action, 'log_result' => 'L_ERROR')); return false; } } $this->armoryresult = 'OK'; } else { $this->armoryresult = 'KO'; } return $data; }
/** * fetch info from Armory * * @return integer */ public function Armory_getmember() { global $phpEx, $phpbb_root_path, $user; $game = new \bbdkp\controller\games\Game(); $game->game_id = $this->game_id; $game->Get(); if ($this->game_id != 'wow') { $this->member_portrait_url = ''; $this->deactivate_reason = ''; return -1; } if ($game->getArmoryEnabled() == 0) { return -1; } //Initialising the class if (!class_exists('\\bbdkp\\controller\\wowapi\\BattleNet')) { require $phpbb_root_path . 'includes/bbdkp/controller/wowapi/BattleNet.' . $phpEx; } /** * available extra fields : * 'guild','stats','talents','items','reputation','titles','professions','appearance', * 'companions','mounts','pets','achievements','progression','pvp','quests' */ $api = new \bbdkp\controller\wowapi\BattleNet('character', $this->member_region, $game->getApikey(), $game->getApilocale(), $game->getPrivkey()); $params = array('guild', 'titles', 'talents'); $data = $api->Character->getCharacter($this->member_name, $this->member_realm, $params); unset($api); // if $data == false then there is no character data, so if (!isset($data) || !isset($data['response'])) { $this->armoryresult = 'KO'; $log_action = array('header' => 'L_ERROR_ARMORY_DOWN', 'L_UPDATED_BY' => $user->data['username'], 'L_GUILD' => $this->name . '-' . $this->realm); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action, 'log_result' => 'L_ERROR')); return -1; } $data = $data['response']; //if we get error code if (isset($data['code'])) { if ($data['code'] == '403') { // even if we have active API account, it may be that Blizzard account is inactive $this->armoryresult = 'KO'; $log_action = array('header' => 'L_ERROR_BATTLENET_ACCOUNT_INACTIVE', 'L_UPDATED_BY' => $user->data['username'], 'L_GUILD' => $this->name . '-' . $this->realm); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action, 'log_result' => 'L_ERROR')); return -1; } } if (isset($data['reason'])) { //not found in armory $this->member_status = 0; $this->deactivate_reason = 'DEACTIVATED_BY_API'; return -1; } $this->member_level = isset($data['level']) ? $data['level'] : $this->member_level; $this->member_race_id = isset($data['race']) ? $data['race'] : $this->member_race_id; $this->member_class_id = isset($data['class']) ? $data['class'] : $this->member_class_id; /* * select the build */ $buildid = 0; if (isset($data['talents'][0]) && isset($data['talents'][1])) { if (isset($data['talents'][0]['selected'])) { $buildid = 0; } elseif (isset($data['talents'][1]['selected'])) { $buildid = 1; } } elseif (isset($data['talents'][0])) { $buildid = 0; } elseif (isset($data['talents'][1])) { $buildid = 1; } $conversion_array = array('DPS' => 0, 'HEALING' => 1, 'TANK' => 2); $role = isset($data['talents'][$buildid]['spec']['role']) ? $data['talents'][$buildid]['spec']['role'] : 'DPS'; if (isset($role) && in_array($role, $conversion_array)) { $this->member_role = $conversion_array[$role]; } $this->member_gender_id = isset($data['gender']) ? $data['gender'] : $this->member_gender_id; $this->member_achiev = isset($data['achievementPoints']) ? $data['achievementPoints'] : $this->member_achiev; if (isset($data['name'])) { $this->member_armory_url = sprintf('http://%s.battle.net/wow/en/', $this->member_region) . 'character/' . $this->member_realm . '/' . $data['name'] . '/simple'; } if (isset($data['thumbnail'])) { $this->member_portrait_url = sprintf('http://%s.battle.net/static-render/%s/', $this->member_region, $this->member_region) . $data['thumbnail']; } if (isset($data['realm'])) { $this->member_realm = $data['realm']; } if (isset($data['guild'])) { $found = false; foreach ($this->guildlist as $guild) { if (strtolower($guild['name']) == strtolower($data['guild']['name'])) { $this->member_guild_id = $guild['id']; $this->member_guild_name = $guild['name']; $found = true; break; } } if ($found == false) { $this->member_guild_id = 0; $this->member_rank_id = 99; } } else { $this->member_guild_id = 0; $this->member_rank_id = 99; } if (isset($data['titles'])) { foreach ($data['titles'] as $key => $title) { if (isset($title['selected'])) { $this->member_title = $title['name']; break; } } } //if the last logged-in date is > 3 months ago then disable the account if (isset($data['lastModified'])) { $latest = $data['lastModified']; $diff = \round(\abs(\time() - $latest / 1000) / 60 / 60 / 24, 2); if ($diff > 90 && $this->member_status == 1) { $this->member_status = 0; $this->deactivate_reason = 'DEACTIVATED_BY_API'; } if ($diff < 90 && $this->member_status == 0 && $this->deactivate_reason == 'DEACTIVATED_BY_API') { $this->member_status = 1; $this->deactivate_reason = ''; } } return 1; }
/** * Delete Game from bbDKP * @param \bbdkp\controller\games\Game $editgame * */ private function DeleteGame(\bbdkp\controller\games\Game $editgame) { global $user; if (confirm_box(true)) { $deletegame = new \bbdkp\controller\games\Game(); $deletegame->game_id = request_var('hidden_game_id', ''); $deletegame->Get(); $deletegame->Delete(); $log_action = array('header' => 'L_ACTION_GAME_DELETED', 'L_GAME' => $deletegame->game_id); $this->log_insert(array('log_type' => 'L_ACTION_GAME_DELETED', 'log_action' => $log_action)); //meta_refresh(1, append_sid ( "{$phpbb_admin_path}index.$phpEx", "i=dkp_game&mode=listgames") ); trigger_error(sprintf($user->lang['ADMIN_DELETE_GAME_SUCCESS'], $deletegame->getName()), E_USER_WARNING); } else { // get field content $s_hidden_fields = build_hidden_fields(array('gamedelete' => true, 'hidden_game_id' => $editgame->game_id)); confirm_box(false, sprintf($user->lang['CONFIRM_DELETE_GAME'], $editgame->getName()), $s_hidden_fields); } }
/** * list the ranks for this guild * @param $updateguild */ private function BuildTemplateEditGuildRanks($updateguild) { global $phpEx, $template, $db, $phpbb_admin_path, $user; // everything from rank 90 is readonly $listranks = new \bbdkp\controller\guilds\Ranks($updateguild->guildid); $listranks->game_id = $updateguild->game_id; $result = $listranks->listranks(); while ($row = $db->sql_fetchrow($result)) { $prefix = $row['rank_prefix']; $suffix = $row['rank_suffix']; $template->assign_block_vars('ranks_row', array('RANK_ID' => $row['rank_id'], 'RANK_NAME' => $row['rank_name'], 'RANK_PREFIX' => $prefix, 'RANK_SUFFIX' => $suffix, 'HIDE_CHECKED' => $row['rank_hide'] == 1 ? 'checked="checked"' : '', 'S_READONLY' => $row['rank_id'] >= 90 ? true : false, 'U_DELETE_RANK' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_guild&mode=editguild&deleterank=1&ranktodelete=" . $row['rank_id'] . "&" . URI_GUILD . "=" . $updateguild->guildid))); } $db->sql_freeresult($result); $game = new \bbdkp\controller\games\Game(); $game->game_id = $updateguild->game_id; $game->Get(); $template->assign_vars(array('S_GUILDLESS' => $updateguild->guildid == 0 ? true : false, 'F_ENABLGAMEEARMORY' => $game->getArmoryEnabled(), 'F_ENABLEARMORY' => $updateguild->armory_enabled, 'GAME_ID' => $updateguild->game_id, 'GUILDID' => $updateguild->guildid, 'GUILD_NAME' => $updateguild->name, 'U_ADD_RANK' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_guild&mode=editguild&addrank=1&guild=" . $updateguild->guildid), 'L_TITLE' => $this->url_id < 0 ? $user->lang['ACP_ADDGUILD'] : $user->lang['ACP_EDITGUILD'], 'L_EXPLAIN' => $this->url_id < 0 ? $user->lang['ACP_ADDGUILD_EXPLAIN'] : $user->lang['ACP_EDITGUILD_EXPLAIN'], 'L_ADD_GUILD_TITLE' => $this->url_id < 0 ? $user->lang['ADD_GUILD'] : $user->lang['EDIT_GUILD'], 'MSG_NAME_EMPTY' => $user->lang['FV_REQUIRED_NAME'], 'EMBLEM' => $updateguild->emblempath, 'EMBLEMFILE' => basename($updateguild->emblempath), 'S_ADD' => $this->url_id < 0 ? true : false, 'U_EDIT_GUILD' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_guild&mode=editguild&action=editguild&" . URI_GUILD . '=' . $updateguild->guildid), 'U_EDIT_GUILDRANKS' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_guild&mode=editguild&action=guildranks&" . URI_GUILD . '=' . $updateguild->guildid), 'U_EDIT_GUILDRECRUITMENT' => append_sid("{$phpbb_admin_path}index.{$phpEx}", "i=dkp_guild&mode=editguild&action=guildrecruitment&" . URI_GUILD . '=' . $updateguild->guildid))); $form_key = 'editguildranks'; add_form_key($form_key); $this->page_title = $user->lang['ACP_EDITGUILD']; }