diff --git a/app/Console/Commands/AddLocation.php b/app/Console/Commands/AddLocation.php index d9da92466..7d14cf0ee 100644 --- a/app/Console/Commands/AddLocation.php +++ b/app/Console/Commands/AddLocation.php @@ -31,12 +31,12 @@ class AddLocation extends Command { protected $data = []; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'pterodactyl:location + /** + * The name and signature of the console command. + * + * @var string + */ + protected $signature = 'pterodactyl:location {--short= : The shortcode name of this location (ex. us1).} {--long= : A longer description of this location.}'; diff --git a/app/Events/Auth/FailedCaptcha.php b/app/Events/Auth/FailedCaptcha.php index ba741cf6d..903117265 100644 --- a/app/Events/Auth/FailedCaptcha.php +++ b/app/Events/Auth/FailedCaptcha.php @@ -1,26 +1,26 @@ . -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -*/ + * Pterodactyl - Panel + * Copyright (c) 2015 - 2017 Dane Everitt . + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ namespace Pterodactyl\Events\Auth; diff --git a/app/Http/Controllers/Admin/VariableController.php b/app/Http/Controllers/Admin/VariableController.php index 3d2a4fa4c..4394b42fb 100644 --- a/app/Http/Controllers/Admin/VariableController.php +++ b/app/Http/Controllers/Admin/VariableController.php @@ -25,14 +25,14 @@ namespace Pterodactyl\Http\Controllers\Admin; use Prologue\Alerts\AlertsMessageBag; -use Pterodactyl\Http\Controllers\Controller; -use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface; -use Pterodactyl\Http\Requests\Admin\OptionVariableFormRequest; use Pterodactyl\Models\ServiceOption; use Pterodactyl\Models\ServiceVariable; +use Pterodactyl\Http\Controllers\Controller; +use Pterodactyl\Http\Requests\Admin\OptionVariableFormRequest; use Pterodactyl\Repositories\Eloquent\ServiceVariableRepository; -use Pterodactyl\Services\Services\Variables\VariableCreationService; use Pterodactyl\Services\Services\Variables\VariableUpdateService; +use Pterodactyl\Services\Services\Variables\VariableCreationService; +use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface; class VariableController extends Controller { diff --git a/app/Http/Controllers/Base/AccountController.php b/app/Http/Controllers/Base/AccountController.php index 7163045ae..7167a6f2a 100644 --- a/app/Http/Controllers/Base/AccountController.php +++ b/app/Http/Controllers/Base/AccountController.php @@ -67,15 +67,15 @@ class AccountController extends Controller $data['password'] = $request->input('new_password'); - // Request to update account Email + // Request to update account Email } elseif ($request->input('do_action') === 'email') { $data['email'] = $request->input('new_email'); - // Request to update account Identity + // Request to update account Identity } elseif ($request->input('do_action') === 'identity') { $data = $request->only(['name_first', 'name_last', 'username']); - // Unknown, hit em with a 404 + // Unknown, hit em with a 404 } else { return abort(404); } diff --git a/app/Models/ServerVariable.php b/app/Models/ServerVariable.php index 165d5b3df..fdff100ee 100644 --- a/app/Models/ServerVariable.php +++ b/app/Models/ServerVariable.php @@ -42,53 +42,53 @@ class ServerVariable extends Model */ protected $guarded = ['id', 'created_at', 'updated_at']; - /** - * Cast values to correct type. - * - * @var array - */ - protected $casts = [ + /** + * Cast values to correct type. + * + * @var array + */ + protected $casts = [ 'server_id' => 'integer', 'variable_id' => 'integer', ]; - /** - * Determine if variable is viewable by users. - * - * @return bool - */ - public function getUserCanViewAttribute() - { - return (bool) $this->variable->user_viewable; - } + /** + * Determine if variable is viewable by users. + * + * @return bool + */ + public function getUserCanViewAttribute() + { + return (bool) $this->variable->user_viewable; + } - /** - * Determine if variable is editable by users. - * - * @return bool - */ - public function getUserCanEditAttribute() - { - return (bool) $this->variable->user_editable; - } + /** + * Determine if variable is editable by users. + * + * @return bool + */ + public function getUserCanEditAttribute() + { + return (bool) $this->variable->user_editable; + } - /** - * Determine if variable is required. - * - * @return bool - */ - public function getRequiredAttribute() - { - return $this->variable->required; - } + /** + * Determine if variable is required. + * + * @return bool + */ + public function getRequiredAttribute() + { + return $this->variable->required; + } - /** - * Returns information about a given variables parent. - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ - public function variable() - { - return $this->belongsTo(ServiceVariable::class, 'variable_id'); - } + /** + * Returns information about a given variables parent. + * + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function variable() + { + return $this->belongsTo(ServiceVariable::class, 'variable_id'); + } } diff --git a/app/Providers/RepositoryServiceProvider.php b/app/Providers/RepositoryServiceProvider.php index 8a98e6626..0dd26a4bf 100644 --- a/app/Providers/RepositoryServiceProvider.php +++ b/app/Providers/RepositoryServiceProvider.php @@ -25,9 +25,7 @@ namespace Pterodactyl\Providers; use Illuminate\Support\ServiceProvider; -use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface; use Pterodactyl\Repositories\Eloquent\NodeRepository; -use Pterodactyl\Repositories\Eloquent\ServiceVariableRepository; use Pterodactyl\Repositories\Eloquent\UserRepository; use Pterodactyl\Repositories\Eloquent\ApiKeyRepository; use Pterodactyl\Repositories\Eloquent\ServerRepository; @@ -46,6 +44,7 @@ use Pterodactyl\Contracts\Repository\ServerRepositoryInterface; use Pterodactyl\Repositories\Eloquent\OptionVariableRepository; use Pterodactyl\Repositories\Eloquent\ServerVariableRepository; use Pterodactyl\Contracts\Repository\ServiceRepositoryInterface; +use Pterodactyl\Repositories\Eloquent\ServiceVariableRepository; use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface; use Pterodactyl\Contracts\Repository\LocationRepositoryInterface; use Pterodactyl\Contracts\Repository\AllocationRepositoryInterface; @@ -54,6 +53,7 @@ use Pterodactyl\Contracts\Repository\ApiPermissionRepositoryInterface; use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface; use Pterodactyl\Contracts\Repository\OptionVariableRepositoryInterface; use Pterodactyl\Contracts\Repository\ServerVariableRepositoryInterface; +use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface; use Pterodactyl\Contracts\Repository\Daemon\ConfigurationRepositoryInterface; use Pterodactyl\Repositories\Daemon\ServerRepository as DaemonServerRepository; use Pterodactyl\Contracts\Repository\Daemon\ServerRepositoryInterface as DaemonServerRepositoryInterface; diff --git a/app/Services/Services/Options/OptionUpdateService.php b/app/Services/Services/Options/OptionUpdateService.php index 4e922b21e..4ba133fa1 100644 --- a/app/Services/Services/Options/OptionUpdateService.php +++ b/app/Services/Services/Options/OptionUpdateService.php @@ -24,9 +24,9 @@ namespace Pterodactyl\Services\Services\Options; +use Pterodactyl\Models\ServiceOption; use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface; use Pterodactyl\Exceptions\Services\ServiceOption\NoParentConfigurationFoundException; -use Pterodactyl\Models\ServiceOption; class OptionUpdateService { diff --git a/app/Services/Services/Variables/VariableCreationService.php b/app/Services/Services/Variables/VariableCreationService.php index a079baabf..7730380cd 100644 --- a/app/Services/Services/Variables/VariableCreationService.php +++ b/app/Services/Services/Variables/VariableCreationService.php @@ -24,11 +24,11 @@ namespace Pterodactyl\Services\Services\Variables; +use Pterodactyl\Models\ServiceOption; +use Pterodactyl\Models\ServiceVariable; use Pterodactyl\Contracts\Repository\ServiceOptionRepositoryInterface; use Pterodactyl\Contracts\Repository\ServiceVariableRepositoryInterface; use Pterodactyl\Exceptions\Services\ServiceVariable\ReservedVariableNameException; -use Pterodactyl\Models\ServiceOption; -use Pterodactyl\Models\ServiceVariable; class VariableCreationService { diff --git a/database/migrations/2016_10_23_201624_add_foreign_allocations.php b/database/migrations/2016_10_23_201624_add_foreign_allocations.php index 8ff9bdd2f..d2d869cd3 100644 --- a/database/migrations/2016_10_23_201624_add_foreign_allocations.php +++ b/database/migrations/2016_10_23_201624_add_foreign_allocations.php @@ -24,24 +24,24 @@ class AddForeignAllocations extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('allocations', function (Blueprint $table) { - $table->dropForeign('allocations_assigned_to_foreign'); - $table->dropForeign('allocations_node_foreign'); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('allocations', function (Blueprint $table) { + $table->dropForeign('allocations_assigned_to_foreign'); + $table->dropForeign('allocations_node_foreign'); - $table->dropIndex('allocations_assigned_to_foreign'); - $table->dropIndex('allocations_node_foreign'); - }); + $table->dropIndex('allocations_assigned_to_foreign'); + $table->dropIndex('allocations_node_foreign'); + }); - DB::statement('ALTER TABLE allocations + DB::statement('ALTER TABLE allocations MODIFY COLUMN assigned_to MEDIUMINT(8) UNSIGNED NULL, MODIFY COLUMN node MEDIUMINT(8) UNSIGNED NOT NULL '); - } + } } diff --git a/database/migrations/2016_10_23_202703_add_foreign_api_permissions.php b/database/migrations/2016_10_23_202703_add_foreign_api_permissions.php index 58bf1a5a5..16e1eebd1 100644 --- a/database/migrations/2016_10_23_202703_add_foreign_api_permissions.php +++ b/database/migrations/2016_10_23_202703_add_foreign_api_permissions.php @@ -20,18 +20,18 @@ class AddForeignApiPermissions extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('api_permissions', function (Blueprint $table) { - $table->dropForeign('api_permissions_key_id_foreign'); - $table->dropIndex('api_permissions_key_id_foreign'); - }); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('api_permissions', function (Blueprint $table) { + $table->dropForeign('api_permissions_key_id_foreign'); + $table->dropIndex('api_permissions_key_id_foreign'); + }); - DB::statement('ALTER TABLE api_permissions MODIFY key_id MEDIUMINT(8) UNSIGNED NOT NULL'); - } + DB::statement('ALTER TABLE api_permissions MODIFY key_id MEDIUMINT(8) UNSIGNED NOT NULL'); + } } diff --git a/database/migrations/2016_10_23_203522_add_foreign_permissions.php b/database/migrations/2016_10_23_203522_add_foreign_permissions.php index 153ab27ce..2f872de6f 100644 --- a/database/migrations/2016_10_23_203522_add_foreign_permissions.php +++ b/database/migrations/2016_10_23_203522_add_foreign_permissions.php @@ -19,19 +19,19 @@ class AddForeignPermissions extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('permissions', function (Blueprint $table) { - $table->dropForeign('permissions_user_id_foreign'); - $table->dropForeign('permissions_server_id_foreign'); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('permissions', function (Blueprint $table) { + $table->dropForeign('permissions_user_id_foreign'); + $table->dropForeign('permissions_server_id_foreign'); - $table->dropIndex('permissions_user_id_foreign'); - $table->dropIndex('permissions_server_id_foreign'); - }); - } + $table->dropIndex('permissions_user_id_foreign'); + $table->dropIndex('permissions_server_id_foreign'); + }); + } } diff --git a/database/migrations/2016_10_23_203857_add_foreign_server_variables.php b/database/migrations/2016_10_23_203857_add_foreign_server_variables.php index af78a161c..0a975dc8b 100644 --- a/database/migrations/2016_10_23_203857_add_foreign_server_variables.php +++ b/database/migrations/2016_10_23_203857_add_foreign_server_variables.php @@ -24,21 +24,21 @@ class AddForeignServerVariables extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('server_variables', function (Blueprint $table) { - $table->dropForeign(['server_id']); - $table->dropForeign(['variable_id']); - }); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('server_variables', function (Blueprint $table) { + $table->dropForeign(['server_id']); + $table->dropForeign(['variable_id']); + }); - DB::statement('ALTER TABLE server_variables + DB::statement('ALTER TABLE server_variables MODIFY COLUMN server_id MEDIUMINT(8) UNSIGNED NULL, MODIFY COLUMN variable_id MEDIUMINT(8) UNSIGNED NOT NULL '); - } + } } diff --git a/database/migrations/2016_10_23_204157_add_foreign_service_options.php b/database/migrations/2016_10_23_204157_add_foreign_service_options.php index 0baad0c36..ff6e3b35d 100644 --- a/database/migrations/2016_10_23_204157_add_foreign_service_options.php +++ b/database/migrations/2016_10_23_204157_add_foreign_service_options.php @@ -20,18 +20,18 @@ class AddForeignServiceOptions extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('service_options', function (Blueprint $table) { - $table->dropForeign('service_options_parent_service_foreign'); - $table->dropIndex('service_options_parent_service_foreign'); - }); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('service_options', function (Blueprint $table) { + $table->dropForeign('service_options_parent_service_foreign'); + $table->dropIndex('service_options_parent_service_foreign'); + }); - DB::statement('ALTER TABLE service_options MODIFY parent_service MEDIUMINT(8) UNSIGNED NOT NULL'); - } + DB::statement('ALTER TABLE service_options MODIFY parent_service MEDIUMINT(8) UNSIGNED NOT NULL'); + } } diff --git a/database/migrations/2016_10_23_204321_add_foreign_service_variables.php b/database/migrations/2016_10_23_204321_add_foreign_service_variables.php index 291ca24e2..5a543898d 100644 --- a/database/migrations/2016_10_23_204321_add_foreign_service_variables.php +++ b/database/migrations/2016_10_23_204321_add_foreign_service_variables.php @@ -20,18 +20,18 @@ class AddForeignServiceVariables extends Migration }); } - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('service_variables', function (Blueprint $table) { - $table->dropForeign('service_variables_option_id_foreign'); - $table->dropIndex('service_variables_option_id_foreign'); - }); + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('service_variables', function (Blueprint $table) { + $table->dropForeign('service_variables_option_id_foreign'); + $table->dropIndex('service_variables_option_id_foreign'); + }); - DB::statement('ALTER TABLE service_variables MODIFY option_id MEDIUMINT(8) UNSIGNED NOT NULL'); - } + DB::statement('ALTER TABLE service_variables MODIFY option_id MEDIUMINT(8) UNSIGNED NOT NULL'); + } } diff --git a/tests/Unit/Services/Allocations/AssignmentServiceTest.php b/tests/Unit/Services/Allocations/AssignmentServiceTest.php index 2c222859c..f55fdc5f9 100644 --- a/tests/Unit/Services/Allocations/AssignmentServiceTest.php +++ b/tests/Unit/Services/Allocations/AssignmentServiceTest.php @@ -87,7 +87,7 @@ class AssignmentServiceTest extends TestCase { $data = [ 'allocation_ip' => '192.168.1.1', - 'allocation_ports' => ['1024'] + 'allocation_ports' => ['1024'], ]; $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); @@ -112,7 +112,7 @@ class AssignmentServiceTest extends TestCase { $data = [ 'allocation_ip' => '192.168.1.1', - 'allocation_ports' => ['1024-1026'] + 'allocation_ports' => ['1024-1026'], ]; $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull(); @@ -142,7 +142,6 @@ class AssignmentServiceTest extends TestCase $this->connection->shouldReceive('commit')->withNoArgs()->once()->andReturnNull(); $this->service->handle($this->node->id, $data); - } /** @@ -307,7 +306,7 @@ class AssignmentServiceTest extends TestCase { $data = [ 'allocation_ip' => '192.168.1.1', - 'allocation_ports' => ['1024'] + 'allocation_ports' => ['1024'], ]; $this->connection->shouldReceive('beginTransaction')->withNoArgs()->once()->andReturnNull();