├── public ├── favicon.ico ├── robots.txt ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── montserrat-regular-webfont.eot │ ├── montserrat-regular-webfont.ttf │ ├── montserrat-regular-webfont.woff │ └── glyphicons-halflings-regular.woff ├── img │ ├── site │ │ └── deadlink.png │ └── steam │ │ └── login-sm.png ├── css │ ├── themes │ │ ├── blue.min.css │ │ ├── red.min.css │ │ └── green.min.css │ └── loading.min.css ├── js │ ├── angular │ │ ├── directives.js │ │ ├── services.js │ │ ├── bootstrap.js │ │ └── controllers │ │ │ └── settings │ │ │ ├── SettingsOptionsCtrl.js │ │ │ ├── SettingsPageManagementCtrl.js │ │ │ └── SettingsPermissionControlCtrl.js │ └── helpers.js ├── .htaccess └── index.php ├── app ├── commands │ ├── .gitkeep │ ├── TriggerCommand.php │ ├── InstallCommand.php │ ├── ConfigFileCommand.php │ └── RefreshCommand.php ├── config │ ├── packages │ │ ├── .gitkeep │ │ ├── laracasts │ │ │ └── utilities │ │ │ │ └── config.php │ │ └── hannesvdvreken │ │ │ └── hipchat │ │ │ └── config.php │ ├── steam.php │ ├── compile.php │ ├── local │ │ └── app.php │ ├── testing │ │ ├── cache.php │ │ └── session.php │ ├── services.php │ ├── workbench.php │ ├── view.php │ ├── remote.php │ ├── auth.php │ ├── queue.php │ └── cache.php ├── controllers │ ├── .gitkeep │ ├── ProfileController.php │ ├── AdminController.php │ ├── PluginController.php │ ├── ConsoleController.php │ ├── GameTypeController.php │ ├── DashboardController.php │ ├── TemplateController.php │ ├── OptionController.php │ ├── PageController.php │ ├── PermissionController.php │ ├── BaseController.php │ ├── NotificationController.php │ ├── AuthController.php │ ├── SettingController.php │ └── QuickLinkController.php ├── database │ ├── seeds │ │ ├── .gitkeep │ │ ├── QuickLinksTableSeeder.php │ │ ├── RolesTableSeeder.php │ │ ├── ServicesTableSeeder.php │ │ ├── DatabaseSeeder.php │ │ ├── OptionsTableSeeder.php │ │ ├── FlagsTableSeeder.php │ │ ├── EventsTableSeeder.php │ │ ├── GameTypesTableSeeder.php │ │ ├── PagesTableSeeder.php │ │ └── NotificationsTableSeeder.php │ ├── migrations │ │ ├── .gitkeep │ │ ├── 2014_07_18_141310_create_services_table.php │ │ ├── 2014_07_16_123321_create_flags_table.php │ │ ├── 2014_06_27_153315_create_roles_table.php │ │ ├── 2014_06_29_094159_create_quick_links_table.php │ │ ├── 2014_07_18_142008_create_events_table.php │ │ ├── 2014_06_30_142430_create_permissions_table.php │ │ ├── 2014_06_27_163614_create_page_table.php │ │ ├── 2014_06_30_194504_create_options_table.php │ │ ├── 2014_06_27_153258_create_users_table.php │ │ ├── 2014_07_16_195032_create_notifications_table.php │ │ ├── 2014_07_14_124439_create_game_types_table.php │ │ ├── 2014_07_16_154311_create_flag_server_table.php │ │ ├── 2014_07_18_150217_create_event_service_table.php │ │ ├── 2014_06_27_153701_create_role_user_table.php │ │ ├── 2014_06_27_164734_create_page_role_table.php │ │ ├── 2014_06_30_144408_create_permission_role_table.php │ │ └── 2014_07_14_122403_create_servers_table.php │ └── production.sqlite ├── start │ ├── local.php │ ├── artisan.php │ └── global.php ├── storage │ ├── .gitignore │ ├── cache │ │ └── .gitignore │ ├── debugbar │ │ └── .gitignore │ ├── logs │ │ └── .gitignore │ ├── meta │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ └── views │ │ └── .gitignore ├── views │ ├── pages │ │ ├── profile.blade.php │ │ ├── game-types.blade.php │ │ ├── active-plugins.blade.php │ │ ├── admin-activity.blade.php │ │ ├── multi-console.blade.php │ │ ├── settings │ │ │ ├── options.blade.php │ │ │ ├── permission-control.blade.php │ │ │ └── page-management.blade.php │ │ ├── dashboard.blade.php │ │ └── servers.blade.php │ ├── http_status │ │ └── 404.blade.php │ ├── partials │ │ ├── toasty.php │ │ ├── flash.blade.php │ │ ├── sidebar.blade.php │ │ └── header.blade.php │ ├── emails │ │ └── auth │ │ │ └── reminder.blade.php │ ├── templates │ │ ├── servers.view_players.php │ │ └── secure │ │ │ └── settings.users.add.php │ └── master.blade.php ├── events.php ├── Ssms │ ├── Services │ │ ├── ServiceInterface.php │ │ └── HipChat │ │ │ └── HipChatService.php │ ├── Repositories │ │ ├── Option │ │ │ ├── OptionRepository.php │ │ │ └── EloquentOptionRepository.php │ │ ├── Role │ │ │ ├── RoleRepository.php │ │ │ └── EloquentRoleRepository.php │ │ ├── QuickLink │ │ │ ├── QuickLinkRepository.php │ │ │ └── EloquentQuickLinkRepository.php │ │ ├── Page │ │ │ ├── PageRepository.php │ │ │ └── EloquentPageRepository.php │ │ ├── Notification │ │ │ ├── NotificationRepository.php │ │ │ └── EloquentNotificationRepository.php │ │ ├── Service │ │ │ ├── ServiceRepository.php │ │ │ └── EloquentServiceRepository.php │ │ ├── Event │ │ │ ├── EventRepository.php │ │ │ └── EloquentEventRepository.php │ │ ├── Permission │ │ │ ├── PermissionRepository.php │ │ │ └── EloquentPermissionRepository.php │ │ ├── Server │ │ │ ├── ServerRepository.php │ │ │ └── EloquentServerRepository.php │ │ ├── User │ │ │ ├── EloquentUserRepository.php │ │ │ └── UserRepository.php │ │ ├── StorageServiceProvider.php │ │ └── EloquentRepository.php │ ├── Support │ │ ├── Facades │ │ │ ├── Access.php │ │ │ └── Permissions.php │ │ └── Helpers │ │ │ ├── Environment.php │ │ │ └── SecToHrMinSec.php │ ├── Notifications │ │ ├── Services │ │ │ ├── ServiceData.php │ │ │ └── ServiceHandler.php │ │ └── Events │ │ │ └── EventHandler.php │ ├── Authorization │ │ ├── AuthorizationServiceProvider.php │ │ ├── PermissionsBuilder.php │ │ └── AccessBuilder.php │ └── Steam │ │ └── Server.php ├── tests │ ├── TestCase.php │ └── UriCheckTest.php ├── models │ ├── QuickLink.php │ ├── Option.php │ ├── Flag.php │ ├── Service.php │ ├── GameType.php │ ├── Notification.php │ ├── Event.php │ ├── Permission.php │ ├── Page.php │ ├── Role.php │ ├── Server.php │ └── User.php ├── lang │ └── en │ │ ├── header.php │ │ ├── pagination.php │ │ ├── reminders.php │ │ └── auth.php └── filters.php ├── .gitattributes ├── .bowerrc ├── .env.testing.php ├── CONTRIBUTING.md ├── .gitignore ├── server.php ├── phpunit.xml ├── bower.json ├── phpunit.xml.dist ├── composer.json ├── bootstrap ├── paths.php ├── start.php └── autoload.php └── artisan /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/commands/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/config/packages/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /app/database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/database/production.sqlite: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/start/local.php: -------------------------------------------------------------------------------- 1 | 2 |
[[ HTML::image('img/site/deadlink.png') ]]
3 | -------------------------------------------------------------------------------- /public/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /public/img/site/deadlink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/img/site/deadlink.png -------------------------------------------------------------------------------- /public/img/steam/login-sm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/img/steam/login-sm.png -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /.env.testing.php: -------------------------------------------------------------------------------- 1 | '7FzAvU8REufwIDwXlw1ILsa67V4WzK4f', 4 | 'database_type' => 'sqlite', 5 | ); 6 | -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/fonts/montserrat-regular-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/montserrat-regular-webfont.eot -------------------------------------------------------------------------------- /public/fonts/montserrat-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/montserrat-regular-webfont.ttf -------------------------------------------------------------------------------- /public/fonts/montserrat-regular-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ehesp/Sourcemod-Server-Manager-System/HEAD/public/fonts/montserrat-regular-webfont.woff -------------------------------------------------------------------------------- /app/Ssms/Services/ServiceInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /app/controllers/ProfileController.php: -------------------------------------------------------------------------------- 1 | 'xxxxx', 11 | 'auth_token' => 'xxxxxxxx', 12 | ), 13 | ); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Event/EventRepository.php: -------------------------------------------------------------------------------- 1 | |
4 | */ 5 | 6 | app.directive('loading', function() 7 | { 8 | return { 9 | restrict: 'AE', 10 | replace: 'false', 11 | template: '
' 12 | } 13 | }); -------------------------------------------------------------------------------- /app/Ssms/Repositories/Permission/PermissionRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | } -------------------------------------------------------------------------------- /app/views/emails/auth/reminder.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Password Reset

8 | 9 |
10 | To reset your password, complete this form: {{ URL::to('password/reset', array($token)) }}.
11 | This link will expire in {{ Config::get('auth.reminder.expire', 60) }} minutes. 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /app/Ssms/Support/Facades/Permissions.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes... 9 | RewriteRule ^(.*)/$ /$1 [L,R=301] 10 | 11 | # Handle Front Controller... 12 | RewriteCond %{REQUEST_FILENAME} !-d 13 | RewriteCond %{REQUEST_FILENAME} !-f 14 | RewriteRule ^ index.php [L] 15 | 16 | -------------------------------------------------------------------------------- /app/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /app/views/partials/flash.blade.php: -------------------------------------------------------------------------------- 1 | @if(Session::has('flash_notification')) 2 |
3 |
4 |
11 | [[ Session::get('flash_notification') ]] 12 |
13 |
14 |
15 | @endif -------------------------------------------------------------------------------- /app/Ssms/Repositories/QuickLink/EloquentQuickLinkRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | } -------------------------------------------------------------------------------- /app/config/steam.php: -------------------------------------------------------------------------------- 1 | URL::to('login'), 16 | 17 | ); -------------------------------------------------------------------------------- /app/models/QuickLink.php: -------------------------------------------------------------------------------- 1 | true, 17 | 18 | ); 19 | -------------------------------------------------------------------------------- /app/lang/en/header.php: -------------------------------------------------------------------------------- 1 | 'Page Title', 13 | 14 | 'defaultBreadcrumb' => 'SSMS', 15 | 16 | 'yourProfile' => 'Your Profile', 17 | 18 | 'steamProfile' => 'Steam Profile', 19 | 20 | 'steamRep' => 'Steam Rep', 21 | 22 | 'logout' => 'Logout', 23 | 24 | 'notifications' => 'Notifications', 25 | 26 | ); -------------------------------------------------------------------------------- /app/database/seeds/QuickLinksTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'Forums', 9 | 'url' => 'http://lethal-zone.eu/forum', 10 | 'icon' => 'fa fa-external-link', 11 | ]); 12 | 13 | QuickLink::create([ 14 | 'name' => 'IRC', 15 | 'url' => 'http://webchat.quakenet.org/?randomnick=1&channels=lethalzone', 16 | 'icon' => 'fa fa-comment', 17 | ]); 18 | } 19 | 20 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Option/EloquentOptionRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function companionScript() 19 | { 20 | return $this->model->whereName('companion_script')->get(['name', 'value']); 21 | } 22 | } -------------------------------------------------------------------------------- /app/models/Flag.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Ssms\Server', 'flag_server'); 29 | } 30 | } -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Ssms\Event', 'event_service'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 18 | 'next' => 'Next »', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /public/js/angular/services.js: -------------------------------------------------------------------------------- 1 | /** 2 | * HTTP Request Service 3 | * 4 | */ 5 | 6 | app.factory('http', function ($http) { 7 | 8 | var headers = { 9 | 'Content-Type': 'application/json', 10 | 'X-Requested-With': 'XMLHttpRequest' 11 | }; 12 | 13 | return { 14 | post: function (path, data) 15 | { 16 | if (! angular.isDefined(data)) data = null; 17 | 18 | return $http({ 19 | method: 'POST', 20 | url: path, 21 | headers: headers, 22 | data: data, 23 | }); 24 | }, 25 | } 26 | }); -------------------------------------------------------------------------------- /app/Ssms/Support/Helpers/Environment.php: -------------------------------------------------------------------------------- 1 | env = \App::environment(); 12 | } 13 | 14 | /** 15 | * Returns the name of the config file for the current environment 16 | * 17 | * @return string 18 | */ 19 | public function configFileName() 20 | { 21 | if ($this->env == 'production') 22 | { 23 | return '.env.php'; 24 | } 25 | else 26 | { 27 | return '.env.' . $this->env . '.php'; 28 | } 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /app/config/testing/cache.php: -------------------------------------------------------------------------------- 1 | 'array', 19 | 20 | ); 21 | -------------------------------------------------------------------------------- /app/start/artisan.php: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./app/tests/ 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/database/seeds/RolesTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'super_admin', 9 | 'friendly_name' => 'Super Admin', 10 | ]); 11 | 12 | Role::create([ 13 | 'name' => 'admin', 14 | 'friendly_name' => 'Admin', 15 | ]); 16 | 17 | Role::create([ 18 | 'name' => 'user', 19 | 'friendly_name' => 'User', 20 | ]); 21 | 22 | Role::create([ 23 | 'name' => 'guest', 24 | 'friendly_name' => 'Guest', 25 | ]); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /app/controllers/DashboardController.php: -------------------------------------------------------------------------------- 1 | User::count(), 9 | 'servers' => Ssms\Server::count(), 10 | 'active_plugins' => 150, // Plugin::count(), 11 | 'game_types' => 4, // Server::gameTypes()->count(), 12 | ]; 13 | 14 | return $stats; 15 | } 16 | 17 | protected function getServers() 18 | { 19 | return ''; //Server::get(['name', 'players']); 20 | } 21 | 22 | public function getView() 23 | { 24 | return View::make('pages.dashboard') 25 | ->with('stats', $this->getStats()); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/config/testing/session.php: -------------------------------------------------------------------------------- 1 | 'array', 20 | 21 | ); 22 | -------------------------------------------------------------------------------- /app/database/seeds/ServicesTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'email', 9 | 'friendly_name' => 'E-Mail', 10 | ]); 11 | 12 | Service::create([ 13 | 'name' => 'twitter', 14 | 'friendly_name' => 'Twitter', 15 | ]); 16 | 17 | Service::create([ 18 | 'name' => 'hipchat', 19 | 'friendly_name' => 'HipChat', 20 | ]); 21 | 22 | Service::create([ 23 | 'name' => 'pushbullet', 24 | 'friendly_name' => 'PushBullet', 25 | ]); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /app/models/GameType.php: -------------------------------------------------------------------------------- 1 | hasMany('Ssms\Server', 'client_appid', 'client_appid'); 33 | } 34 | } -------------------------------------------------------------------------------- /app/database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call('NotificationsTableSeeder'); 15 | $this->call('ServicesTableSeeder'); 16 | $this->call('EventsTableSeeder'); 17 | $this->call('GameTypesTableSeeder'); 18 | $this->call('FlagsTableSeeder'); 19 | $this->call('OptionsTableSeeder'); 20 | $this->call('QuickLinksTableSeeder'); 21 | $this->call('RolesTableSeeder'); 22 | $this->call('PagesTableSeeder'); 23 | $this->call('PermissionsTableSeeder'); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /app/database/migrations/2014_07_18_141310_create_services_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('friendly_name'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::drop('services'); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/Ssms/Services/HipChat/HipChatService.php: -------------------------------------------------------------------------------- 1 | room = $roomId; 15 | $this->init($token); 16 | } 17 | 18 | protected function init($token) 19 | { 20 | $this->hipchat = new HipChat($token); 21 | $this->hipchat->set_verify_ssl(false); 22 | 23 | return $this; 24 | } 25 | 26 | public function send($title = 'SSMS', $message) 27 | { 28 | $this->hipchat->message_room($this->room, $title, $message); 29 | } 30 | 31 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_07_16_123321_create_flags_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('icon'); 19 | $table->string('type'); 20 | $table->text('message'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('flags'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/database/migrations/2014_06_27_153315_create_roles_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('friendly_name'); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('roles'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/database/migrations/2014_06_29_094159_create_quick_links_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->text('url'); 20 | $table->string('icon'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('quick_links'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/database/migrations/2014_07_18_142008_create_events_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('description')->nullable(); 20 | $table->timestamps(); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('events'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/models/Notification.php: -------------------------------------------------------------------------------- 1 | where('name', 'email.enabled')->orWhere('name', 'twitter.enabled') 29 | ->orWhere('name', 'hipchat.enabled')->orWhere('name', 'pushbullet.enabled'); 30 | } 31 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Notification/EloquentNotificationRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function getServicesState() 19 | { 20 | return $this->model->services()->get(['name', 'value']); 21 | } 22 | 23 | public function getTypeSettings($type) 24 | { 25 | return $this->model->where('name', 'LIKE', "{$type}.%")->get(['name', 'value']); 26 | } 27 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Server/EloquentServerRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function hasDuplicate($ip, $port) 19 | { 20 | return $this->model->where('ip', $ip)->where('port', $port)->first(); 21 | } 22 | 23 | public function getServerDetails($id) 24 | { 25 | return $this->model->where('id', $id)->first(['ip', 'port', 'rcon_password']); 26 | } 27 | 28 | 29 | 30 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_06_30_142430_create_permissions_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('description')->nullable(); 20 | $table->integer('page_id'); 21 | }); 22 | } 23 | 24 | /** 25 | * Reverse the migrations. 26 | * 27 | * @return void 28 | */ 29 | public function down() 30 | { 31 | Schema::drop('permissions'); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/database/migrations/2014_06_27_163614_create_page_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('friendly_name'); 20 | $table->string('icon'); 21 | $table->string('slug'); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::drop('pages'); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /app/lang/en/reminders.php: -------------------------------------------------------------------------------- 1 | "Passwords must be at least six characters and match the confirmation.", 17 | 18 | "user" => "We can't find a user with that e-mail address.", 19 | 20 | "token" => "This password reset token is invalid.", 21 | 22 | "sent" => "Password reminder sent!", 23 | 24 | ); 25 | -------------------------------------------------------------------------------- /app/config/services.php: -------------------------------------------------------------------------------- 1 | array( 18 | 'domain' => '', 19 | 'secret' => '', 20 | ), 21 | 22 | 'mandrill' => array( 23 | 'secret' => '', 24 | ), 25 | 26 | 'stripe' => array( 27 | 'model' => 'User', 28 | 'secret' => '', 29 | ), 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/models/Event.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Service', 'event_service'); 44 | } 45 | } -------------------------------------------------------------------------------- /app/Ssms/Notifications/Services/ServiceData.php: -------------------------------------------------------------------------------- 1 | events = $events; 15 | $this->notifications = $notifications; 16 | } 17 | 18 | public function getServices($type) 19 | { 20 | $event = $this->events->getFirst('name', $type); 21 | 22 | $event = $this->events->getWithServices($event['id']); 23 | 24 | return $event->services; 25 | } 26 | 27 | public function getSettings($type) 28 | { 29 | return $this->notifications->getTypeSettings($type); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Page/EloquentPageRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function getWithRoles($id = null) 19 | { 20 | if (! is_null($id)) 21 | { 22 | return $this->model->with('roles')->find($id); 23 | } 24 | 25 | return $this->model->with('roles')->get(); 26 | } 27 | 28 | public function removeRole($page, $role) 29 | { 30 | $page->roles()->detach($role); 31 | } 32 | 33 | public function assignRole($page, $role) 34 | { 35 | $page->roles()->attach($role); 36 | } 37 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_06_30_194504_create_options_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('friendly_name'); 20 | $table->string('value'); 21 | $table->text('options')->nullable(); 22 | $table->string('description'); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('options'); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ssms", 3 | "version": "1.0", 4 | "homepage": "https://github.com/Ehesp/Sourcemod-Server-Manager-System", 5 | "authors": [ 6 | "Erik-jan Riemers " 7 | ], 8 | "description": "Sourcemod Server Management System", 9 | "keywords": [ 10 | "sourcemod", 11 | "hlsw", 12 | "server" 13 | ], 14 | "license": "MIT", 15 | "ignore": [ 16 | "**/.*", 17 | "node_modules", 18 | "bower_components", 19 | "public/assets/vendor", 20 | "test", 21 | "tests" 22 | ], 23 | "dependencies": { 24 | "angular-bootstrap": "~0.11.0", 25 | "font-awesome": "~4.1.0", 26 | "bootstrap-css-only": "~3.2.0", 27 | "angular-cookies": "~1.2.19", 28 | "angular-sanitize": "~1.2.19", 29 | "angular-dialog-service": "~5.0.0", 30 | "angular-toasty": "~0.1.7" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'The response from Steam was invalid.', 16 | 17 | 'firstLogin' => 'Thanks for using SSMS! As this is your first install, please update your settings below.', 18 | 19 | 'noAccess' => 'Your Steam account does not have access to this application.', 20 | 21 | 'accountDisabled' => 'Your Steam account has been disabled for this appliation.', 22 | 23 | 'successfulLogin' => 'You have successfully logged in!', 24 | 25 | ); -------------------------------------------------------------------------------- /app/tests/UriCheckTest.php: -------------------------------------------------------------------------------- 1 | client->request('GET', '/'); 14 | $this->assertTrue($this->client->getResponse()->isOk()); 15 | } 16 | 17 | public function testDashUri() 18 | { 19 | $this->client->request('GET', '/dashboard'); 20 | $this->assertResponseOk(); 21 | } 22 | 23 | public function testServersUri() 24 | { 25 | $this->client->request('GET', '/servers'); 26 | $this->assertResponseOk(); 27 | } 28 | 29 | public function testGametypesUri() 30 | { 31 | $this->client->request('GET', '/game-types'); 32 | $this->assertResponseOk(); 33 | } 34 | 35 | } -------------------------------------------------------------------------------- /app/controllers/TemplateController.php: -------------------------------------------------------------------------------- 1 | path = app_path() . '/views/templates/'; 12 | } 13 | 14 | /** 15 | * Return a secure template 16 | * @param string $name Name of the template/permission 17 | * @return mixed 18 | */ 19 | public function getSecureTemplate($name) 20 | { 21 | if (Permissions::validate($name)) 22 | { 23 | return File::get($this->path . 'secure/' . $name . '.php'); 24 | } 25 | 26 | return App::abort(404); 27 | } 28 | 29 | /** 30 | * Get an unsecure template 31 | * 32 | * @param string $name Template name 33 | * @return File 34 | */ 35 | public function getTemplate($name) 36 | { 37 | return File::get($this->path . $name . '.php'); 38 | } 39 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_06_27_153258_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('community_id')->unique(); 19 | $table->string('nickname'); 20 | $table->string('avatar', 200)->nullable(); 21 | $table->boolean('enabled')->default(0); 22 | $table->string('remember_token', 100)->nullable(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('users'); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/Ssms/Repositories/Event/EloquentEventRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function getWithServices($id = null) 19 | { 20 | if (! is_null($id)) 21 | { 22 | return $this->model->with('services')->find($id); 23 | } 24 | 25 | return $this->model->with('services')->get(); 26 | } 27 | 28 | public function removeService($event, $service) 29 | { 30 | $event->services()->detach($service); 31 | } 32 | 33 | public function assignService($event, $service) 34 | { 35 | $event->services()->attach($service); 36 | } 37 | } -------------------------------------------------------------------------------- /app/models/Permission.php: -------------------------------------------------------------------------------- 1 | belongsTo('Page'); 33 | } 34 | 35 | /** 36 | * Attach user table to many-to-many relationship with "Roles" table via the "page_role" pivot table. 37 | * 38 | */ 39 | public function roles() 40 | { 41 | return $this->belongsToMany('Role', 'permission_role')->orderBy('id', 'asc')->withTimestamps(); 42 | } 43 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_07_16_195032_create_notifications_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('friendly_name'); 20 | $table->text('value'); 21 | $table->text('options')->nullable(); 22 | $table->string('description'); 23 | $table->integer('in_overview')->default(1); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('notifications'); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/database/migrations/2014_07_14_124439_create_game_types_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('client_appid')->unique(); 19 | $table->string('hldsid'); 20 | $table->string('gamename'); 21 | $table->string('version'); 22 | $table->integer('expired')->default(0); 23 | $table->text('icon')->nullable(); 24 | $table->text('logo')->nullable(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::drop('game_types'); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /app/models/Page.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Role', 'page_role')->orderBy('id', 'asc')->withTimestamps(); 33 | } 34 | 35 | /** 36 | * Each page can have many permissions attached to it (many-to-one). 37 | * 38 | */ 39 | public function permissions() 40 | { 41 | return $this->hasMany('Permission'); 42 | } 43 | } -------------------------------------------------------------------------------- /public/css/loading.min.css: -------------------------------------------------------------------------------- 1 | .loading { 2 | width: 40px; 3 | height: 40px; 4 | position: relative; 5 | margin: 100px auto; 6 | } 7 | 8 | .double-bounce1, .double-bounce2 { 9 | width: 100%; 10 | height: 100%; 11 | border-radius: 50%; 12 | background-color: #333; 13 | opacity: 0.6; 14 | position: absolute; 15 | top: 0; 16 | left: 0; 17 | 18 | -webkit-animation: bounce 2.0s infinite ease-in-out; 19 | animation: bounce 2.0s infinite ease-in-out; 20 | } 21 | 22 | .double-bounce2 { 23 | -webkit-animation-delay: -1.0s; 24 | animation-delay: -1.0s; 25 | } 26 | 27 | @-webkit-keyframes bounce { 28 | 0%, 100% { -webkit-transform: scale(0.0) } 29 | 50% { -webkit-transform: scale(1.0) } 30 | } 31 | 32 | @keyframes bounce { 33 | 0%, 100% { 34 | transform: scale(0.0); 35 | -webkit-transform: scale(0.0); 36 | } 50% { 37 | transform: scale(1.0); 38 | -webkit-transform: scale(1.0); 39 | } 40 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/Permission/EloquentPermissionRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | public function getWithRolesPage($id = null) 19 | { 20 | if (! is_null($id)) 21 | { 22 | return $this->model->with('roles', 'page')->find($id); 23 | } 24 | 25 | return $this->model->with('roles', 'page')->get(); 26 | } 27 | 28 | public function removeRole($permission, $role) 29 | { 30 | $permission->roles()->detach($role); 31 | } 32 | 33 | public function assignRole($permission, $role) 34 | { 35 | $permission->roles()->attach($role); 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_07_16_154311_create_flag_server_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | $table->integer('server_id')->unsigned()->index(); 20 | $table->integer('flag_id')->unsigned()->index(); 21 | 22 | $table->foreign('server_id')->references('id')->on('servers')->onDelete('cascade'); 23 | $table->foreign('flag_id')->references('id')->on('flags')->onDelete('cascade'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('flag_server'); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/Ssms/Notifications/Events/EventHandler.php: -------------------------------------------------------------------------------- 1 | handler = $handler; 12 | } 13 | 14 | public function subscribe($events) 15 | { 16 | $events->listen('user.add', 'Ssms\Notifications\Events\EventHandler@onNewUser'); 17 | $events->listen('user.delete', 'Ssms\Notifications\Events\EventHandler@onDeleteUser'); 18 | } 19 | 20 | public function onNewUser($data) 21 | { 22 | $type = 'user.add'; 23 | $title = 'New User'; 24 | $message = "User {$data['nickname']} ({$data['community_id']}) has been added!"; 25 | 26 | return $this->handler->fire($type, $title, $message); 27 | } 28 | 29 | public function onDeleteUser() 30 | { 31 | // 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_07_18_150217_create_event_service_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | $table->integer('event_id')->unsigned()->index(); 20 | $table->integer('service_id')->unsigned()->index(); 21 | 22 | $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade'); 23 | $table->foreign('service_id')->references('id')->on('services')->onDelete('cascade'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::drop('event_service'); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/database/migrations/2014_06_27_153701_create_role_user_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | $table->integer('user_id')->unsigned()->index(); 20 | $table->integer('role_id')->unsigned()->index(); 21 | 22 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');; 23 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 24 | 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('role_user'); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/database/migrations/2014_06_27_164734_create_page_role_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | $table->integer('page_id')->unsigned()->index(); 20 | $table->integer('role_id')->unsigned()->index(); 21 | 22 | $table->foreign('page_id')->references('id')->on('pages')->onDelete('cascade'); 23 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); 24 | 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('page_role'); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/Ssms/Support/Helpers/SecToHrMinSec.php: -------------------------------------------------------------------------------- 1 | seconds = $seconds; 17 | } 18 | 19 | /** 20 | * Returns the converted seconds into (H)H:MM:SS format 21 | * 22 | */ 23 | public function convert($padHours = false) 24 | { 25 | $hms = ""; 26 | 27 | $hours = intval(intval($this->seconds) / 3600); 28 | 29 | $hms .= ($padHours) ? str_pad($hours, 2, "0", STR_PAD_LEFT). ":" : $hours. ":"; 30 | 31 | $minutes = intval(($this->seconds / 60) % 60); 32 | 33 | $hms .= str_pad($minutes, 2, "0", STR_PAD_LEFT). ":"; 34 | 35 | $seconds = intval($this->seconds % 60); 36 | 37 | $hms .= str_pad($seconds, 2, "0", STR_PAD_LEFT); 38 | 39 | return $hms; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /app/database/migrations/2014_06_30_144408_create_permission_role_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | 19 | $table->integer('permission_id')->unsigned()->index(); 20 | $table->integer('role_id')->unsigned()->index(); 21 | 22 | $table->foreign('permission_id')->references('id')->on('permissions')->onDelete('cascade'); 23 | $table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade'); 24 | 25 | $table->timestamps(); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::drop('permission_role'); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/config/packages/laracasts/utilities/config.php: -------------------------------------------------------------------------------- 1 | 'master', 15 | 16 | /* 17 | |-------------------------------------------------------------------------- 18 | | JavaScript Namespace 19 | |-------------------------------------------------------------------------- 20 | | 21 | | By default, we'll add variables to the global window object. 22 | | It's recommended that you change this to some namespace - anything. 23 | | That way, from your JS, you may do something like `Laracasts.myVar`. 24 | | 25 | */ 26 | 'js_namespace' => 'window' 27 | 28 | ]; -------------------------------------------------------------------------------- /app/config/workbench.php: -------------------------------------------------------------------------------- 1 | '', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Workbench Author E-Mail Address 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Like the option above, your e-mail address is used when generating new 24 | | workbench packages. The e-mail is placed in your composer.json file 25 | | automatically after the package is created by the workbench tool. 26 | | 27 | */ 28 | 29 | 'email' => '', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/config/view.php: -------------------------------------------------------------------------------- 1 | array(__DIR__.'/../views'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Pagination View 21 | |-------------------------------------------------------------------------- 22 | | 23 | | This view will be used to render the pagination link output, and can 24 | | be easily customized here to show any view you like. A clean view 25 | | compatible with Twitter's Bootstrap is given to you by default. 26 | | 27 | */ 28 | 29 | 'pagination' => 'pagination::slider-3', 30 | 31 | ); 32 | -------------------------------------------------------------------------------- /app/controllers/OptionController.php: -------------------------------------------------------------------------------- 1 | options = $options; 15 | } 16 | 17 | /** 18 | * Return all of the options 19 | * 20 | * @return object 21 | */ 22 | public function get() 23 | { 24 | return $this->options->getAll(); 25 | } 26 | 27 | /** 28 | * Edit an option 29 | * 30 | * @return json 31 | */ 32 | public function edit() 33 | { 34 | $data = Input::all(); 35 | 36 | if ($this->isEmpty($data['value'])) return $this->jsonResponse(400, false, "The option value must be present!"); 37 | 38 | try 39 | { 40 | $option = $this->options->edit($data['id'], ['value' => $data['value']]); 41 | } 42 | catch (Exception $e) 43 | { 44 | return $this->jsonResponse(400, false, $e->getMessage()); 45 | } 46 | 47 | return $this->jsonResponse(200, true, 'The option has been updated!', $option); 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | ./app/tests/ 16 | 17 | 18 | 19 | 20 | ./app/ 21 | 22 | 23 | 24 | 27 | 28 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/Ssms/Authorization/AuthorizationServiceProvider.php: -------------------------------------------------------------------------------- 1 | registerAccessBuilder(); 15 | $this->registerPermissionsBuilder(); 16 | } 17 | 18 | /** 19 | * Register the Access builder instance. 20 | * 21 | * @return void 22 | */ 23 | protected function registerAccessBuilder() 24 | { 25 | $this->app->bindShared('access', function($app) 26 | { 27 | return new AccessBuilder($app['auth']); 28 | }); 29 | } 30 | 31 | /** 32 | * Register the Permission builder instance. 33 | * 34 | * @return void 35 | */ 36 | protected function registerPermissionsBuilder() 37 | { 38 | $this->app->bindShared('permissions', function($app) 39 | { 40 | return new PermissionsBuilder($app['auth']); 41 | }); 42 | } 43 | 44 | /** 45 | * Get the services provided by the provider. 46 | * 47 | * @return array 48 | */ 49 | public function provides() 50 | { 51 | return array('access', 'permissions'); 52 | } 53 | 54 | } -------------------------------------------------------------------------------- /public/js/angular/bootstrap.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('SSMS', ['ui.bootstrap', 'ngCookies', 'ngSanitize','ngAnimate', 'dialogs.main', 'toasty']); 2 | 3 | app.controller('MasterCtrl', function($scope, $cookieStore) 4 | { 5 | /** 6 | * Sidebar Toggle & Cookie Control 7 | * 8 | */ 9 | var mobileView = 992; 10 | 11 | $scope.getWidth = function() { return window.innerWidth; }; 12 | 13 | $scope.$watch($scope.getWidth, function(newValue, oldValue) 14 | { 15 | if(newValue >= mobileView) 16 | { 17 | if(angular.isDefined($cookieStore.get('toggle'))) 18 | { 19 | if($cookieStore.get('toggle') == false) 20 | $scope.toggle = false; 21 | 22 | else 23 | $scope.toggle = true; 24 | } 25 | else 26 | { 27 | $scope.toggle = true; 28 | } 29 | } 30 | else 31 | { 32 | $scope.toggle = false; 33 | } 34 | 35 | }); 36 | 37 | $scope.toggleSidebar = function() 38 | { 39 | $scope.toggle = ! $scope.toggle; 40 | 41 | $cookieStore.put('toggle', $scope.toggle); 42 | }; 43 | 44 | window.onresize = function() { $scope.$apply(); }; 45 | 46 | /** 47 | * In-Scope helpers 48 | * 49 | */ 50 | $scope.stringToArray = function(string, sep) 51 | { 52 | return string.split(sep); 53 | } 54 | 55 | }); -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "description": "The Laravel Framework.", 4 | "keywords": ["framework", "laravel"], 5 | "license": "MIT", 6 | "require": { 7 | "laravel/framework": "4.2.*", 8 | "ehesp/steam-login": "1.0.0", 9 | "koraktor/steam-condenser": "1.3.8", 10 | "laracasts/utilities": "~1.0", 11 | "hipchat/hipchat-php": "1.3", 12 | "barryvdh/laravel-debugbar": "1.x" 13 | }, 14 | "autoload": { 15 | "classmap": [ 16 | "app/commands", 17 | "app/controllers", 18 | "app/models", 19 | "app/database/migrations", 20 | "app/database/seeds", 21 | "app/tests/TestCase.php" 22 | ], 23 | "files": [ 24 | "vendor/koraktor/steam-condenser/lib/steam-condenser.php" 25 | ], 26 | "psr-4": { 27 | "Ssms\\": "app/Ssms" 28 | } 29 | }, 30 | "scripts": { 31 | "post-install-cmd": [ 32 | "php artisan clear-compiled", 33 | "php artisan optimize", 34 | "bower install" 35 | ], 36 | "post-update-cmd": [ 37 | "php artisan debugbar:publish", 38 | "php artisan clear-compiled", 39 | "php artisan optimize", 40 | "bower update" 41 | ], 42 | "post-create-project-cmd": [ 43 | "php artisan key:generate" 44 | ] 45 | }, 46 | "config": { 47 | "preferred-install": "dist" 48 | }, 49 | "minimum-stability": "stable" 50 | } 51 | -------------------------------------------------------------------------------- /app/database/seeds/OptionsTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'default_language', 9 | 'friendly_name' => 'Default Language', 10 | 'value' => 'en', 11 | 'options' => "en|nl|de", 12 | 'description' => 'If no language is set by the user, this is the default', 13 | ]); 14 | 15 | Option::create([ 16 | 'name' => 'application_title', 17 | 'friendly_name' => 'Application Title', 18 | 'value' => 'SSMS', 19 | 'description' => 'The title used in various places around the application', 20 | ]); 21 | 22 | Option::create([ 23 | 'name' => 'theme', 24 | 'friendly_name' => 'Theme', 25 | 'value' => 'blue', 26 | 'options' => "blue|red|green", 27 | 'description' => 'The colour theme the application', 28 | ]); 29 | 30 | Option::create([ 31 | 'name' => 'companion_script', 32 | 'friendly_name' => 'SSMS Companion Shell Script', 33 | 'value' => 'true', 34 | 'options' => "true|false", 35 | 'description' => 'Whether or not you are using the SSMS shell script to control your servers', 36 | ]); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /app/database/seeds/FlagsTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'fa fa-check', 9 | 'type' => 'success', 10 | 'message' => 'All OK!', 11 | ]); 12 | 13 | Flag::create([ 14 | 'icon' => 'fa fa-spinner fa-spin', 15 | 'type' => 'info', 16 | 'message' => 'Server is currently restarting!', 17 | ]); 18 | 19 | Flag::create([ 20 | 'icon' => 'fa-cloud-download', 21 | 'type' => 'info', 22 | 'message' => 'Server is currently updating!', 23 | ]); 24 | 25 | Flag::create([ 26 | 'icon' => 'fa fa-exclamation-triangle', 27 | 'type' => 'warning', 28 | 'message' => 'The current RCON password is incorrect for this server!', 29 | ]); 30 | 31 | Flag::create([ 32 | 'icon' => 'fa fa-eye', 33 | 'type' => 'warning', 34 | 'message' => 'Failed to connect to server on latest refresh - server may be changing maps!', 35 | ]); 36 | 37 | Flag::create([ 38 | 'icon' => 'fa fa-exclamation', 39 | 'type' => 'error', 40 | 'message' => 'Server down - the retries count has been breached!', 41 | ]); 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/views/partials/sidebar.blade.php: -------------------------------------------------------------------------------- 1 | 23 | -------------------------------------------------------------------------------- /app/views/templates/servers.view_players.php: -------------------------------------------------------------------------------- 1 | 6 | 42 | -------------------------------------------------------------------------------- /app/Ssms/Repositories/User/EloquentUserRepository.php: -------------------------------------------------------------------------------- 1 | model = $model; 16 | } 17 | 18 | /** 19 | * Returns a JSON object of a user(s) with the attatched roles 20 | * 21 | * @param int $id Optional id to return a specific user 22 | * @return object 23 | */ 24 | public function getWithRoles($id = null) 25 | { 26 | if (! is_null($id)) 27 | { 28 | return $this->model->with('roles')->find($id); 29 | } 30 | 31 | return $this->model->with('roles')->get(); 32 | } 33 | 34 | /** 35 | * Removes a role from a given user 36 | * 37 | * @param object $user Eloquent object of the user 38 | * @param int $role ID of the Role to remove 39 | * @return void 40 | */ 41 | public function removeRole($user, $role) 42 | { 43 | $user->roles()->detach($role); 44 | } 45 | 46 | /** 47 | * Assings a role to a given user 48 | * 49 | * @param object $user Eloquent object of the user 50 | * @param int $role ID of the Role to assign 51 | * @return void 52 | */ 53 | public function assignRole($user, $role) 54 | { 55 | $user->roles()->attach($role); 56 | } 57 | 58 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/StorageServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind('Ssms\Repositories\User\UserRepository', 'Ssms\Repositories\User\EloquentUserRepository'); 10 | $this->app->bind('Ssms\Repositories\Role\RoleRepository', 'Ssms\Repositories\Role\EloquentRoleRepository'); 11 | $this->app->bind('Ssms\Repositories\Permission\PermissionRepository', 'Ssms\Repositories\Permission\EloquentPermissionRepository'); 12 | $this->app->bind('Ssms\Repositories\Option\OptionRepository', 'Ssms\Repositories\Option\EloquentOptionRepository'); 13 | $this->app->bind('Ssms\Repositories\QuickLink\QuickLinkRepository', 'Ssms\Repositories\QuickLink\EloquentQuickLinkRepository'); 14 | $this->app->bind('Ssms\Repositories\Page\PageRepository', 'Ssms\Repositories\Page\EloquentPageRepository'); 15 | $this->app->bind('Ssms\Repositories\Notification\NotificationRepository', 'Ssms\Repositories\Notification\EloquentNotificationRepository'); 16 | $this->app->bind('Ssms\Repositories\Event\EventRepository', 'Ssms\Repositories\Event\EloquentEventRepository'); 17 | $this->app->bind('Ssms\Repositories\Service\ServiceRepository', 'Ssms\Repositories\Service\EloquentServiceRepository'); 18 | $this->app->bind('Ssms\Repositories\Server\ServerRepository', 'Ssms\Repositories\Server\EloquentServerRepository'); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /app/Ssms/Authorization/PermissionsBuilder.php: -------------------------------------------------------------------------------- 1 | auth instance 9 | * 10 | */ 11 | protected $auth; 12 | 13 | /** 14 | * Create a new PermissionBuilder instance. 15 | * 16 | * @return void 17 | */ 18 | public function __construct($auth) 19 | { 20 | $this->auth = $auth; 21 | $this->permissions = $this->getUserPermissions(); 22 | } 23 | 24 | /** 25 | * Returns the permissions which are accessible to the user in their 26 | * current authenticated state. 27 | * 28 | * @return json 29 | */ 30 | private function getUserPermissions() 31 | { 32 | if ($this->auth->guest()) 33 | { 34 | return Role::whereName('guest')->first()->permissions; 35 | } 36 | else 37 | { 38 | return $this->auth->user()->permissions; 39 | } 40 | } 41 | 42 | /** 43 | * Determins whether the user has permission for the 44 | * given value. 45 | * 46 | * @return bool 47 | */ 48 | public function validate($value, $type = 'name') 49 | { 50 | $access = false; 51 | 52 | foreach ($this->permissions as $permission) 53 | { 54 | if ($permission->$type == $value) 55 | { 56 | $access = true; 57 | break; 58 | } 59 | } 60 | 61 | return $access; 62 | } 63 | 64 | /** 65 | * Returns the permissions the user is able to access 66 | * 67 | * @return json 68 | */ 69 | public function permissions() 70 | { 71 | return $this->permissions; 72 | } 73 | } -------------------------------------------------------------------------------- /app/Ssms/Notifications/Services/ServiceHandler.php: -------------------------------------------------------------------------------- 1 | getServices($type); 10 | 11 | foreach ($services as $service) $this->{$service->name}($title, $message); 12 | } 13 | 14 | protected function isEnabled($type, $settings) 15 | { 16 | foreach ($settings as $item) 17 | { 18 | if ($item->name == "{$type}.enabled") 19 | { 20 | return ($item->value == 'true'); 21 | } 22 | } 23 | 24 | return false; 25 | } 26 | 27 | protected function email($title, $message) 28 | { 29 | // Send Email 30 | } 31 | 32 | protected function twitter($title, $message) 33 | { 34 | // Send Tweet 35 | } 36 | 37 | protected function hipchat($title, $message) 38 | { 39 | $settings = $this->getSettings(__FUNCTION__); 40 | 41 | if ($this->isEnabled(__FUNCTION__, $settings)) 42 | { 43 | foreach ($settings as $item) 44 | { 45 | if ($item->name == 'hipchat.room') $room = $item->value; 46 | if ($item->name == 'hipchat.auth') $auth = $item->value; 47 | } 48 | 49 | try 50 | { 51 | $hipchat = new HipChatService($room, $auth); 52 | $hipchat->send($title, $message); 53 | } 54 | catch (Exception $e) 55 | { 56 | // Log 57 | } 58 | } 59 | } 60 | 61 | protected function pushbullet($title, $message) 62 | { 63 | // Send 64 | } 65 | 66 | } -------------------------------------------------------------------------------- /app/Ssms/Repositories/User/UserRepository.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->integer('client_appid'); 19 | $table->string('name'); 20 | $table->string('ip'); 21 | $table->integer('port'); 22 | $table->string('tags')->nullable(); 23 | $table->longText('rcon_password'); 24 | $table->integer('multi_console'); 25 | $table->string('operating_system'); 26 | $table->string('version'); 27 | $table->string('network'); 28 | $table->string('current_map'); 29 | $table->integer('current_players'); 30 | $table->integer('current_bots')->nullable(); 31 | $table->integer('max_players'); 32 | $table->integer('auto_update'); 33 | $table->integer('retries')->default(0); 34 | $table->integer('hidden'); 35 | $table->string('start_map')->nullable(); 36 | $table->integer('daily_restart')->default(0); 37 | $table->string('daily_restart_time')->nullable(); 38 | $table->string('daily_restart_commands')->nullable(); 39 | 40 | $table->timestamps(); 41 | }); 42 | } 43 | 44 | /** 45 | * Reverse the migrations. 46 | * 47 | * @return void 48 | */ 49 | public function down() 50 | { 51 | Schema::drop('servers'); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/models/Role.php: -------------------------------------------------------------------------------- 1 | belongsToMany('User', 'role_user')->withTimestamps(); 33 | } 34 | 35 | /** 36 | * Attach role table to many-to-many relationship with "pages" table via the "page_role" pivot table. 37 | * 38 | */ 39 | public function pages() 40 | { 41 | return $this->belongsToMany('Page', 'page_role')->withTimestamps(); 42 | } 43 | 44 | /** 45 | * Attach role table to many-to-many relationship with "permissions" table via the "permission_role" pivot table. 46 | * 47 | */ 48 | public function permissions() 49 | { 50 | return $this->belongsToMany('Permission', 'permission_role')->withTimestamps(); 51 | } 52 | 53 | 54 | /** 55 | * Return value based on whether the current user has a role, based on their community ID 56 | * 57 | * @var bool 58 | */ 59 | public function hasUser($community_id) 60 | { 61 | foreach ($this->users as $user) 62 | { 63 | if($user->community_id == $community_id) return true; 64 | } 65 | 66 | return false; 67 | } 68 | } -------------------------------------------------------------------------------- /app/config/packages/hannesvdvreken/hipchat/config.php: -------------------------------------------------------------------------------- 1 | true, 13 | 14 | /* 15 | |-------------------------------------------------------------------------- 16 | | Notify 17 | |-------------------------------------------------------------------------- 18 | | 19 | | Use this switch to warn room members of new notification or not. Defaults to false. 20 | */ 21 | 'notify' => false, 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Rooms 26 | |-------------------------------------------------------------------------- 27 | | 28 | | Specify hipchat rooms in which to post notifications. 29 | | 30 | */ 31 | 'default' => 'main', 32 | 33 | 'rooms' => array( 34 | 35 | 'main' => array( 36 | 'room_id' => 'your-room-id', 37 | 'auth_token' => 'your-room-token', 38 | ), 39 | 40 | ), 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Color 45 | |-------------------------------------------------------------------------- 46 | | 47 | | Specify the color for the notifications background. Valid values are 48 | | 'yellow', 'red', 'green', 'purple', 'gray' and 'random'. Default to 'gray' 49 | | 50 | */ 51 | 52 | 'color' => 'gray', 53 | ); 54 | -------------------------------------------------------------------------------- /public/js/angular/controllers/settings/SettingsOptionsCtrl.js: -------------------------------------------------------------------------------- 1 | app.controller('SettingsOptionsCtrl', function($scope, $http, dialogs, http, toasty) 2 | { 3 | $scope.loading = true; 4 | $scope.error = false; 5 | $scope.options = {}; 6 | $scope.saving = {}; 7 | 8 | /** 9 | * Load SSMS options 10 | */ 11 | http.post(window.app_path + 'settings/options'). 12 | success(function(data) 13 | { 14 | $scope.options = data; 15 | $scope.loading = false; 16 | }). 17 | error(function(data, status, headers, config) 18 | { 19 | $scope.message = errorExceptionMessage(data, status, config); 20 | $scope.error = true; 21 | $scope.loading = false; 22 | }); 23 | 24 | /** 25 | * Update an option 26 | */ 27 | $scope.editOption = function(option) 28 | { 29 | $scope.saving[option.id] = true; 30 | 31 | http.post(window.app_path + 'settings/options/edit', JSON.stringify(option)). 32 | success(function(data) 33 | { 34 | $scope.saving[option.id] = false; 35 | if (! data.status) 36 | { 37 | toasty.pop.error({ 38 | title: 'An error occured saving the option!', 39 | msg: 'Click to more info.', 40 | timeout: 7000, 41 | onClick: function(toasty) { 42 | dialogs.error('An error occured while saving the option!', errorMessage(data.code, data.message)); 43 | } 44 | }); 45 | } 46 | else 47 | { 48 | $scope.options[findWithAttr($scope.options, 'id', option.id)] = data.payload; 49 | toasty.pop.success({title: data.message}); 50 | } 51 | }). 52 | error(function(data, status, headers, config) 53 | { 54 | $scope.saving[option.id] = false; 55 | dialogs.error('A fatal error occured!', errorExceptionMessage(data, status, config)); 56 | }); 57 | } 58 | }); -------------------------------------------------------------------------------- /app/Ssms/Authorization/AccessBuilder.php: -------------------------------------------------------------------------------- 1 | auth instance 9 | * 10 | */ 11 | protected $auth; 12 | 13 | /** 14 | * Create a new AccessBuilder instance. 15 | * 16 | * @return void 17 | */ 18 | public function __construct($auth) 19 | { 20 | $this->auth = $auth; 21 | $this->pages = $this->getAccessiblePages(); 22 | } 23 | 24 | /** 25 | * Returns the pages which are accessible to the user in their 26 | * current authenticated state. 27 | * 28 | * @return json 29 | */ 30 | private function getAccessiblePages() 31 | { 32 | if ($this->auth->guest()) 33 | { 34 | return Role::whereName('guest')->first()->pages; 35 | } 36 | else 37 | { 38 | return $this->auth->user()->pages; 39 | } 40 | } 41 | 42 | /** 43 | * Determins whether the user has any pages to access. 44 | * 45 | * @return bool 46 | */ 47 | protected function count() 48 | { 49 | if (count($this->pages->toArray()) == 0) 50 | { 51 | return false; 52 | } 53 | 54 | return true; 55 | } 56 | 57 | /** 58 | * Validates whether the given user has access 59 | * to a given page 60 | * 61 | * @return bool 62 | */ 63 | public function validate($value, $type = 'slug') 64 | { 65 | $access = false; 66 | 67 | if ($this->count()) 68 | { 69 | foreach ($this->pages as $page) 70 | { 71 | if ($page->$type == $value) 72 | { 73 | $access = true; 74 | break; 75 | } 76 | } 77 | } 78 | 79 | return $access; 80 | } 81 | 82 | /** 83 | * Returns the pages the user is able to access 84 | * 85 | * @return json 86 | */ 87 | public function pages() 88 | { 89 | return $this->pages; 90 | } 91 | } -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader 15 | | for our application. We just need to utilize it! We'll require it 16 | | into the script here so that we do not have to worry about the 17 | | loading of any our classes "manually". Feels great to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let's turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight these users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/start.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can simply call the run method, 43 | | which will execute the request and send the response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful application we have whipped up for them. 46 | | 47 | */ 48 | 49 | $app->run(); 50 | -------------------------------------------------------------------------------- /app/config/remote.php: -------------------------------------------------------------------------------- 1 | 'production', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Remote Server Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | These are the servers that will be accessible via the SSH task runner 24 | | facilities of Laravel. This feature radically simplifies executing 25 | | tasks on your servers, such as deploying out these applications. 26 | | 27 | */ 28 | 29 | 'connections' => array( 30 | 31 | 'production' => array( 32 | 'host' => '', 33 | 'username' => '', 34 | 'password' => '', 35 | 'key' => '', 36 | 'keyphrase' => '', 37 | 'root' => '/var/www', 38 | ), 39 | 40 | ), 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Remote Server Groups 45 | |-------------------------------------------------------------------------- 46 | | 47 | | Here you may list connections under a single group name, which allows 48 | | you to easily access all of the servers at once using a short name 49 | | that is extremely easy to remember, such as "web" or "database". 50 | | 51 | */ 52 | 53 | 'groups' => array( 54 | 55 | 'web' => array('production') 56 | 57 | ), 58 | 59 | ); 60 | -------------------------------------------------------------------------------- /app/commands/TriggerCommand.php: -------------------------------------------------------------------------------- 1 | info('There are no servers to run triggers against!'); 45 | $this->abort(); 46 | } 47 | 48 | $this->info('Running server triggers:'); 49 | 50 | $servers = Ssms\Server::all(); 51 | 52 | foreach ($servers as $servers) 53 | { 54 | // IF: retries count > value : set flag 6 55 | // IF: retries count < value > 0 : set flag 5 56 | } 57 | 58 | 59 | } 60 | 61 | /** 62 | * Get the console command arguments. 63 | * 64 | * @return array 65 | */ 66 | protected function getArguments() 67 | { 68 | return []; 69 | } 70 | 71 | /** 72 | * Get the console command options. 73 | * 74 | * @return array 75 | */ 76 | protected function getOptions() 77 | { 78 | return []; 79 | } 80 | 81 | /** 82 | * Abort message 83 | * 84 | */ 85 | protected function abort() 86 | { 87 | return $this->error("\n*** Aborted!. ***") . die(); 88 | } 89 | } -------------------------------------------------------------------------------- /app/database/seeds/EventsTableSeeder.php: -------------------------------------------------------------------------------- 1 | services()->attach($service['id']); 10 | } 11 | 12 | return; 13 | } 14 | 15 | public function run() 16 | { 17 | $event = Ssms\Event::create([ 18 | 'name' => 'user.add', 19 | 'description' => 'When a new user is added', 20 | ]); 21 | 22 | $this->attach($event, Service::whereName('hipchat')->get()); 23 | 24 | $event = Ssms\Event::create([ 25 | 'name' => 'user.delete', 26 | 'description' => 'When a user is deleted', 27 | ]); 28 | 29 | $this->attach($event, Service::whereName('hipchat')->get()); 30 | 31 | $event = Ssms\Event::create([ 32 | 'name' => 'server.up', 33 | 'description' => 'When a server is back up after being down', 34 | ]); 35 | 36 | $this->attach($event, Service::all()); 37 | 38 | $event = Ssms\Event::create([ 39 | 'name' => 'server.down', 40 | 'description' => 'When a server is down (retry threshold breached)', 41 | ]); 42 | 43 | $this->attach($event, Service::all()); 44 | 45 | $event = Ssms\Event::create([ 46 | 'name' => 'server.updating', 47 | 'description' => 'When a server is updating', 48 | ]); 49 | 50 | $this->attach($event, Service::where('name', 'email')->orWhere('name', 'hipchat')->get()); 51 | 52 | $event = Ssms\Event::create([ 53 | 'name' => 'server.restart', 54 | 'description' => 'When a server is restarting', 55 | ]); 56 | 57 | $this->attach($event, Service::whereName('hipchat')->get()); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /app/controllers/PageController.php: -------------------------------------------------------------------------------- 1 | pages = $pages; 21 | $this->roles = $roles; 22 | } 23 | 24 | public function get() 25 | { 26 | return $this->pages->getWithRoles(); 27 | } 28 | 29 | public function edit() 30 | { 31 | $data = Input::all(); 32 | 33 | // If no icon given 34 | if ($this->isEmpty($data['edit']['icon'])) return $this->jsonResponse(400, false, "The icon field cannot be left empty!"); 35 | 36 | // If invalid font awesome name 37 | if (! $this->isValidFontAwesome($data['edit']['icon'])) return $this->jsonResponse(400, false, "The icon name supplied is not a valid Font Awesome icon!"); 38 | 39 | // Page must have a role attached 40 | if (count($data['edit']['role']) == 0) return $this->jsonResponse(400, false, "A page must have at least one role!"); 41 | 42 | try 43 | { 44 | $page = $this->pages->edit($data['id'], ['icon' => $data['edit']['icon']]); 45 | 46 | $roles = $this->roles->getAll(); 47 | 48 | foreach ($roles as $role) 49 | { 50 | $this->pages->removeRole($page, $role['id']); 51 | } 52 | 53 | //Give page new set of chosen roles 54 | foreach ($data['edit']['role'] as $role) 55 | { 56 | $this->pages->assignRole($page, $role['id']); 57 | } 58 | } 59 | catch (Exception $e) 60 | { 61 | return $this->jsonResponse(400, false, $e->getMessage()); 62 | } 63 | 64 | return $this->jsonResponse(200, true, 'Page successfully updated!', $this->pages->getWithRoles($data['id'])); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /bootstrap/paths.php: -------------------------------------------------------------------------------- 1 | __DIR__.'/../app', 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Public Path 21 | |-------------------------------------------------------------------------- 22 | | 23 | | The public path contains the assets for your web application, such as 24 | | your JavaScript and CSS files, and also contains the primary entry 25 | | point for web requests into these applications from the outside. 26 | | 27 | */ 28 | 29 | 'public' => __DIR__.'/../public', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Base Path 34 | |-------------------------------------------------------------------------- 35 | | 36 | | The base path is the root of the Laravel installation. Most likely you 37 | | will not need to change this value. But, if for some wild reason it 38 | | is necessary you will do so here, just proceed with some caution. 39 | | 40 | */ 41 | 42 | 'base' => __DIR__.'/..', 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Storage Path 47 | |-------------------------------------------------------------------------- 48 | | 49 | | The storage path is used by Laravel to store cached Blade views, logs 50 | | and other pieces of information. You may modify the path here when 51 | | you want to change the location of this directory for your apps. 52 | | 53 | */ 54 | 55 | 'storage' => __DIR__.'/../app/storage', 56 | 57 | ); 58 | -------------------------------------------------------------------------------- /app/Ssms/Repositories/EloquentRepository.php: -------------------------------------------------------------------------------- 1 | model->get($select); 13 | 14 | return $this->model->get(); 15 | } 16 | 17 | /** 18 | * Return a collection of model objects, with parameters 19 | * 20 | * @return object 21 | */ 22 | public function getBy($type, $value, $operator = '=') 23 | { 24 | return $this->model->where($type, $operator, $value)->get(); 25 | } 26 | 27 | /** 28 | * Return a model object, with parameters 29 | * 30 | * @return object 31 | */ 32 | public function getFirst($type, $value, $operator = '=') 33 | { 34 | return $this->model->where($type, $operator, $value)->first(); 35 | } 36 | 37 | /** 38 | * Count the number of rows in the model 39 | * 40 | * @return int 41 | */ 42 | public function count() 43 | { 44 | return $this->model->count(); 45 | } 46 | 47 | /** 48 | * Create a new row in the model, using an array of values 49 | * 50 | * @param array $array An array on key (column) value items 51 | * @return object 52 | */ 53 | public function add($array) 54 | { 55 | return $this->model->create($array); 56 | } 57 | 58 | /** 59 | * Delete a row in a model by ID 60 | * 61 | * @param int $id ID of the row to delete 62 | * @return void 63 | */ 64 | public function delete($id) 65 | { 66 | $this->model->destroy($id); 67 | } 68 | 69 | /** 70 | * Edits a row by ID in a model with an array of values 71 | * 72 | * @param int $id ID of the row to edit 73 | * @param array $array An array on key (column) value items 74 | * @return object 75 | */ 76 | public function edit($id, $array) 77 | { 78 | $model = $this->model->find($id); 79 | 80 | foreach ($array as $key => $value) 81 | { 82 | $model->$key = $value; 83 | } 84 | 85 | $model->save(); 86 | 87 | return $model; 88 | } 89 | } -------------------------------------------------------------------------------- /app/controllers/PermissionController.php: -------------------------------------------------------------------------------- 1 | permissions = $permissions; 21 | $this->roles = $roles; 22 | } 23 | 24 | /** 25 | * Get the permissions with their roles and page 26 | * 27 | * @return object 28 | */ 29 | public function get() 30 | { 31 | return $this->permissions->getWithRolesPage(); 32 | } 33 | 34 | /** 35 | * Edit a permission 36 | * 37 | * @return json 38 | */ 39 | public function edit() 40 | { 41 | $data = Input::all(); 42 | 43 | // Permission must have a role attached 44 | if (count($data['edit']['role']) == 0) return $this->jsonResponse(400, false, "A permission must have at least one role!"); 45 | 46 | // Stop user assigning User/Guest role to servers.rcon and multi_console.execute 47 | if ($data['name'] == 'multi_console.execute' || $data['name'] == 'servers.rcon') 48 | { 49 | foreach ($data['edit']['role'] as $role) 50 | { 51 | if ($role['name'] == 'user' || $role['name'] == 'guest') return $this->jsonResponse(400, false, "Unable to give permissions to User or Guest for security reasons!"); 52 | } 53 | } 54 | 55 | try 56 | { 57 | $permission = $this->permissions->getFirst('id', $data['id']); 58 | 59 | $roles = $this->roles->getAll(); 60 | 61 | foreach ($roles as $role) 62 | { 63 | $this->permissions->removeRole($permission, $role['id']); 64 | } 65 | 66 | //Give page new set of chosen roles 67 | foreach ($data['edit']['role'] as $role) 68 | { 69 | $this->permissions->assignRole($permission, $role['id']); 70 | } 71 | } 72 | catch (Exception $e) 73 | { 74 | return $this->jsonResponse(400, false, $e->getMessage()); 75 | } 76 | 77 | return $this->jsonResponse(200, true, 'Permission has successfully been updated!', $this->permissions->getWithRolesPage($data['id'])); 78 | } 79 | 80 | 81 | } -------------------------------------------------------------------------------- /public/js/helpers.js: -------------------------------------------------------------------------------- 1 | // Creates an error message with a given Angular $http promise 2 | function errorExceptionMessage(data, status, config) 3 | { 4 | message = "An error occured!
"; 5 | message += "Error: " + data.error.message + "
"; 6 | message += "Exception: " + data.error.type + "
"; 7 | message += config.method + " " + config.url + ", HTTP status " + status; 8 | 9 | return message; 10 | } 11 | 12 | // Creates an error message with a given parameters 13 | function errorMessage(httpCode, data) 14 | { 15 | message = "An error occured!
"; 16 | message += "HTTP Code: " + httpCode + "
"; 17 | message += "Message: " + data + "
"; 18 | 19 | return message; 20 | } 21 | 22 | // Find the key of an object/array by specified value 23 | function findWithAttr(array, attr, value) { 24 | for(var i = 0; i < array.length; i += 1) { 25 | if(array[i][attr] === value) { 26 | return i; 27 | } 28 | } 29 | } 30 | 31 | // Validates a number 32 | function validateNumber(num) 33 | { 34 | var regexp = /^[0-9]/g; 35 | 36 | return regexp.test(num); 37 | } 38 | 39 | // Validate a string for a valid Steam ID 40 | function validateSteamData(string) 41 | { 42 | if (! string || /[^a-zA-Z0-9_:]/.test(string)) return false; 43 | 44 | if (! validateNumber(string)) 45 | { 46 | if(! /^STEAM_[0-5]:[01]:\d+$/.test(string)) return false; 47 | } 48 | 49 | return true; 50 | } 51 | 52 | // Validates an IP Address 53 | function validateIp(ip) 54 | { 55 | var regexp = /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/g; 56 | 57 | return regexp.test(ip); 58 | } 59 | 60 | // Validates a hostname 61 | function validateHost(host) 62 | { 63 | var regexp = /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/g; 64 | 65 | return regexp.test(host); 66 | } 67 | 68 | // Validates a HH:MM:SS timestamp 69 | function validateTime(time) 70 | { 71 | var regexp = /^(?:2[0-3]|[01][0-9]):[0-5][0-9]:[0-5][0-9]$/; 72 | 73 | return regexp.test(time); 74 | } 75 | 76 | // Checks whether a given value is set 77 | function isEmpty(value) 78 | { 79 | if (value == null || typeof value === "undefined" || value == '') return true; 80 | 81 | return false; 82 | } -------------------------------------------------------------------------------- /app/views/master.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | @yield('page_meta_title', $siteOptions['application_title']) 8 | 9 | @section('assets') 10 | [[-- CSS Vendor --]] 11 | [[ HTML::style('assets/vendor/bootstrap-css-only/css/bootstrap.min.css') ]] 12 | [[ HTML::style('assets/vendor/font-awesome/css/font-awesome.min.css') ]] 13 | [[ HTML::style('assets/vendor/angular-dialog-service/dialogs.min.css') ]] 14 | [[ HTML::style('assets/vendor/angular-toasty/css/ng-toasty.css') ]] 15 | 16 | [[-- JS Vendor --]] 17 | [[ HTML::script('assets/vendor/angular/angular.min.js') ]] 18 | [[ HTML::script('assets/vendor/angular-bootstrap/ui-bootstrap-tpls.min.js') ]] 19 | [[ HTML::script('assets/vendor/angular-cookies/angular-cookies.min.js') ]] 20 | [[ HTML::script('assets/vendor/angular-sanitize/angular-sanitize.min.js') ]] 21 | [[ HTML::script('assets/vendor/angular-translate/angular-translate.min.js') ]] 22 | [[ HTML::script('assets/vendor/angular-animate/angular-animate.min.js') ]] 23 | [[ HTML::script('assets/vendor/angular-dialog-service/dialogs.min.js') ]] 24 | [[ HTML::script('assets/vendor/angular-toasty/js/ng-toasty.min.js') ]] 25 | 26 | [[-- Custom CSS --]] 27 | [[ HTML::style('css/dashboard.min.css') ]] 28 | [[ HTML::style('css/themes/' . $siteOptions['theme'] . '.min.css') ]] 29 | 30 | [[-- Custom JS --]] 31 | [[ HTML::script('js/helpers.js') ]] 32 | [[ HTML::script('js/angular/bootstrap.js') ]] 33 | [[ HTML::script('js/angular/directives.js') ]] 34 | [[ HTML::script('js/angular/services.js') ]] 35 | @show 36 | 37 | 38 | 39 |
40 | 41 | 42 | 45 | 46 | 47 |
48 |
49 | 50 | @include('partials.header') 51 | 52 | @include('partials.flash') 53 | 54 | @yield('content') 55 | 56 |
57 |
58 |
59 | @include('partials.toasty') 60 | 61 | 62 | -------------------------------------------------------------------------------- /app/views/partials/header.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 | @yield('page_title', Lang::get('header.defaultTitle')) 6 |
7 | 10 |
11 | @if(Auth::check()) 12 |
13 | 45 | 58 |
59 | @else 60 | 65 | @endif 66 |
67 |
-------------------------------------------------------------------------------- /app/config/auth.php: -------------------------------------------------------------------------------- 1 | 'eloquent', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Authentication Model 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "Eloquent" authentication driver, we need to know which 26 | | Eloquent model should be used to retrieve your users. Of course, it 27 | | is often just the "User" model but you may use whatever you like. 28 | | 29 | */ 30 | 31 | 'model' => 'User', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Authentication Table 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "Database" authentication driver, we need to know which 39 | | table should be used to retrieve your users. We have chosen a basic 40 | | default value but you may easily change it to any table you like. 41 | | 42 | */ 43 | 44 | 'table' => 'users', 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Password Reminder Settings 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here you may set the settings for password reminders, including a view 52 | | that should be used as your password reminder e-mail. You will also 53 | | be able to set the name of the table that holds the reset tokens. 54 | | 55 | | The "expire" time is the number of minutes that the reminder should be 56 | | considered valid. This security feature keeps tokens short-lived so 57 | | they have less time to be guessed. You may change this as needed. 58 | | 59 | */ 60 | 61 | 'reminder' => array( 62 | 63 | 'email' => 'emails.auth.reminder', 64 | 65 | 'table' => 'password_reminders', 66 | 67 | 'expire' => 60, 68 | 69 | ), 70 | 71 | ); 72 | -------------------------------------------------------------------------------- /app/config/queue.php: -------------------------------------------------------------------------------- 1 | 'sync', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => array( 32 | 33 | 'sync' => array( 34 | 'driver' => 'sync', 35 | ), 36 | 37 | 'beanstalkd' => array( 38 | 'driver' => 'beanstalkd', 39 | 'host' => 'localhost', 40 | 'queue' => 'default', 41 | 'ttr' => 60, 42 | ), 43 | 44 | 'sqs' => array( 45 | 'driver' => 'sqs', 46 | 'key' => 'your-public-key', 47 | 'secret' => 'your-secret-key', 48 | 'queue' => 'your-queue-url', 49 | 'region' => 'us-east-1', 50 | ), 51 | 52 | 'iron' => array( 53 | 'driver' => 'iron', 54 | 'host' => 'mq-aws-us-east-1.iron.io', 55 | 'token' => 'your-token', 56 | 'project' => 'your-project-id', 57 | 'queue' => 'your-queue-name', 58 | 'encrypt' => true, 59 | ), 60 | 61 | 'redis' => array( 62 | 'driver' => 'redis', 63 | 'queue' => 'default', 64 | ), 65 | 66 | ), 67 | 68 | /* 69 | |-------------------------------------------------------------------------- 70 | | Failed Queue Jobs 71 | |-------------------------------------------------------------------------- 72 | | 73 | | These options configure the behavior of failed queue job logging so you 74 | | can control which database and table are used to store the jobs that 75 | | have failed. You may change them to any database / table you wish. 76 | | 77 | */ 78 | 79 | 'failed' => array( 80 | 81 | 'database' => 'mysql', 'table' => 'failed_jobs', 82 | 83 | ), 84 | 85 | ); 86 | -------------------------------------------------------------------------------- /app/controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | layout)) 13 | { 14 | $this->layout = View::make($this->layout); 15 | } 16 | } 17 | 18 | /** 19 | * Return a structured Json response. 20 | * 21 | * @return json 22 | */ 23 | protected function jsonResponse($httpCode, $status, $message, $payload = null, $exceptionCode = null) 24 | { 25 | $json['code'] = $httpCode; 26 | $json['status'] = $status; 27 | $json['message'] = $message; 28 | ! is_null($payload) ? $json['payload'] = $payload :''; 29 | ! is_null($exceptionCode) ? $json['exceptionCode'] = $exceptionCode :''; 30 | 31 | return Response::json($json); 32 | } 33 | 34 | /** 35 | * Return whether a given value is "empty" 36 | * 37 | * @return bool 38 | */ 39 | protected function isEmpty($value) 40 | { 41 | if ($value === null || $value == '' || $value == 'null') return true; 42 | 43 | return false; 44 | } 45 | 46 | /** 47 | * Return whether a given value starts with the Font Awesome 48 | * class declaration. 49 | * 50 | * @return bool 51 | */ 52 | protected function isValidFontAwesome($value) 53 | { 54 | if (strpos($value, 'fa fa-') !== false) return true; 55 | 56 | return false; 57 | } 58 | 59 | /** 60 | * Return whether a given value is a URL 61 | * 62 | * @return bool 63 | */ 64 | protected function isValidUrl($value) 65 | { 66 | if (strpos($value, 'http://') !== false || strpos($value, 'https://') !== false) return true; 67 | 68 | return false; 69 | } 70 | 71 | /** 72 | * Return whether a given string are all valid email addresses 73 | * 74 | * @return bool 75 | */ 76 | protected function isValidEmails($value) 77 | { 78 | $value = preg_replace('/\s+/', '', $value); 79 | 80 | if (strpos($value, ';') !== false) 81 | { 82 | $emails = explode(';', $value); 83 | 84 | foreach ($emails as $email) 85 | { 86 | if(! $this->validateEmail($email)) return false; 87 | } 88 | 89 | return true; 90 | } 91 | else 92 | { 93 | return $this->validateEmail($value); 94 | } 95 | } 96 | 97 | private function validateEmail($email) 98 | { 99 | if(! filter_var($email, FILTER_VALIDATE_EMAIL)) return false; 100 | 101 | return true; 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /public/js/angular/controllers/settings/SettingsPageManagementCtrl.js: -------------------------------------------------------------------------------- 1 | app.controller('SettingsPageManagementCtrl', function($scope, $http, dialogs, http, toasty) 2 | { 3 | $scope.loading = true; 4 | $scope.error = false; 5 | $scope.pages = {}; 6 | $scope.edit = {}; 7 | $scope.saving = {}; 8 | $scope.selectedRoles = {}; 9 | 10 | $scope.roles = window.roles; 11 | 12 | /** 13 | * Load SSMS options 14 | */ 15 | http.post(window.app_path + 'settings/page-management'). 16 | success(function(data) 17 | { 18 | $scope.pages = data; 19 | $scope.loading = false; 20 | }). 21 | error(function(data, status, headers, config) 22 | { 23 | $scope.message = errorExceptionMessage(data, status, config); 24 | $scope.error = true; 25 | $scope.loading = false; 26 | }); 27 | 28 | /** 29 | * Edit page settings 30 | */ 31 | $scope.editPage = function(page) 32 | { 33 | $scope.edit[page.id] = ! angular.isDefined($scope.edit[page.id]) ? true : ! $scope.edit[page.id]; 34 | 35 | // Assign a variable the roles the page has so we're able to default them 36 | $scope.selectedRoles[page.id] = []; 37 | angular.forEach(page.roles, function(value, key) 38 | { 39 | if (angular.isDefined($scope.roles[findWithAttr($scope.roles, 'id', value.id)])) 40 | { 41 | $scope.selectedRoles[page.id].push($scope.roles[findWithAttr($scope.roles, 'id', value.id)]); 42 | } 43 | }); 44 | } 45 | 46 | /** 47 | * Save page settings 48 | */ 49 | $scope.savePage = function(page) 50 | { 51 | $scope.saving[page.id] = true; 52 | 53 | http.post(window.app_path + 'settings/page-management/edit', JSON.stringify(page)). 54 | success(function(data) 55 | { 56 | $scope.saving[page.id] = false; 57 | 58 | if(! data.status) 59 | { 60 | toasty.pop.error({ 61 | title: 'Failed to save changes!', 62 | msg: 'Click to more info.', 63 | timeout: 7000, 64 | onClick: function(toasty) { 65 | dialogs.error('An error occured saving the page changes!', errorMessage(data.code, data.message)); 66 | } 67 | }); 68 | } 69 | else 70 | { 71 | toasty.pop.success({title: data.message}); 72 | // Update the user before we close the edit area 73 | $scope.pages[findWithAttr($scope.pages, 'id', page.id)] = data.payload; 74 | $scope.edit[page.id] = false; 75 | } 76 | }). 77 | error(function(data, status, headers, config) 78 | { 79 | $scope.saving[page.id] = false; 80 | dialogs.error('A fatal error occured!', errorExceptionMessage(data, status, config)); 81 | }); 82 | } 83 | }); -------------------------------------------------------------------------------- /app/views/pages/settings/options.blade.php: -------------------------------------------------------------------------------- 1 | @extends('master') 2 | 3 | @section('page_title') 4 | Options 5 | @stop 6 | 7 | @section('page_breadcrumb') 8 | [[ HTML::link('/', 'SSMS') ]] / [[ HTML::link(URL::route('settings'), 'Settings') ]] / [[ HTML::link(URL::route('settings.options'), 'Options') ]] 9 | @stop 10 | 11 | @section('assets') 12 | @parent 13 | [[ HTML::script('js/angular/controllers/settings/SettingsOptionsCtrl.js') ]] 14 | @stop 15 | 16 | @section('content') 17 |
18 |
19 |
20 |
21 |
22 | Manage Options 23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 52 | 55 | 56 | 61 | 62 | 63 |
OptionDescriptionValueLast Updated
50 | 51 | 53 | 54 | 57 | 60 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | @stop -------------------------------------------------------------------------------- /bootstrap/start.php: -------------------------------------------------------------------------------- 1 | detectEnvironment(function() { 28 | 29 | return getenv('ENV') ?: 'local'; 30 | 31 | }); 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Bind Paths 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here we are binding the paths configured in paths.php to the app. You 39 | | should not be changing these here. If you need to change these you 40 | | may do so within the paths.php file and they will be bound here. 41 | | 42 | */ 43 | 44 | $app->bindInstallPaths(require __DIR__.'/paths.php'); 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Load The Application 49 | |-------------------------------------------------------------------------- 50 | | 51 | | Here we will load this Illuminate application. We will keep this in a 52 | | separate location so we can isolate the creation of an application 53 | | from the actual running of the application with a given request. 54 | | 55 | */ 56 | 57 | $framework = $app['path.base']. 58 | '/vendor/laravel/framework/src'; 59 | 60 | require $framework.'/Illuminate/Foundation/start.php'; 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Return The Application 65 | |-------------------------------------------------------------------------- 66 | | 67 | | This script returns the application instance. The instance is given to 68 | | the calling script so we can separate the building of the instances 69 | | from the actual running of the application and sending responses. 70 | | 71 | */ 72 | 73 | return $app; 74 | -------------------------------------------------------------------------------- /app/controllers/NotificationController.php: -------------------------------------------------------------------------------- 1 | notifications = $notifications; 27 | $this->events = $events; 28 | $this->services = $services; 29 | } 30 | 31 | public function get() 32 | { 33 | return $this->notifications->getAll(); 34 | } 35 | 36 | public function edit() 37 | { 38 | $data = Input::all(); 39 | 40 | if ($data['name'] == 'retries' && ! ctype_digit($data['value'])) return $this->jsonResponse(400, false, "Please enter a valid integer number!"); 41 | 42 | if ($data['name'] == 'retries' && intval($data['value']) < 3) return $this->jsonResponse(400, false, "The minimum retry time is 3 minutes!"); 43 | 44 | if ($data['name'] == 'email.addresses' && ! $this->isValidEmails($data['value'])) return $this->jsonResponse(400, false, "An email address entered is not valid!"); 45 | 46 | try 47 | { 48 | $notification = $this->notifications->edit($data['id'], ['value' => $data['value']]); 49 | } 50 | catch (Exception $e) 51 | { 52 | return $this->jsonResponse(400, false, $e->getMessage()); 53 | } 54 | 55 | return $this->jsonResponse(200, true, 'The notification setting has been updated!', $notification); 56 | } 57 | 58 | public function getEvents() 59 | { 60 | return $this->events->getWithServices(); 61 | } 62 | 63 | public function editEvent() 64 | { 65 | $data = Input::all(); 66 | 67 | try 68 | { 69 | $services = $this->services->getAll(); 70 | 71 | $event = $this->events->getFirst('id', $data['id']); 72 | 73 | foreach ($services as $service) 74 | { 75 | $this->events->removeService($event, $service['id']); 76 | } 77 | 78 | foreach ($data['edit']['service'] as $service) 79 | { 80 | $this->events->assignService($event, $service['id']); 81 | } 82 | } 83 | catch (Exception $e) 84 | { 85 | return $this->jsonResponse(400, false, $e->getMessage()); 86 | } 87 | 88 | return $this->jsonResponse(200, true, 'The event has been updated!', $this->events->getWithServices($data['id'])); 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /public/js/angular/controllers/settings/SettingsPermissionControlCtrl.js: -------------------------------------------------------------------------------- 1 | app.controller('SettingsPermissionControlCtrl', function($scope, $http, dialogs, http, toasty) 2 | { 3 | $scope.loading = true; 4 | $scope.error = false; 5 | $scope.permissions = {}; 6 | $scope.saving = {}; 7 | $scope.edit = {}; 8 | $scope.saving = {}; 9 | $scope.selectedRoles = {}; 10 | 11 | $scope.roles = window.roles; 12 | 13 | /** 14 | * Load SSMS permissions 15 | */ 16 | http.post(window.app_path + 'settings/permission-control'). 17 | success(function(data) 18 | { 19 | $scope.permissions = data; 20 | $scope.loading = false; 21 | }). 22 | error(function(data, status, headers, config) 23 | { 24 | $scope.message = errorExceptionMessage(data, status, config); 25 | $scope.error = true; 26 | $scope.loading = false; 27 | }); 28 | 29 | /** 30 | * Edit permission 31 | */ 32 | $scope.editPermission = function(permission) 33 | { 34 | $scope.edit[permission.id] = ! angular.isDefined($scope.edit[permission.id]) ? true : ! $scope.edit[permission.id]; 35 | 36 | // Assign a variable the roles the permission has so we're able to default them 37 | $scope.selectedRoles[permission.id] = []; 38 | angular.forEach(permission.roles, function(value, key) 39 | { 40 | if (angular.isDefined($scope.roles[findWithAttr($scope.roles, 'id', value.id)])) 41 | { 42 | $scope.selectedRoles[permission.id].push($scope.roles[findWithAttr($scope.roles, 'id', value.id)]); 43 | } 44 | }); 45 | } 46 | 47 | /** 48 | * Save permission settings 49 | */ 50 | $scope.savePermission = function(permission) 51 | { 52 | $scope.saving[permission.id] = true; 53 | 54 | http.post(window.app_path + 'settings/permission-control/edit', JSON.stringify(permission)). 55 | success(function(data) 56 | { 57 | $scope.saving[permission.id] = false; 58 | 59 | if(! data.status) 60 | { 61 | toasty.pop.error({ 62 | title: 'Failed to save changes!', 63 | msg: 'Click to more info.', 64 | timeout: 7000, 65 | onClick: function(toasty) { 66 | dialogs.error('An error occured saving the permission changes!', errorMessage(data.code, data.message)); 67 | } 68 | }); 69 | } 70 | else 71 | { 72 | toasty.pop.success({title: data.message}); 73 | // Update the permission before we close the edit area 74 | $scope.permissions[findWithAttr($scope.permissions, 'id', permission.id)] = data.payload; 75 | $scope.edit[permission.id] = false; 76 | } 77 | }). 78 | error(function(data, status, headers, config) 79 | { 80 | $scope.saving = false; 81 | dialogs.error('A fatal error occured!', errorExceptionMessage(data, status, config)); 82 | }); 83 | } 84 | 85 | }); -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | setRequestForConsoleEnvironment(); 45 | 46 | $artisan = Illuminate\Console\Application::start($app); 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Run The Artisan Application 51 | |-------------------------------------------------------------------------- 52 | | 53 | | When we run the console application, the current CLI command will be 54 | | executed in this console and the response sent back to a terminal 55 | | or another output device for the developers. Here goes nothing! 56 | | 57 | */ 58 | 59 | $status = $artisan->run(); 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Shutdown The Application 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Once Artisan has finished running. We will fire off the shutdown events 67 | | so that any final work may be done by the application before we shut 68 | | down the process. This is the last thing to happen to the request. 69 | | 70 | */ 71 | 72 | $app->shutdown(); 73 | 74 | exit($status); 75 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | users = $users; 21 | $this->roles = $roles; 22 | } 23 | 24 | /** 25 | * Returns an array of user details with a given SteamId object 26 | * 27 | * @return array 28 | */ 29 | 30 | protected function userDetails($steamObject, $enabled = 1) 31 | { 32 | $array = [ 33 | 'community_id' => $steamObject->getSteamId64(), 34 | 'nickname' => $steamObject->getNickname(), 35 | 'avatar' => $steamObject->getMediumAvatarUrl(), 36 | 'enabled' => $enabled, 37 | ]; 38 | 39 | return $array; 40 | } 41 | 42 | /** 43 | * Validates an incoming response from Steam against the database 44 | * 45 | * @return Redirect 46 | */ 47 | 48 | public function validateSteamLogin() 49 | { 50 | $validate = SteamLogin::validate(); 51 | 52 | if (is_null($validate)) 53 | { 54 | throw new Exception(Lang::get('auth.invalidResponse')); 55 | } 56 | else 57 | { 58 | $steamObject = new SteamId($validate); 59 | 60 | if ($this->users->count() == 0) 61 | { 62 | $user = $this->users->add($this->userDetails($steamObject)); 63 | 64 | $roles = $this->roles->getAll(); 65 | 66 | foreach ($roles as $role) 67 | { 68 | $this->users->assignRole($user, $role->id); 69 | } 70 | 71 | Auth::login($user); 72 | 73 | return Redirect::route('settings') 74 | ->withFlashNotification(Lang::get('auth.firstLogin')) 75 | ->withFlashNotificationLevel('success'); 76 | } 77 | else 78 | { 79 | $user = $this->users->getFirst('community_id', $steamObject->getSteamId64()); 80 | 81 | if (is_null($user)) 82 | { 83 | throw new Exception(Lang::get('auth.noAccess')); 84 | } 85 | else 86 | { 87 | if ($user->enabled == 0) 88 | { 89 | throw new Exception(Lang::get('auth.accountDisabled')); 90 | } 91 | else 92 | { 93 | $this->users->edit($user->id, $this->userDetails($steamObject)); 94 | 95 | Auth::login($user); 96 | 97 | return Redirect::route('dashboard') 98 | ->withFlashNotification(Lang::get('auth.successfulLogin')) 99 | ->withFlashNotificationLevel('success'); 100 | } 101 | } 102 | } 103 | } 104 | } 105 | 106 | /** 107 | * Logs the user out of the application 108 | * 109 | * @return Redirect 110 | */ 111 | 112 | public function logout() 113 | { 114 | Auth::logout(); 115 | 116 | return Redirect::route('dashboard'); 117 | } 118 | } -------------------------------------------------------------------------------- /app/commands/InstallCommand.php: -------------------------------------------------------------------------------- 1 | env = new Environment(); 34 | } 35 | 36 | /** 37 | * Execute the console command. 38 | * 39 | * @return mixed 40 | */ 41 | public function fire() 42 | { 43 | $configFile = $this->env->configFileName(); 44 | 45 | if (! File::exists($configFile)) 46 | { 47 | $this->error("\nNo database configuration found.\nPlease create a $configFile file in your root directory with your database details.\n-> Alternativly run the `php artisan ssms:dbconfig` helper command."); 48 | } 49 | else 50 | { 51 | $this->line("\nRunning installer script on " . App::environment() . " environment... \n"); 52 | 53 | if ($this->confirm("This installer will attempt to create a config file, create & seed database tables. Do you wish to continue? [yes|no]: ")) 54 | { 55 | if (Schema::hasTable('migrations')) 56 | { 57 | if (! $this->confirm("Previous migrations detected. This installer will reset all tables and settings, are you sure you want to continue? [yes|no] :")) 58 | { 59 | $this->abort(); 60 | } 61 | } 62 | 63 | try 64 | { 65 | if (! Schema::hasTable('migrations')) 66 | { 67 | $this->call("migrate:install"); 68 | } 69 | 70 | $this->call("migrate:reset"); 71 | $this->call("migrate"); 72 | $this->call("db:seed"); 73 | $this->info("Installer complete!"); 74 | } 75 | catch (Exception $e) 76 | { 77 | $this->error("\nAn error occured during database migrations (code " . $e->getCode() . "): \n " . $e->getMessage()); 78 | $this->info("\nCheck your $configFile database credentials!"); 79 | $this->abort(); 80 | } 81 | } 82 | else 83 | { 84 | $this->abort(); 85 | } 86 | } 87 | } 88 | 89 | /** 90 | * Get the console command arguments. 91 | * 92 | * @return array 93 | */ 94 | protected function getArguments() 95 | { 96 | return []; 97 | } 98 | 99 | /** 100 | * Get the console command options. 101 | * 102 | * @return array 103 | */ 104 | protected function getOptions() 105 | { 106 | return []; 107 | } 108 | 109 | /** 110 | * Abort message 111 | * 112 | */ 113 | protected function abort() 114 | { 115 | return $this->error("\n*** Installer aborted!. ***") . die(); 116 | } 117 | } -------------------------------------------------------------------------------- /app/database/seeds/GameTypesTableSeeder.php: -------------------------------------------------------------------------------- 1 | 440, 9 | 'hldsid' => 'tf', 10 | 'gamename' => 'Team Fortress 2', 11 | 'version' => '2316884', 12 | 'icon' => 'e3f595a92552da3d664ad00277fad2107345f743.jpg', 13 | 'logo' => '07385eb55b5ba974aebbe74d3c99626bda7920b8.jpg', 14 | ]); 15 | 16 | GameType::create([ 17 | 'client_appid' => 500, 18 | 'hldsid' => 'left4dead', 19 | 'gamename' => 'Left 4 Dead', 20 | 'version' => '1.0.2.8', 21 | 'icon' => '428df26bc35b09319e31b1ffb712487b20b3245c.jpg', 22 | 'logo' => '0f67ee504d8f04ecd83986dd7855821dc21f7a78.jpg', 23 | ]); 24 | 25 | GameType::create([ 26 | 'client_appid' => 550, 27 | 'hldsid' => 'left4dead2', 28 | 'gamename' => 'Left 4 Dead 2', 29 | 'version' => '2.1.3.6', 30 | 'icon' => '7d5a243f9500d2f8467312822f8af2a2928777ed.jpg', 31 | 'logo' => '205863cc21e751a576d6fff851984b3170684142.jpg', 32 | ]); 33 | 34 | GameType::create([ 35 | 'client_appid' => 300, 36 | 'hldsid' => 'dod', 37 | 'gamename' => 'Day of Defeat: Source', 38 | 'version' => '1.0.0.30', 39 | 'icon' => '062754bb5853b0534283ae27dc5d58200692b22d.jpg', 40 | 'logo' => 'e3a4313690bd551495a88e1c01951eb26cec7611.jpg', 41 | ]); 42 | 43 | GameType::create([ 44 | 'client_appid' => 17710, 45 | 'hldsid' => 'nucleardawn', 46 | 'gamename' => 'Nuclear Dawn', 47 | 'version' => '13.02.13', 48 | 'icon' => '77c685357c1fb6b0127bce460b4c4ad40ee5ee33.jpg', 49 | 'logo' => '05786499d3c7b3ed842936f29bbc3b753664936d.jpg', 50 | ]); 51 | 52 | GameType::create([ 53 | 'client_appid' => 240, 54 | 'hldsid' => 'cstrike', 55 | 'gamename' => 'Counter-Strike: Source', 56 | 'version' => '2230303', 57 | 'icon' => '9052fa60c496a1c03383b27687ec50f4bf0f0e10.jpg', 58 | 'logo' => 'ee97d0dbf3e5d5d59e69dc20b98ed9dc8cad5283.jpg', 59 | ]); 60 | 61 | GameType::create([ 62 | 'client_appid' => 730, 63 | 'hldsid' => 'csgo', 64 | 'gamename' => 'Counter-Strike: Global Offensive', 65 | 'version' => '1.34.1.1', 66 | 'icon' => '69f7ebe2735c366c65c0b33dae00e12dc40edbe4.jpg', 67 | 'logo' => 'd0595ff02f5c79fd19b06f4d6165c3fda2372820.jpg', 68 | ]); 69 | 70 | GameType::create([ 71 | 'client_appid' => 265630, 72 | 'hldsid' => 'fof', 73 | 'gamename' => 'Fistful of Frags', 74 | 'version' => '', 75 | 'icon' => 'e70c19e10125ea3f221666327af2b90f3fcecad9.jpg', 76 | 'logo' => '45ba88467785ebd77384e4b386abac1bfdad785b.jpg', 77 | ]); 78 | } 79 | 80 | } -------------------------------------------------------------------------------- /app/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | File Cache Location 23 | |-------------------------------------------------------------------------- 24 | | 25 | | When using the "file" cache driver, we need a location where the cache 26 | | files may be stored. A sensible default has been specified, but you 27 | | are free to change it to any other place on disk that you desire. 28 | | 29 | */ 30 | 31 | 'path' => storage_path().'/cache', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Database Cache Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When using the "database" cache driver you may specify the connection 39 | | that should be used to store the cached items. When this option is 40 | | null the default database connection will be utilized for cache. 41 | | 42 | */ 43 | 44 | 'connection' => null, 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Database Cache Table 49 | |-------------------------------------------------------------------------- 50 | | 51 | | When using the "database" cache driver we need to know the table that 52 | | should be used to store the cached items. A default table name has 53 | | been provided but you're free to change it however you deem fit. 54 | | 55 | */ 56 | 57 | 'table' => 'cache', 58 | 59 | /* 60 | |-------------------------------------------------------------------------- 61 | | Memcached Servers 62 | |-------------------------------------------------------------------------- 63 | | 64 | | Now you may specify an array of your Memcached servers that should be 65 | | used when utilizing the Memcached cache driver. All of the servers 66 | | should contain a value for "host", "port", and "weight" options. 67 | | 68 | */ 69 | 70 | 'memcached' => array( 71 | 72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 73 | 74 | ), 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Cache Key Prefix 79 | |-------------------------------------------------------------------------- 80 | | 81 | | When utilizing a RAM based store such as APC or Memcached, there might 82 | | be other applications utilizing the same cache. So, we'll specify a 83 | | value to get prefixed to all our keys so we can avoid collisions. 84 | | 85 | */ 86 | 87 | 'prefix' => 'laravel', 88 | 89 | ); 90 | -------------------------------------------------------------------------------- /app/database/seeds/PagesTableSeeder.php: -------------------------------------------------------------------------------- 1 | roles()->attach($role['id']); 10 | } 11 | 12 | return; 13 | } 14 | 15 | public function run() 16 | { 17 | /** 18 | * Dashboard 19 | * 20 | */ 21 | 22 | $page = Page::create([ 23 | 'name' => 'dashboard', 24 | 'friendly_name' => 'Dashboard', 25 | 'icon' => 'fa fa-tachometer', 26 | 'slug' => 'dashboard', 27 | ]); 28 | 29 | $this->attach($page, Role::all()); 30 | 31 | /** 32 | * Servers 33 | * 34 | */ 35 | 36 | $page = Page::create([ 37 | 'name' => 'servers', 38 | 'friendly_name' => 'Servers', 39 | 'icon' => 'fa fa-tasks', 40 | 'slug' => 'servers', 41 | ]); 42 | 43 | $this->attach($page, Role::all()); 44 | 45 | /** 46 | * Active Plugins 47 | * 48 | */ 49 | 50 | $page = Page::create([ 51 | 'name' => 'active_plugins', 52 | 'friendly_name' => 'Active Plugins', 53 | 'icon' => 'fa fa-sitemap', 54 | 'slug' => 'active-plugins', 55 | ]); 56 | 57 | $this->attach($page, Role::where('name', '!=', 'guest')->get()); 58 | 59 | /** 60 | * Multi Console 61 | * 62 | */ 63 | 64 | $page = Page::create([ 65 | 'name' => 'multi_console', 66 | 'friendly_name' => 'Multi-Console', 67 | 'icon' => 'fa fa-terminal', 68 | 'slug' => 'multi-console', 69 | ]); 70 | 71 | $this->attach($page, Role::where('name', 'super_admin')->get()); 72 | 73 | /** 74 | * Admin Activity 75 | * 76 | */ 77 | 78 | $page = Page::create([ 79 | 'name' => 'admin_activity', 80 | 'friendly_name' => 'Admin Activity', 81 | 'icon' => 'fa fa-comments', 82 | 'slug' => 'admin-activity', 83 | ]); 84 | 85 | $this->attach($page, Role::where('name', 'super_admin')->orWhere('name', 'admin')->get()); 86 | 87 | /** 88 | * Game Types 89 | * 90 | */ 91 | 92 | $page = Page::create([ 93 | 'name' => 'game_types', 94 | 'friendly_name' => 'Game Types', 95 | 'icon' => 'fa fa-gamepad', 96 | 'slug' => 'game-types', 97 | ]); 98 | 99 | $this->attach($page, Role::all()); 100 | 101 | /** 102 | * Settings 103 | * 104 | */ 105 | 106 | $page = Page::create([ 107 | 'name' => 'settings', 108 | 'friendly_name' => 'Settings', 109 | 'icon' => 'fa fa-cogs', 110 | 'slug' => 'settings', 111 | ]); 112 | 113 | $this->attach($page, Role::where('name', 'super_admin')->get()); 114 | } 115 | 116 | } -------------------------------------------------------------------------------- /app/database/seeds/NotificationsTableSeeder.php: -------------------------------------------------------------------------------- 1 | 'retries', 9 | 'friendly_name' => 'Server Retry Threshold', 10 | 'value' => '5', 11 | 'options' => null, 12 | 'description' => 'After this many minutes of not being able to connect to a server, issue a notification', 13 | ]); 14 | 15 | Notification::create([ 16 | 'name' => 'email.enabled', 17 | 'friendly_name' => 'E-Mail Notifications Enabled', 18 | 'value' => 'false', 19 | 'options' => 'true|false', 20 | 'description' => 'Whether or not E-Mail notifications are enabled', 21 | ]); 22 | 23 | Notification::create([ 24 | 'name' => 'email.addresses', 25 | 'friendly_name' => 'E-Mail Addresses', 26 | 'value' => '', 27 | 'options' => null, 28 | 'description' => 'The email addresses that notifcations are sent to, seperated by a semi-colon (;)', 29 | 'in_overview' => 0, 30 | ]); 31 | 32 | Notification::create([ 33 | 'name' => 'twitter.enabled', 34 | 'friendly_name' => 'Twitter Notifications Enabled', 35 | 'value' => 'false', 36 | 'options' => 'true|false', 37 | 'description' => 'Whether or not Twitter notifications are enabled', 38 | ]); 39 | 40 | Notification::create([ 41 | 'name' => 'twitter.key', 42 | 'friendly_name' => 'Twitter Consumer Key', 43 | 'value' => '', 44 | 'options' => null, 45 | 'description' => 'Your twitter account consumer key found on https://apps.twitter.com', 46 | 'in_overview' => 0, 47 | ]); 48 | 49 | Notification::create([ 50 | 'name' => 'hipchat.enabled', 51 | 'friendly_name' => 'HipChat Notifications Enabled', 52 | 'value' => 'false', 53 | 'options' => 'true|false', 54 | 'description' => 'Whether or not HipChat notifications are enabled', 55 | ]); 56 | 57 | Notification::create([ 58 | 'name' => 'hipchat.room', 59 | 'friendly_name' => 'HipChat Room ID', 60 | 'value' => '', 61 | 'options' => null, 62 | 'description' => 'HipChat room ID to send notifications to', 63 | 'in_overview' => 0, 64 | ]); 65 | 66 | Notification::create([ 67 | 'name' => 'hipchat.auth', 68 | 'friendly_name' => 'HipChat Room Auth Token', 69 | 'value' => '', 70 | 'options' => null, 71 | 'description' => 'The HipChat rooms auth token', 72 | 'in_overview' => 0, 73 | ]); 74 | 75 | Notification::create([ 76 | 'name' => 'pushbullet.enabled', 77 | 'friendly_name' => 'PushBullet Notifications Enabled', 78 | 'value' => 'false', 79 | 'options' => 'true|false', 80 | 'description' => 'Whether or not PushBullet notifications are enabled', 81 | ]); 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /app/controllers/SettingController.php: -------------------------------------------------------------------------------- 1 | users = $users; 45 | $this->permissions = $permissions; 46 | $this->pages = $pages; 47 | $this->options = $options; 48 | $this->quicklinks = $quicklinks; 49 | $this->notifications = $notifications; 50 | } 51 | 52 | /** 53 | * Return the master settings overview with data 54 | * 55 | * @return View 56 | */ 57 | public function getView() 58 | { 59 | return View::make('pages.settings') 60 | ->with('users', $this->users->getWithRoles()) 61 | ->with('options', $this->options->getAll()) 62 | ->with('pages', $this->pages->getWithRoles()) 63 | ->with('permissions', $this->permissions->getWithRolesPage()) 64 | ->with('quick_links', $this->quicklinks->getAll()) 65 | ->with('notifications', $this->notifications->getAll()); 66 | } 67 | 68 | /** 69 | * Return the users settings view 70 | * 71 | * @return View 72 | */ 73 | public function getUsersView() 74 | { 75 | return View::make('pages.settings.users'); 76 | } 77 | 78 | /** 79 | * Return the options settings view 80 | * 81 | * @return View 82 | */ 83 | public function getOptionsView() 84 | { 85 | return View::make('pages.settings.options'); 86 | } 87 | 88 | /** 89 | * Return the page-access settings view 90 | * 91 | * @return View 92 | */ 93 | public function getPageManagementView() 94 | { 95 | return View::make('pages.settings.page-management'); 96 | } 97 | 98 | /** 99 | * Return the permission-control settings view 100 | * 101 | * @return View 102 | */ 103 | public function getPermissionControlView() 104 | { 105 | return View::make('pages.settings.permission-control'); 106 | } 107 | 108 | /** 109 | * Return the quick-links settings view 110 | * 111 | * @return View 112 | */ 113 | public function getQuickLinksView() 114 | { 115 | return View::make('pages.settings.quick-links'); 116 | } 117 | 118 | /** 119 | * Return the notifications settings view 120 | * 121 | * @return View 122 | */ 123 | public function getNotificationsView() 124 | { 125 | return View::make('pages.settings.notifications'); 126 | } 127 | } -------------------------------------------------------------------------------- /app/views/templates/secure/settings.users.add.php: -------------------------------------------------------------------------------- 1 | 6 | 62 | -------------------------------------------------------------------------------- /app/views/pages/settings/permission-control.blade.php: -------------------------------------------------------------------------------- 1 | @extends('master') 2 | 3 | @section('page_title') 4 | Permission Control 5 | @stop 6 | 7 | @section('page_breadcrumb') 8 | [[ HTML::link('/', 'SSMS') ]] / [[ HTML::link(URL::route('settings'), 'Settings') ]] / [[ HTML::link(URL::route('settings.permission-control'), 'Permission Control') ]] 9 | @stop 10 | 11 | @section('assets') 12 | @parent 13 | [[ HTML::script('js/angular/controllers/settings/SettingsPermissionControlCtrl.js') ]] 14 | @stop 15 | 16 | @section('content') 17 |
18 |
19 |
20 |
21 |
22 | Manage Permissions 23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 58 | 61 | 72 | 73 | 74 |
NameDescriptionPageRoles
51 | 52 | 53 | 54 | 55 | 56 | 57 | 59 | 60 | 62 | 65 | 68 | 71 |
75 |
76 |
77 |
78 |
79 |
80 |
81 | @stop -------------------------------------------------------------------------------- /app/models/Server.php: -------------------------------------------------------------------------------- 1 | attributes['rcon_password'] = \Crypt::encrypt($value); 44 | } 45 | 46 | /** 47 | * Automatically decrypts the rcon_password field when called. 48 | * 49 | */ 50 | public function getRconPasswordAttribute($value) 51 | { 52 | return \Crypt::decrypt($value); 53 | } 54 | 55 | /** 56 | * One-Many relationship with the game_types table 57 | * 58 | */ 59 | public function gametype() 60 | { 61 | return $this->belongsTo('GameType', 'client_appid', 'client_appid'); 62 | } 63 | 64 | public function flags() 65 | { 66 | return $this->belongsToMany('Flag', 'flag_server')->orderBy('flag_id'); 67 | } 68 | 69 | /** 70 | * Refreshes a servers details with a given SourceServer 71 | * object method. 72 | * 73 | */ 74 | public function refresh($info) 75 | { 76 | $this->name = $info['serverName']; 77 | $this->tags = $info['serverTags']; 78 | $this->tags = $info['serverTags']; 79 | $this->operating_system = $info['operatingSystem']; 80 | $this->version = $info['gameVersion']; 81 | $this->network = $info['networkVersion']; 82 | $this->current_map = $info['mapName']; 83 | $this->current_players = $info['numberOfPlayers']; 84 | $this->current_bots = $info['botNumber']; 85 | $this->max_players = $info['maxPlayers']; 86 | $this->retries = 0; 87 | $this->touch(); 88 | $this->save(); 89 | 90 | return; 91 | } 92 | 93 | /** 94 | * Adds a try value to the server 95 | * 96 | */ 97 | public function addRetry($number = 1) 98 | { 99 | $this->retries = $this->retries + $number; 100 | $this->save(); 101 | 102 | return; 103 | } 104 | 105 | /** 106 | * Reset the server retry count 107 | * 108 | */ 109 | public function resetRetry() 110 | { 111 | $this->retries = 0; 112 | $this->save(); 113 | 114 | return; 115 | } 116 | 117 | /** 118 | * Sets flags on a server, if they don't already exist 119 | * 120 | */ 121 | public function setFlags($flags) 122 | { 123 | foreach ($flags as $flag) 124 | { 125 | if (! $this->flags->contains($flag)) 126 | { 127 | $this->flags()->attach($flag); 128 | } 129 | } 130 | 131 | return; 132 | } 133 | 134 | /** 135 | * Remove flags on a server, only if they exist 136 | * 137 | */ 138 | public function removeFlags($flags) 139 | { 140 | foreach ($flags as $flag) 141 | { 142 | if ($this->flags->contains($flag)) 143 | { 144 | $this->flags()->detach($flag); 145 | } 146 | } 147 | 148 | return; 149 | } 150 | 151 | /** 152 | * Resets the flags on the server, and assigns it the "all ok" flag 153 | * 154 | */ 155 | public function resetFlags() 156 | { 157 | $this->flags()->detach(); 158 | 159 | $this->flags()->attach(1); 160 | 161 | return; 162 | } 163 | } -------------------------------------------------------------------------------- /app/views/pages/dashboard.blade.php: -------------------------------------------------------------------------------- 1 | @extends('master') 2 | 3 | @section('page_title') 4 | Dashboard 5 | @stop 6 | 7 | @section('page_breadcrumb') 8 | [[ HTML::link('/', 'SSMS') ]] / [[ HTML::link(URL::route('dashboard'), 'Dashboard') ]] 9 | @stop 10 | 11 | @section('content') 12 |
13 |
14 |
15 |
16 |
17 | 18 |
19 |
20 |
[[ $stats['users'] ]]
21 |
SSMS User(s)
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 | 32 |
33 |
34 |
[[ $stats['servers'] ]]
35 |
Servers
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | 46 |
47 |
48 |
[[ $stats['active_plugins'] ]]
49 |
Active Plugins
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | 61 |
62 |
63 |
[[ $stats['game_types'] ]]
64 |
Game Types
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
Game Servers
75 |
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 |
Server Name0/32
Server Name0/32
Server Name0/32
Server Name0/32
93 |
94 |
95 |
96 |
97 |
98 |
Game Servers
99 |
Body
100 |
101 |
102 |
103 | @stop -------------------------------------------------------------------------------- /app/views/pages/settings/page-management.blade.php: -------------------------------------------------------------------------------- 1 | @extends('master') 2 | 3 | @section('page_title') 4 | Page Management 5 | @stop 6 | 7 | @section('page_breadcrumb') 8 | [[ HTML::link('/', 'SSMS') ]] / [[ HTML::link(URL::route('settings'), 'Settings') ]] / [[ HTML::link(URL::route('settings.page-management'), 'Page Management') ]] 9 | @stop 10 | 11 | @section('assets') 12 | @parent 13 | [[ HTML::script('js/angular/controllers/settings/SettingsPageManagementCtrl.js') ]] 14 | @stop 15 | 16 | @section('content') 17 |
18 |
19 |
20 |
21 |
22 | Page Management 23 | 24 |
25 |
26 |
27 | 28 | 29 | 30 |
31 | 32 |
33 | 34 |
35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 52 | 53 | 61 | 64 | 75 | 76 | 77 |
NameIcon (Font Awesome)SlugRole Access
50 | 51 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 62 | 63 | 65 | 68 | 71 | 74 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | @stop -------------------------------------------------------------------------------- /app/models/User.php: -------------------------------------------------------------------------------- 1 | belongsToMany('Role', 'role_user')->orderBy('id', 'asc')->withTimestamps(); 48 | } 49 | 50 | /** 51 | * Return value based on whether the current user has a role. 52 | * 53 | * @var bool 54 | */ 55 | public function hasRole($name) 56 | { 57 | foreach ($this->roles as $role) 58 | { 59 | if($role->name == $name) return true; 60 | } 61 | 62 | return false; 63 | } 64 | 65 | /** 66 | * The 'pages' accessor 67 | * 68 | */ 69 | public function getPagesAttribute() 70 | { 71 | if ( ! array_key_exists('pages', $this->relations)) $this->loadPages(); 72 | 73 | return $this->getRelation('pages'); 74 | } 75 | 76 | /** 77 | * Load pages user is allowed to access and set the collection as 'pages' relation 78 | * 79 | */ 80 | protected function loadPages() 81 | { 82 | $pages = Page::join('page_role as pr', 'pr.page_id', '=', 'pages.id') 83 | ->join('role_user as ru', 'ru.role_id', '=', 'pr.role_id') 84 | ->where('ru.user_id', $this->id) 85 | ->distinct() 86 | ->get(['pages.*', 'user_id']); 87 | 88 | $hasMany = new Illuminate\Database\Eloquent\Relations\HasMany(Page::query(), $this, 'user_id', 'id'); 89 | 90 | $hasMany->matchMany([$this], $pages, 'pages'); 91 | 92 | // If there is no collection to set the relation on, create a blank one 93 | if (! isset($this->pages)) $this->setRelation('pages', new Collection()); 94 | 95 | return $this; 96 | } 97 | 98 | 99 | /** 100 | * The 'permissions' accessor 101 | * 102 | */ 103 | public function getPermissionsAttribute() 104 | { 105 | if ( ! array_key_exists('permissions', $this->relations)) $this->loadPermissions(); 106 | 107 | return $this->getRelation('permissions'); 108 | } 109 | 110 | /** 111 | * Load pages user is allowed to access and set the collection as 'pages' relation 112 | * 113 | */ 114 | protected function loadPermissions() 115 | { 116 | $permissions = Permission::join('permission_role as pr', 'pr.permission_id', '=', 'permissions.id') 117 | ->join('role_user as ru', 'ru.role_id', '=', 'pr.role_id') 118 | ->where('ru.user_id', $this->id) 119 | ->distinct() 120 | ->get(['permissions.*', 'user_id']); 121 | 122 | $hasMany = new HasMany(Permission::query(), $this, 'user_id', 'id'); 123 | 124 | $hasMany->matchMany([$this], $permissions, 'permissions'); 125 | 126 | // If there is no collection to set the relation on, create a blank one 127 | if (! isset($this->permissions)) $this->setRelation('permissions', new Collection()); 128 | 129 | return $this; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /app/start/global.php: -------------------------------------------------------------------------------- 1 | quicklinks = $quicklinks; 15 | } 16 | 17 | /** 18 | * Get the quick links 19 | * 20 | * @return object 21 | */ 22 | public function get() 23 | { 24 | return $this->quicklinks->getAll(); 25 | } 26 | 27 | /** 28 | * Add a quick link 29 | * 30 | * @return json 31 | */ 32 | public function add() 33 | { 34 | $data = Input::all(); 35 | 36 | if ($this->isEmpty($data['name'])) return $this->jsonResponse(400, false, "The name value must be present!"); 37 | 38 | if ($this->isEmpty($data['url'])) return $this->jsonResponse(400, false, "The url value must be present!"); 39 | 40 | if ($this->isEmpty($data['icon'])) return $this->jsonResponse(400, false, "The icon value must be present!"); 41 | 42 | // If invalid URL 43 | if (! $this->isValidUrl($data['url'])) return $this->jsonResponse(400, false, "The URL must be valid, starting with 'http://' or 'https://'!"); 44 | 45 | // If invalid font awesome name 46 | if (! $this->isValidFontAwesome($data['icon'])) return $this->jsonResponse(400, false, "The icon name supplied is not a valid Font Awesome icon!"); 47 | 48 | try 49 | { 50 | $array = [ 51 | 'name' => $data['name'], 52 | 'url' => $data['url'], 53 | 'icon' => $data['icon'] 54 | ]; 55 | 56 | $add = $this->quicklinks->add($array); 57 | } 58 | catch (Exception $e) 59 | { 60 | return $this->jsonResponse(400, false, $e->getMessage()); 61 | } 62 | 63 | return $this->jsonResponse(200, true, 'Quick Link has successfully been added!', $add); 64 | } 65 | 66 | /** 67 | * Delete a quick link 68 | * 69 | * @return json 70 | */ 71 | public function delete() 72 | { 73 | $id = Input::all()[0]; 74 | 75 | try 76 | { 77 | $this->quicklinks->delete($id); 78 | } 79 | catch (Exception $e) 80 | { 81 | return $this->jsonResponse(400, false, $e->getMessage()); 82 | } 83 | 84 | return $this->jsonResponse(200, true, 'Quick Link has successfully been deleted!'); 85 | } 86 | 87 | /** 88 | * Edit a quick link 89 | * 90 | * @return json 91 | */ 92 | public function edit() 93 | { 94 | $data = Input::all(); 95 | 96 | if ($this->isEmpty($data['edit']['name'])) return $this->jsonResponse(400, false, "The name value must be present!"); 97 | 98 | if ($this->isEmpty($data['edit']['url'])) return $this->jsonResponse(400, false, "The url value must be present!"); 99 | 100 | if ($this->isEmpty($data['edit']['icon'])) return $this->jsonResponse(400, false, "The icon value must be present!"); 101 | 102 | // If invalid font awesome name 103 | if (! $this->isValidFontAwesome($data['edit']['icon'])) return $this->jsonResponse(400, false, "The icon name supplied is not a valid Font Awesome icon!"); 104 | 105 | // If invalid URL 106 | if (! $this->isValidUrl($data['edit']['url'])) return $this->jsonResponse(400, false, "The URL must be valid, starting with 'http://' or 'https://'!"); 107 | 108 | try 109 | { 110 | $edit = [ 111 | 'name' => $data['edit']['name'], 112 | 'url' => $data['edit']['url'], 113 | 'icon' => $data['edit']['icon'], 114 | ]; 115 | 116 | $update = $this->quicklinks->edit($data['id'], $edit); 117 | } 118 | catch (Exception $e) 119 | { 120 | return $this->jsonResponse(400, false, $e->getMessage()); 121 | } 122 | 123 | return $this->jsonResponse(200, true, 'Quick Link updated successfully!', $update); 124 | } 125 | 126 | } -------------------------------------------------------------------------------- /app/commands/ConfigFileCommand.php: -------------------------------------------------------------------------------- 1 | env = new Environment(); 34 | } 35 | 36 | /** 37 | * Execute the console command. 38 | * 39 | * @return mixed 40 | */ 41 | public function fire() 42 | { 43 | $this->info("Checking for existing config file..."); 44 | 45 | $fileName = $this->env->configFileName(); 46 | 47 | if (File::exists($fileName)) 48 | { 49 | $this->error("File $fileName already exists - please delete it!"); 50 | $this->abort(); 51 | } 52 | else 53 | { 54 | $this->error("No config file exists! Enter database details to create your file:"); 55 | 56 | $type = $this->ask("What database driver type are you using? [mysql|sqlite|pgsql|sqlsrv]: "); 57 | 58 | $file = null; 59 | $host = ''; 60 | $name = ''; 61 | $user = ''; 62 | $pass = ''; 63 | 64 | if($type == 'sqlite') 65 | { 66 | $file = $this->ask('Where is your sqlite database file located (from base root)? Leave blank for the default app/database/production.sqlite file: '); 67 | $file == '' ? $file = null : $file = $file; 68 | } 69 | elseif($type == 'mysql' || $type == 'pgsql' || $type == 'sqlsrv') 70 | { 71 | $host = $this->ask('Your database hostname:'); 72 | $name = $this->ask('Your database name:'); 73 | $user = $this->ask('Your database user:'); 74 | $pass = $this->secret('Your database user password:'); 75 | } 76 | else 77 | { 78 | $this->error("Invalid database driver type."); 79 | $this->abort(); 80 | } 81 | 82 | try 83 | { 84 | File::put($fileName, $this->getTemplate($type, $host, $name, $user, $pass, $file)); 85 | $this->info("Config file $fileName successfully created!"); 86 | } 87 | catch (Exception $e) 88 | { 89 | $this->error("An error occured creating the file: " . $e->getMessage()); 90 | } 91 | } 92 | } 93 | 94 | /** 95 | * Get the console command arguments. 96 | * 97 | * @return array 98 | */ 99 | protected function getArguments() 100 | { 101 | return []; 102 | } 103 | 104 | /** 105 | * Get the console command options. 106 | * 107 | * @return array 108 | */ 109 | protected function getOptions() 110 | { 111 | return []; 112 | } 113 | 114 | /** 115 | * Abort message 116 | * 117 | */ 118 | protected function abort() 119 | { 120 | return $this->error("\n*** Aborted!. ***") . die(); 121 | } 122 | 123 | /** 124 | * Returns a string template to create the config file with 125 | * 126 | * @return array 127 | */ 128 | protected function getTemplate($type, $host, $name, $user, $pass, $file) 129 | { 130 | $randKey = Str::random(32); 131 | 132 | $template = 133 | " '$randKey', 136 | 'database_type' => '$type', 137 | 'database_host' => '$host', 138 | 'database_name' => '$name', 139 | 'database_user' => '$user', 140 | 'database_password' => '$pass',"; 141 | 142 | ! is_null($file) ? $template .= "\n'database.file' => '$file',\n" : ''; 143 | 144 | $template .= "\n);"; 145 | 146 | return $template; 147 | } 148 | } -------------------------------------------------------------------------------- /app/Ssms/Steam/Server.php: -------------------------------------------------------------------------------- 1 | server = new SourceServer($ip, $port); 32 | $this->initializeServer($this->server); 33 | 34 | $this->setRcon($rcon); 35 | } 36 | 37 | /** 38 | * Initalize the server details 39 | * Turn off user notices from SteamCondenser 40 | * 41 | */ 42 | private function initializeServer($s) 43 | { 44 | error_reporting(E_ALL ^ E_USER_NOTICE); 45 | $s->initialize(); 46 | } 47 | 48 | /** 49 | * Sets the RCON password for the server instance, if 50 | * not set during construction 51 | * 52 | */ 53 | public function setRcon($string) 54 | { 55 | $this->rcon = $string; 56 | 57 | return $this; 58 | } 59 | 60 | /** 61 | * Return the server instance information 62 | * 63 | */ 64 | public function info() 65 | { 66 | return $this->server->getServerInfo(); 67 | } 68 | 69 | /** 70 | * Return the server instance current players information 71 | * 72 | */ 73 | public function players() 74 | { 75 | $res = []; 76 | 77 | $players = $this->server->getPlayers($this->rcon); 78 | 79 | $count = 0; 80 | 81 | foreach ($players as $key => $player) 82 | { 83 | if ($player->getSteamId() == 'BOT') 84 | $res[$count]['community_id'] = 'BOT'; 85 | elseif ($player->getSteamId() == null) 86 | $res[$count]['community_id'] = 'ERR'; 87 | else 88 | $res[$count]['community_id'] = SteamId::convertSteamIdToCommunityId($player->getSteamId()); 89 | 90 | $res[$count]['steam_id'] = $player->getSteamId() == null ? 'Steam ID unavailable!' : $player->getSteamId(); 91 | $res[$count]['name'] = $player->getName() == '' ? false : $player->getName(); 92 | $res[$count]['score'] = $player->getScore(); 93 | $res[$count]['ping'] = $player->getPing(); 94 | $res[$count]['connection_time'] = with(new SecToHrMinSec($player->getConnectTime()))->convert(); 95 | $res[$count]['state'] = $player->getState(); 96 | $res[$count]['ip_address'] = $player->getIpAddress(); 97 | 98 | $count++; 99 | } 100 | 101 | return json_encode($res); 102 | } 103 | 104 | /** 105 | * Return the server instance ping 106 | * 107 | */ 108 | public function ping() 109 | { 110 | return $this->server->getPing(); 111 | } 112 | 113 | /** 114 | * Validate an RCON password with the server instance 115 | * 116 | * @throws Exception if the rcon password is incorrect 117 | * 118 | */ 119 | public function validateRconPass($rcon) 120 | { 121 | $this->server->updatePlayers($rcon); 122 | } 123 | 124 | /** 125 | * Executes an RCON command on the server instance. 126 | * 127 | * @throws RCONNoAuthException if the rcon command cannot be executed 128 | * 129 | */ 130 | public function rconCommand($command) 131 | { 132 | $this->server->rconAuth($this->rcon); 133 | 134 | return $this->server->rconExec($command); 135 | } 136 | } -------------------------------------------------------------------------------- /app/views/pages/servers.blade.php: -------------------------------------------------------------------------------- 1 | @extends('master') 2 | 3 | @section('page_title') 4 | Servers 5 | @stop 6 | 7 | @section('page_breadcrumb') 8 | [[ HTML::link('/', 'SSMS') ]] / [[ HTML::link(URL::route('servers'), 'Servers') ]] 9 | @stop 10 | 11 | @section('assets') 12 | @parent 13 | [[ HTML::script('js/angular/controllers/servers/ServersCtrl.js') ]] 14 | @stop 15 | 16 | @section('content') 17 |
18 |
19 |
20 |
21 | @if(Permissions::validate('servers.add')) 22 | 23 | @endif 24 | @if(Permissions::validate('servers.refresh')) 25 | 26 | 27 | @endif 28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Servers 36 | 37 |
38 |
39 |
40 | 41 | 42 | 43 |
44 | 45 |
46 | 47 |
48 | There are no servers in the application! 49 |
50 | 51 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 87 | 88 | 89 |
IDNameCurrent MapPlayersLast Updated
{{ server.current_players }}-{{ server.current_bots }} / {{ server.max_players }}{{ server.updated_at }} 75 | @if(Permissions::validate('servers.edit')) 76 | @endif 77 | @if(Permissions::validate('servers.restart')) 78 | @endif 79 | @if(Permissions::validate('servers.delete')) 80 | 83 | @endif 84 | @if(Permissions::validate('servers.refresh')) 85 | @endif 86 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
Total Servers: {{ servers.length }}
99 |
100 |
101 |
102 |
103 | @stop -------------------------------------------------------------------------------- /app/filters.php: -------------------------------------------------------------------------------- 1 | name] = $option->value; 48 | 49 | View::share('siteOptions', $o); 50 | 51 | /** 52 | * Attach a PHP array to the window to allow JavaScript to use. 53 | * The "URL" provider is used rather than the Laravel helper paths 54 | * to ensure the paths are consistent across Windows and Unix platforms. 55 | * 56 | * @see https://github.com/laracasts/PHP-Vars-To-Js-Transformer 57 | */ 58 | 59 | JavaScript::put([ 60 | 'app_path' => URL::to('/') . '/', 61 | 'roles' => Role::get(['id', 'friendly_name']), 62 | 'services' => Service::get(['id', 'friendly_name']), 63 | ]); 64 | 65 | }); 66 | 67 | 68 | App::after(function($request, $response) 69 | { 70 | // 71 | }); 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Access Filter 76 | |-------------------------------------------------------------------------- 77 | | 78 | */ 79 | 80 | Route::filter('access', function() 81 | { 82 | if(! Access::validate(Request::segment(1))) return App::abort(403, 'You do not have the required access for this page'); 83 | }); 84 | 85 | /* 86 | |-------------------------------------------------------------------------- 87 | | Permissions Filter 88 | |-------------------------------------------------------------------------- 89 | | 90 | */ 91 | 92 | Route::filter('permissions', function($route, $request, $value) 93 | { 94 | if(! Permissions::validate($value)) return App::abort(403, 'Insufficient permissions'); 95 | }); 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Ajax Filter 100 | |-------------------------------------------------------------------------- 101 | | 102 | */ 103 | 104 | Route::filter('ajax', function() 105 | { 106 | if (! Request::ajax()) return App::abort(406, 'The request to this resource must be via Ajax'); 107 | }); 108 | 109 | 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Auth Filters 114 | |-------------------------------------------------------------------------- 115 | | 116 | */ 117 | 118 | Route::filter('auth', function() 119 | { 120 | if (! Auth::check()) return App::abort(401, 'Authentication required'); 121 | }); 122 | 123 | Route::filter('guest', function() 124 | { 125 | if (Auth::check()) return Redirect::to('/'); 126 | }); 127 | 128 | /* 129 | |-------------------------------------------------------------------------- 130 | | CSRF Protection Filter 131 | |-------------------------------------------------------------------------- 132 | | 133 | | The CSRF filter is responsible for protecting your application against 134 | | cross-site request forgery attacks. If this special token in a user 135 | | session does not match the one given in this request, we'll bail. 136 | | 137 | */ 138 | 139 | Route::filter('csrf', function() 140 | { 141 | if (Session::token() != Input::get('_token')) 142 | { 143 | throw new Illuminate\Session\TokenMismatchException; 144 | } 145 | }); 146 | -------------------------------------------------------------------------------- /app/commands/RefreshCommand.php: -------------------------------------------------------------------------------- 1 | servers = \App::make('Ssms\Repositories\Server\ServerRepository'); 36 | } 37 | 38 | /** 39 | * Execute the console command. 40 | * 41 | * @return mixed 42 | */ 43 | public function fire() 44 | { 45 | // Don't run if there are no servers 46 | if($this->servers->count() == 0) 47 | { 48 | $this->info('There are no servers to refresh!'); 49 | $this->abort(); 50 | } 51 | 52 | $this->info('Running server refrehes:'); 53 | 54 | // Get all the server infomtation 55 | $servers = $this->servers->getAll(['id', 'ip', 'port', 'rcon_password']); 56 | 57 | // Loop through the servers 58 | foreach ($servers as $server) 59 | { 60 | // Grab the server model 61 | $db = $this->servers->getFirst('id', $server['id']); 62 | 63 | // First, see if we're able to connect to the server 64 | // If not, add "1" onto the retries field via the model method. 65 | if (! $s = $this->canConnect($server['ip'], $server['port'])) 66 | { 67 | $db->addRetry(); 68 | $this->comment('{'. $server['id'] .'} Connection failed - Retry count added!'); 69 | } 70 | // Can connect, reset retries 71 | else 72 | { 73 | $db->resetRetry(); 74 | } 75 | 76 | // Next, validate the RCON password in the database 77 | // If it's invalid, set the RCON warning flag 78 | if (! $this->validRcon($s, $server['rcon_password'])) 79 | { 80 | $db->setFlags([4]); 81 | $this->comment('{'. $server['id'] .'} Incorrect RCON password detcted - Setting flag!'); 82 | } 83 | // Remove any RCON warning flags 84 | else 85 | { 86 | $db->removeFlags([4]); 87 | } 88 | 89 | // Try to perform the refresh with the server information via the model method 90 | try 91 | { 92 | $db->refresh($s->info()); 93 | } 94 | catch (Exception $e) 95 | { 96 | $this->comment('{'. $server['id'] .'} Refresh failed: ' . $e->getMessage()); 97 | break; 98 | } 99 | 100 | $this->info('{'. $server['id'] .'} Successfully refreshed!'); 101 | 102 | } 103 | 104 | $this->info("Refresh process complete!\n"); 105 | 106 | // Run the command "php artisan ssms:trigger" 107 | $this->call('ssms:trigger'); 108 | } 109 | 110 | /** 111 | * Get the console command arguments. 112 | * 113 | * @return array 114 | */ 115 | protected function getArguments() 116 | { 117 | return []; 118 | } 119 | 120 | /** 121 | * Get the console command options. 122 | * 123 | * @return array 124 | */ 125 | protected function getOptions() 126 | { 127 | return []; 128 | } 129 | 130 | /** 131 | * Abort message 132 | * 133 | */ 134 | protected function abort() 135 | { 136 | return $this->error("\n*** Aborted!. ***") . die(); 137 | } 138 | 139 | /** 140 | * Check whether SteamCondenser is able to connect to the server 141 | * 142 | */ 143 | protected function canConnect($ip, $port) 144 | { 145 | try 146 | { 147 | $server = new Server($ip, $port); 148 | } 149 | catch (Exception $e) 150 | { 151 | return false; 152 | } 153 | 154 | return $server; 155 | } 156 | 157 | /** 158 | * Validates the given RCON password 159 | * 160 | */ 161 | protected function validRcon($server, $password) 162 | { 163 | try 164 | { 165 | $server->validateRconPass($password); 166 | } 167 | catch (Exception $e) 168 | { 169 | return false; 170 | } 171 | 172 | return true; 173 | } 174 | } 175 | --------------------------------------------------------------------------------