public function update($id) { try { $server = Server::findOrFail($id); $setting = $server->setting; if (Input::has('rcon_password') && !empty(trim(Input::get('rcon_password')))) { $password = Input::get('rcon_password'); $setting->rcon_password = trim($password); } if (Input::has('filter')) { $chars = array_map('trim', explode(',', Input::get('filter'))); $setting->filter = implode(',', $chars); } else { $setting->filter = null; } if (Input::has('battlelog_guid')) { $setting->battlelog_guid = trim(Input::get('battlelog_guid')); } else { $setting->battlelog_guid = null; } $setting->save(); $server->ConnectionState = Input::get('status', 'off'); $server->save(); return Redirect::route('admin.site.servers.index')->with('messages', [sprintf('Successfully Updated %s', $server->ServerName)]); } catch (ModelNotFoundException $e) { return Redirect::route('admin.site.servers.index')->withErrors(['Server doesn\'t exist.']); } }
public function create() { try { $player = Player::findOrFail(Input::get('player_id')); if (!is_null($player->ban)) { return Redirect::route('admin.adkats.bans.edit', [$player->ban->ban_id]); } $servers = Server::where('GameID', $player->game->GameID)->active()->lists('ServerName', 'ServerID'); $bfacp = \App::make('bfadmincp'); $admin = MainHelper::getAdminPlayer($bfacp->user, $player->game->GameID); return View::make('admin.adkats.bans.create', compact('player', 'servers', 'admin'))->with('page_title', 'Create New Ban'); } catch (ModelNotFoundException $e) { return Redirect::route('admin.adkats.bans.index')->withErrors([sprintf('Player #%u doesn\'t exist.', Input::get('player_id'))]); } }
public function index() { $servers = Server::all(); return View::make('admin.adkats.settings.index', compact('servers'))->with('page_title', 'AdKats Settings Server List'); }
$b->push(Lang::get('navigation.admin.site.items.roles.title'), route('admin.site.roles.index'), ['icon' => HTML::faicon(Lang::get('navigation.admin.site.items.roles.icon.fa'))]); }); Breadcrumbs::register('admin.site.roles.edit', function ($b, $id) { $b->parent('admin.site.roles.index'); $b->push(Lang::get('navigation.admin.site.items.roles.items.edit.title', ['name' => Role::find($id)->name])); }); /*===================================== = Site Settings = =====================================*/ Breadcrumbs::register('admin.site.settings.index', function ($b) { $b->parent('admin.site'); $b->push(Lang::get('navigation.admin.site.items.settings.title'), route('admin.site.settings.index'), ['icon' => HTML::faicon(Lang::get('navigation.admin.site.items.settings.icon.fa'))]); }); /*==================================== = Site Updater = ====================================*/ Breadcrumbs::register('admin.updater.index', function ($b) { $b->parent('admin.site'); $b->push(Lang::get('navigation.admin.site.items.updater.title'), route('admin.updater.index'), ['icon' => HTML::faicon(Lang::get('navigation.admin.site.items.updater.icon.fa'))]); }); /*==================================== = Site Servers = ====================================*/ Breadcrumbs::register('admin.site.servers.index', function ($b) { $b->parent('admin.site'); $b->push(Lang::get('navigation.admin.site.items.servers.title'), route('admin.site.servers.index'), ['icon' => HTML::faicon(Lang::get('navigation.admin.site.items.servers.icon.fa'))]); }); Breadcrumbs::register('admin.site.servers.edit', function ($b, $id) { $b->parent('admin.site.servers.index'); $b->push(sprintf('%s', Server::find($id)->ServerName)); });
public function scoreboardAdmin() { try { $id = Input::get('server_id'); if (!is_numeric($id) || $id <= 0) { throw new NotFoundHttpException('Invalid Server ID'); } $allowedMethods = ['yell', 'say', 'kill', 'move', 'kick', 'punish']; $permissions = Cache::get('admin.perm.list'); if (!Input::has('method') || !in_array(Input::get('method'), $allowedMethods)) { throw new NotFoundHttpException(); } if (!$this->isLoggedIn || !$this->user->ability(null, $permissions['scoreboard'])) { throw new AccessDeniedHttpException(); } $scoreboard = new LiveServerRepository(Server::findOrFail($id)); if ($scoreboard->attempt()->check()) { $players = []; if (Input::has('players')) { $players = explode(',', Input::get('players')); } switch (Input::get('method')) { case "yell": $this->hasPermission('admin.scoreboard.yell'); if (Input::get('type') == 'Player' && Input::has('players')) { foreach ($players as $player) { $scoreboard->adminYell(Input::get('message', null), $player, null, Input::get('duration', 5), 'Player'); } } else { $scoreboard->adminYell(Input::get('message', null), Input::get('player', null), Input::get('team', null), Input::get('duration', 5), Input::get('type', 'All')); } break; case "say": $this->hasPermission('admin.scoreboard.say'); if (Input::get('type') == 'Player' && Input::has('players')) { foreach ($players as $player) { $scoreboard->adminSay(Input::get('message', null), $player, null, 'Player'); } } else { $scoreboard->adminSay(Input::get('message', null), Input::get('player', null), Input::get('team', null), Input::get('type', 'All')); } break; case "kill": $this->hasPermission('admin.scoreboard.kill'); if (Input::has('players')) { $unkilled = []; foreach ($players as $player) { try { $scoreboard->adminKill($player, Input::get('message', null)); } catch (PlayerNotFoundException $e) { $unkilled[] = ['name' => $player, 'reason' => $e->getMessage()]; } } if (!empty($unkilled)) { $data = $unkilled; } } else { throw new RconException(400, 'No players selected.'); } break; case "kick": $this->hasPermission('admin.scoreboard.kick'); if (Input::has('players')) { $unkicked = []; foreach ($players as $player) { try { $scoreboard->adminKick($player, Input::get('message', null)); } catch (PlayerNotFoundException $e) { $unkicked[] = ['name' => $player, 'reason' => $e->getMessage()]; } } if (!empty($unkicked)) { $data = $unkicked; } } else { throw new RconException(400, 'No player selected.'); } break; case "move": $this->hasPermission('admin.scoreboard.teamswitch'); if (Input::has('players')) { $unmoved = []; foreach ($players as $player) { try { $scoreboard->adminMovePlayer($player, Input::get('team', null), Input::get('squad', null)); } catch (PlayerNotFoundException $e) { $unmoved[] = ['name' => $player, 'reason' => $e->getMessage()]; } catch (RconException $e) { $unmoved[] = ['name' => $player, 'reason' => $e->getMessage()]; } } if (!empty($unmoved)) { $data = $unmoved; } } else { throw new RconException(400, 'No player selected.'); } break; case "punish": $this->hasPermission('admin.scoreboard.punish'); if (Input::has('players')) { foreach ($players as $player) { $scoreboard->adminPunish($player, Input::get('message')); } } else { throw new RconException(400, 'No player selected.'); } break; case "forgive": $this->hasPermission('admin.scoreboard.forgive'); if (Input::has('players')) { foreach ($players as $player) { $scoreboard->adminForgive($player, Input::get('message')); } } else { throw new RconException(400, 'No player selected.'); } break; default: throw new NotFoundHttpException(); } if (!isset($data)) { $data = null; } return MainHelper::response($data, null, null, null, false, true); } } catch (RconException $e) { throw $e; } catch (PlayerNotFoundException $e) { return MainHelper::response(null, $e->getMessage(), 'error', null, false, true); } catch (ModelNotFoundException $e) { throw new NotFoundHttpException(sprintf('No server found with id %s', $id)); } catch (Exception $e) { throw $e; } }