Update doc blocks for all app/

This commit is contained in:
Dane Everitt 2017-03-19 19:36:50 -04:00
parent 5e27772fef
commit 0312c974f5
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
114 changed files with 1360 additions and 949 deletions

11
.gitignore vendored
View file

@ -6,14 +6,11 @@
storage/framework/* storage/framework/*
composer.lock composer.lock
Homestead.yaml
Vagrantfile
Vagrantfile
node_modules
yarn.lock
node_modules node_modules
_ide_helper_models.php _ide_helper_models.php
_ide_helper.php _ide_helper.php
sami.phar
sami.config.php
/sami

View file

@ -31,11 +31,17 @@ class Created
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Creating
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Deleted
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Deleting
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Saved
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Saving
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Updated
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Updating
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Server
*/
public $server; public $server;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function __construct(Server $server) public function __construct(Server $server)

View file

@ -31,11 +31,17 @@ class Created
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser; public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function __construct(Subuser $subuser) public function __construct(Subuser $subuser)

View file

@ -31,11 +31,17 @@ class Creating
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser; public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function __construct(Subuser $subuser) public function __construct(Subuser $subuser)

View file

@ -31,11 +31,17 @@ class Deleted
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser; public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function __construct(Subuser $subuser) public function __construct(Subuser $subuser)

View file

@ -31,11 +31,17 @@ class Deleting
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\Subuser
*/
public $subuser; public $subuser;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function __construct(Subuser $subuser) public function __construct(Subuser $subuser)

View file

@ -31,11 +31,17 @@ class Created
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user; public $user;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function __construct(User $user) public function __construct(User $user)

View file

@ -31,11 +31,17 @@ class Creating
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user; public $user;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function __construct(User $user) public function __construct(User $user)

View file

@ -31,11 +31,17 @@ class Deleted
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user; public $user;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function __construct(User $user) public function __construct(User $user)

View file

@ -31,11 +31,17 @@ class Deleting
{ {
use SerializesModels; use SerializesModels;
/**
* The Eloquent model of the server.
*
* @var \Pterodactyl\Models\User
*/
public $user; public $user;
/** /**
* Create a new event instance. * Create a new event instance.
* *
* @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function __construct(User $user) public function __construct(User $user)

View file

@ -26,4 +26,5 @@ namespace Pterodactyl\Exceptions;
class AccountNotFoundException extends \Exception class AccountNotFoundException extends \Exception
{ {
//
} }

View file

@ -28,20 +28,19 @@ use Log;
class DisplayException extends \Exception class DisplayException extends \Exception
{ {
private $_logging = null; /**
* Exception constructor.
*
* @param string $message
* @param mixed $log
* @return void
*/
public function __construct($message, $log = null) public function __construct($message, $log = null)
{ {
$this->_logging = $log; if (! is_null($log)) {
if ($this->_logging !== null) {
Log::error($log); Log::error($log);
} }
parent::__construct($message); parent::__construct($message);
} }
public function getLogging()
{
return $this->_logging;
}
} }

View file

@ -29,7 +29,7 @@ class Handler extends ExceptionHandler
* *
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* *
* @param \Exception $e * @param \Exception $exception
* @return void * @return void
*/ */
public function report(Exception $exception) public function report(Exception $exception)
@ -41,7 +41,7 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response. * Render an exception into an HTTP response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Exception $e * @param \Exception $exception
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function render($request, Exception $exception) public function render($request, Exception $exception)
@ -60,7 +60,7 @@ class Handler extends ExceptionHandler
/** /**
* Convert an authentication exception into an unauthenticated response. * Convert an authentication exception into an unauthenticated response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception * @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */

View file

@ -31,11 +31,11 @@ class PhraseAppTranslator extends LaravelTranslator
/** /**
* Get the translation for the given key. * Get the translation for the given key.
* *
* @param string $key * @param string $key
* @param array $replace * @param array $replace
* @param string|null $locale * @param string|null $locale
* @param bool $fallback * @param bool $fallback
* @return string|array|null * @return string
*/ */
public function get($key, array $replace = [], $locale = null, $fallback = true) public function get($key, array $replace = [], $locale = null, $fallback = true)
{ {

View file

@ -28,6 +28,11 @@ use Illuminate\Support\Facades\Facade;
class Version extends Facade class Version extends Facade
{ {
/**
* Returns the facade accessor class.
*
* @return strig
*/
protected static function getFacadeAccessor() protected static function getFacadeAccessor()
{ {
return '\Pterodactyl\Services\VersionService'; return '\Pterodactyl\Services\VersionService';

View file

@ -142,6 +142,7 @@ class NodeController extends BaseController
* Returns a listing of the allocation for the specified server id. * Returns a listing of the allocation for the specified server id.
* *
* @param Request $request * @param Request $request
* @param int $id
* @return array * @return array
*/ */
public function allocationsView(Request $request, $id) public function allocationsView(Request $request, $id)

View file

@ -32,16 +32,34 @@ use Pterodactyl\Http\Controllers\Controller;
class BaseController extends Controller class BaseController extends Controller
{ {
/**
* Return the admin index view.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function getIndex(Request $request) public function getIndex(Request $request)
{ {
return view('admin.index'); return view('admin.index');
} }
/**
* Return the admin settings view.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function getSettings(Request $request) public function getSettings(Request $request)
{ {
return view('admin.settings'); return view('admin.settings');
} }
/**
* Handle settings post request.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function postSettings(Request $request) public function postSettings(Request $request)
{ {
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [

View file

@ -40,7 +40,7 @@ class DatabaseController extends Controller
/** /**
* Display database host index. * Display database host index.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -54,8 +54,8 @@ class DatabaseController extends Controller
/** /**
* Display database host to user. * Display database host to user.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function view(Request $request, $id) public function view(Request $request, $id)
@ -69,8 +69,8 @@ class DatabaseController extends Controller
/** /**
* Handle post request to create database host. * Handle post request to create database host.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
{ {
@ -99,9 +99,9 @@ class DatabaseController extends Controller
/** /**
* Handle post request to update a database host. * Handle post request to update a database host.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {

View file

@ -38,7 +38,7 @@ class LocationController extends Controller
/** /**
* Return the location overview page. * Return the location overview page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -51,8 +51,8 @@ class LocationController extends Controller
/** /**
* Return the location view page. * Return the location view page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function view(Request $request, $id) public function view(Request $request, $id)
@ -63,8 +63,8 @@ class LocationController extends Controller
/** /**
* Handle request to create new location. * Handle request to create new location.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
{ {
@ -88,9 +88,9 @@ class LocationController extends Controller
/** /**
* Handle request to update or delete location. * Handle request to update or delete location.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {

View file

@ -40,7 +40,7 @@ class NodesController extends Controller
/** /**
* Displays the index page listing all nodes on the panel. * Displays the index page listing all nodes on the panel.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -57,8 +57,8 @@ class NodesController extends Controller
/** /**
* Displays create new node page. * Displays create new node page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View|\Illuminate\Response\RedirectResponse * @return \Illuminate\View\View|\Illuminate\Http\RedirectResponse
*/ */
public function new(Request $request) public function new(Request $request)
{ {
@ -75,8 +75,8 @@ class NodesController extends Controller
/** /**
* Post controller to create a new node on the system. * Post controller to create a new node on the system.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
{ {
@ -110,9 +110,8 @@ class NodesController extends Controller
/** /**
* Shows the index overview page for a specific node. * Shows the index overview page for a specific node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the node to display information for. * @param int $id
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewIndex(Request $request, $id) public function viewIndex(Request $request, $id)
@ -138,9 +137,8 @@ class NodesController extends Controller
/** /**
* Shows the settings page for a specific node. * Shows the settings page for a specific node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the node to display information for. * @param int $id
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewSettings(Request $request, $id) public function viewSettings(Request $request, $id)
@ -154,9 +152,8 @@ class NodesController extends Controller
/** /**
* Shows the configuration page for a specific node. * Shows the configuration page for a specific node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the node to display information for. * @param int $id
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewConfiguration(Request $request, $id) public function viewConfiguration(Request $request, $id)
@ -169,9 +166,8 @@ class NodesController extends Controller
/** /**
* Shows the allocation page for a specific node. * Shows the allocation page for a specific node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the node to display information for. * @param int $id
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewAllocation(Request $request, $id) public function viewAllocation(Request $request, $id)
@ -189,9 +185,8 @@ class NodesController extends Controller
/** /**
* Shows the server listing page for a specific node. * Shows the server listing page for a specific node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the node to display information for. * @param int $id
*
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewServers(Request $request, $id) public function viewServers(Request $request, $id)
@ -209,8 +204,8 @@ class NodesController extends Controller
/** /**
* Updates settings for a node. * Updates settings for a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $node * @param int $id
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function updateSettings(Request $request, $id) public function updateSettings(Request $request, $id)
@ -244,9 +239,9 @@ class NodesController extends Controller
/** /**
* Removes a single allocation from a node. * Removes a single allocation from a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $node * @param int $node
* @param int $allocation [description] * @param int $allocation
* @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse * @return \Illuminate\Http\Response|\Illuminate\Http\JsonResponse
*/ */
public function allocationRemoveSingle(Request $request, $node, $allocation) public function allocationRemoveSingle(Request $request, $node, $allocation)
@ -264,8 +259,8 @@ class NodesController extends Controller
/** /**
* Remove all allocations for a specific IP at once on a node. * Remove all allocations for a specific IP at once on a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $node * @param int $node
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function allocationRemoveBlock(Request $request, $node) public function allocationRemoveBlock(Request $request, $node)
@ -283,10 +278,9 @@ class NodesController extends Controller
/** /**
* Sets an alias for a specific allocation on a node. * Sets an alias for a specific allocation on a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $node * @param int $node
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
* @throws \Exception
*/ */
public function allocationSetAlias(Request $request, $node) public function allocationSetAlias(Request $request, $node)
{ {
@ -308,8 +302,8 @@ class NodesController extends Controller
/** /**
* Creates new allocations on a node. * Creates new allocations on a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $node * @param int $node
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function createAllocation(Request $request, $node) public function createAllocation(Request $request, $node)
@ -334,8 +328,8 @@ class NodesController extends Controller
/** /**
* Deletes a node from the system. * Deletes a node from the system.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Http\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function delete(Request $request, $id) public function delete(Request $request, $id)
@ -360,8 +354,8 @@ class NodesController extends Controller
/** /**
* Returns the configuration token to auto-deploy a node. * Returns the configuration token to auto-deploy a node.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function setToken(Request $request, $id) public function setToken(Request $request, $id)

View file

@ -41,7 +41,7 @@ class OptionController extends Controller
/** /**
* Handles request to view page for adding new option. * Handles request to view page for adding new option.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function new(Request $request)
@ -55,7 +55,7 @@ class OptionController extends Controller
/** /**
* Handles POST request to create a new option. * Handles POST request to create a new option.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Response\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
@ -86,9 +86,9 @@ class OptionController extends Controller
/** /**
* Handles POST request to create a new option variable. * Handles POST request to create a new option variable.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id The ID of the service option to assign this variable to. * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function createVariable(Request $request, $id) public function createVariable(Request $request, $id)
{ {
@ -116,8 +116,8 @@ class OptionController extends Controller
/** /**
* Display option overview page. * Display option overview page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewConfiguration(Request $request, $id) public function viewConfiguration(Request $request, $id)
@ -128,8 +128,8 @@ class OptionController extends Controller
/** /**
* Display variable overview page for a service option. * Display variable overview page for a service option.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewVariables(Request $request, $id) public function viewVariables(Request $request, $id)
@ -140,8 +140,9 @@ class OptionController extends Controller
/** /**
* Handles POST when editing a configration for a service option. * Handles POST when editing a configration for a service option.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @param int $id
* @return \Illuminate\Http\RedirectResponse
*/ */
public function editConfiguration(Request $request, $id) public function editConfiguration(Request $request, $id)
{ {
@ -176,10 +177,10 @@ class OptionController extends Controller
/** /**
* Handles POST when editing a configration for a service option. * Handles POST when editing a configration for a service option.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $option * @param int $option
* @param int $variable * @param int $variable
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function editVariable(Request $request, $option, $variable) public function editVariable(Request $request, $option, $variable)
{ {

View file

@ -40,7 +40,7 @@ class PackController extends Controller
/** /**
* Display listing of all packs on the system. * Display listing of all packs on the system.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -57,7 +57,7 @@ class PackController extends Controller
/** /**
* Display new pack creation form. * Display new pack creation form.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function new(Request $request)
@ -70,7 +70,7 @@ class PackController extends Controller
/** /**
* Display new pack creation modal for use with template upload. * Display new pack creation modal for use with template upload.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function newTemplate(Request $request) public function newTemplate(Request $request)
@ -83,7 +83,7 @@ class PackController extends Controller
/** /**
* Handle create pack request and route user to location. * Handle create pack request and route user to location.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function create(Request $request) public function create(Request $request)
@ -117,8 +117,8 @@ class PackController extends Controller
/** /**
* Display pack view template to user. * Display pack view template to user.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function view(Request $request, $id) public function view(Request $request, $id)
@ -132,9 +132,9 @@ class PackController extends Controller
/** /**
* Handle updating or deleting pack information. * Handle updating or deleting pack information.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
@ -168,10 +168,10 @@ class PackController extends Controller
/** /**
* Creates an archive of the pack and downloads it to the browser. * Creates an archive of the pack and downloads it to the browser.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @param bool $files * @param bool $files
* @return \Illuminate\Response\BinaryFileResponse * @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/ */
public function export(Request $request, $id, $files = false) public function export(Request $request, $id, $files = false)
{ {
@ -202,6 +202,7 @@ class PackController extends Controller
return response()->download($filename, 'pack-' . $pack->name . '.zip')->deleteFileAfterSend(true); return response()->download($filename, 'pack-' . $pack->name . '.zip')->deleteFileAfterSend(true);
} else { } else {
$fp = fopen($filename, 'a+'); $fp = fopen($filename, 'a+');
fwrite($fp, json_encode($json, JSON_PRETTY_PRINT)); fwrite($fp, json_encode($json, JSON_PRETTY_PRINT));
fclose($fp); fclose($fp);

View file

@ -41,7 +41,7 @@ class ServersController extends Controller
/** /**
* Display the index page with all servers currently on the system. * Display the index page with all servers currently on the system.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -62,7 +62,7 @@ class ServersController extends Controller
/** /**
* Display create new server page. * Display create new server page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function new(Request $request)
@ -85,7 +85,7 @@ class ServersController extends Controller
/** /**
* Create server controller method. * Create server controller method.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Response\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
@ -110,7 +110,7 @@ class ServersController extends Controller
/** /**
* Returns a tree of all avaliable nodes in a given location. * Returns a tree of all avaliable nodes in a given location.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return array * @return array
*/ */
public function newServerNodes(Request $request) public function newServerNodes(Request $request)
@ -140,8 +140,8 @@ class ServersController extends Controller
/** /**
* Display the index when viewing a specific server. * Display the index when viewing a specific server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewIndex(Request $request, $id) public function viewIndex(Request $request, $id)
@ -152,8 +152,8 @@ class ServersController extends Controller
/** /**
* Display the details page when viewing a specific server. * Display the details page when viewing a specific server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewDetails(Request $request, $id) public function viewDetails(Request $request, $id)
@ -166,8 +166,8 @@ class ServersController extends Controller
/** /**
* Display the build details page when viewing a specific server. * Display the build details page when viewing a specific server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewBuild(Request $request, $id) public function viewBuild(Request $request, $id)
@ -184,8 +184,8 @@ class ServersController extends Controller
/** /**
* Display startup configuration page for a server. * Display startup configuration page for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewStartup(Request $request, $id) public function viewStartup(Request $request, $id)
@ -203,8 +203,8 @@ class ServersController extends Controller
/** /**
* Display the database management page for a specific server. * Display the database management page for a specific server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewDatabase(Request $request, $id) public function viewDatabase(Request $request, $id)
@ -220,8 +220,8 @@ class ServersController extends Controller
/** /**
* Display the management page when viewing a specific server. * Display the management page when viewing a specific server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewManage(Request $request, $id) public function viewManage(Request $request, $id)
@ -232,8 +232,8 @@ class ServersController extends Controller
/** /**
* Display the deletion page for a server. * Display the deletion page for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewDelete(Request $request, $id) public function viewDelete(Request $request, $id)
@ -244,9 +244,9 @@ class ServersController extends Controller
/** /**
* Update the details for a server. * Update the details for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function setDetails(Request $request, $id) public function setDetails(Request $request, $id)
{ {
@ -272,9 +272,9 @@ class ServersController extends Controller
/** /**
* Set the new docker container for a server. * Set the new docker container for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function setContainer(Request $request, $id) public function setContainer(Request $request, $id)
{ {
@ -299,9 +299,9 @@ class ServersController extends Controller
/** /**
* Toggles the install status for a server. * Toggles the install status for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function toggleInstall(Request $request, $id) public function toggleInstall(Request $request, $id)
{ {
@ -323,9 +323,9 @@ class ServersController extends Controller
/** /**
* Setup a server to have a container rebuild. * Setup a server to have a container rebuild.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function rebuildContainer(Request $request, $id) public function rebuildContainer(Request $request, $id)
{ {
@ -349,9 +349,9 @@ class ServersController extends Controller
/** /**
* Manage the suspension status for a server. * Manage the suspension status for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function manageSuspension(Request $request, $id) public function manageSuspension(Request $request, $id)
{ {
@ -381,9 +381,9 @@ class ServersController extends Controller
/** /**
* Update the build configuration for a server. * Update the build configuration for a server.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function updateBuild(Request $request, $id) public function updateBuild(Request $request, $id)
{ {
@ -411,9 +411,9 @@ class ServersController extends Controller
/** /**
* Start the server deletion process. * Start the server deletion process.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function delete(Request $request, $id) public function delete(Request $request, $id)
{ {
@ -435,9 +435,9 @@ class ServersController extends Controller
/** /**
* Cancels a pending server deletion request. * Cancels a pending server deletion request.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function cancelDeletion(Request $request, $id) public function cancelDeletion(Request $request, $id)
{ {
@ -452,10 +452,10 @@ class ServersController extends Controller
/** /**
* Skips the queue and continues the server deletion process. * Skips the queue and continues the server deletion process.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @param string $method * @param string $method
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function continueDeletion(Request $request, $id, $method = 'safe') public function continueDeletion(Request $request, $id, $method = 'safe')
{ {
@ -482,9 +482,9 @@ class ServersController extends Controller
/** /**
* Update the startup command as well as variables. * Update the startup command as well as variables.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function saveStartup(Request $request, $id) public function saveStartup(Request $request, $id)
{ {
@ -511,9 +511,10 @@ class ServersController extends Controller
/** /**
* Creates a new database assigned to a specific server. * Creates a new database assigned to a specific server.
* @param Request $request *
* @param int $id * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @param int $id
* @return \Illuminate\Http\RedirectResponse
*/ */
public function newDatabase(Request $request, $id) public function newDatabase(Request $request, $id)
{ {
@ -537,9 +538,10 @@ class ServersController extends Controller
/** /**
* Resets the database password for a specific database on this server. * Resets the database password for a specific database on this server.
* @param Request $request *
* @param int $id * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @param int $id
* @return \Illuminate\Http\RedirectResponse
*/ */
public function resetDatabasePassword(Request $request, $id) public function resetDatabasePassword(Request $request, $id)
{ {
@ -559,9 +561,11 @@ class ServersController extends Controller
/** /**
* Deletes a database from a server. * Deletes a database from a server.
* @param Request $request *
* @param int $id * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @param int $id
* @param int $database
* @return \Illuminate\Http\RedirectResponse
*/ */
public function deleteDatabase(Request $request, $id, $database) public function deleteDatabase(Request $request, $id, $database)
{ {

View file

@ -38,7 +38,7 @@ class ServiceController extends Controller
/** /**
* Display service overview page. * Display service overview page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
@ -51,7 +51,7 @@ class ServiceController extends Controller
/** /**
* Display create service page. * Display create service page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function new(Request $request) public function new(Request $request)
@ -62,8 +62,8 @@ class ServiceController extends Controller
/** /**
* Return base view for a service. * Return base view for a service.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function view(Request $request, $id) public function view(Request $request, $id)
@ -76,8 +76,8 @@ class ServiceController extends Controller
/** /**
* Return function editing view for a service. * Return function editing view for a service.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\View\View * @return \Illuminate\View\View
*/ */
public function viewFunctions(Request $request, $id) public function viewFunctions(Request $request, $id)
@ -88,8 +88,8 @@ class ServiceController extends Controller
/** /**
* Handle post action for new service. * Handle post action for new service.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function create(Request $request) public function create(Request $request)
{ {
@ -117,9 +117,9 @@ class ServiceController extends Controller
/** /**
* Edits configuration for a specific service. * Edits configuration for a specific service.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @return \Illuminate\Http\RedirectResponse
*/ */
public function edit(Request $request, $id) public function edit(Request $request, $id)
{ {

View file

@ -37,14 +37,11 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class UserController extends Controller class UserController extends Controller
{ {
/** /**
* Controller Constructor. * Display user index page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/ */
public function __construct()
{
//
}
// @TODO: implement nicolaslopezj/searchable to clean up this disaster.
public function getIndex(Request $request) public function getIndex(Request $request)
{ {
$users = User::withCount('servers'); $users = User::withCount('servers');
@ -58,11 +55,24 @@ class UserController extends Controller
]); ]);
} }
/**
* Display new user page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function getNew(Request $request) public function getNew(Request $request)
{ {
return view('admin.users.new'); return view('admin.users.new');
} }
/**
* Display user view page.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\View\View
*/
public function getView(Request $request, $id) public function getView(Request $request, $id)
{ {
return view('admin.users.view', [ return view('admin.users.view', [
@ -70,6 +80,13 @@ class UserController extends Controller
]); ]);
} }
/**
* Delete a user.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function deleteUser(Request $request, $id) public function deleteUser(Request $request, $id)
{ {
try { try {
@ -88,6 +105,12 @@ class UserController extends Controller
return redirect()->route('admin.users.view', $id); return redirect()->route('admin.users.view', $id);
} }
/**
* Create a user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function postNew(Request $request) public function postNew(Request $request)
{ {
try { try {
@ -109,6 +132,13 @@ class UserController extends Controller
} }
} }
/**
* Update a user.
*
* @param \Illuminate\Http\Request $request
* @param int $user
* @return \Illuminate\Http\RedirectResponse
*/
public function updateUser(Request $request, $user) public function updateUser(Request $request, $user)
{ {
try { try {
@ -128,6 +158,12 @@ class UserController extends Controller
return redirect()->route('admin.users.view', $user); return redirect()->route('admin.users.view', $user);
} }
/**
* Get a JSON response of users on the system.
*
* @param \Illuminate\Http\Request $request
* @return \Pterodactyl\Models\User
*/
public function getJson(Request $request) public function getJson(Request $request)
{ {
return User::select('id', 'email', 'username', 'name_first', 'name_last') return User::select('id', 'email', 'username', 'name_first', 'name_last')

View file

@ -83,7 +83,7 @@ class LoginController extends Controller
* Handle a login request to the application. * Handle a login request to the application.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response|\Illuminate\Response\RedirectResponse
*/ */
public function login(Request $request) public function login(Request $request)
{ {
@ -126,6 +126,12 @@ class LoginController extends Controller
} }
} }
/**
* Handle a TOTP implementation page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function totp(Request $request) public function totp(Request $request)
{ {
$verifyKey = $request->session()->get('authentication_token'); $verifyKey = $request->session()->get('authentication_token');
@ -140,6 +146,12 @@ class LoginController extends Controller
]); ]);
} }
/**
* Handle a TOTP input.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function totpCheckpoint(Request $request) public function totpCheckpoint(Request $request)
{ {
$G2FA = new Google2FA(); $G2FA = new Google2FA();

View file

@ -21,6 +21,11 @@ class ResetPasswordController extends Controller
use ResetsPasswords; use ResetsPasswords;
/**
* The URL to redirect users to after password reset.
*
* @var string
*/
public $redirectTo = '/'; public $redirectTo = '/';
/** /**
@ -33,6 +38,11 @@ class ResetPasswordController extends Controller
$this->middleware('guest'); $this->middleware('guest');
} }
/**
* Return the rules used when validating password reset.
*
* @return array
*/
protected function rules() protected function rules()
{ {
return [ return [

View file

@ -36,6 +36,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class APIController extends Controller class APIController extends Controller
{ {
/**
* Display base API index page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request) public function index(Request $request)
{ {
return view('base.api.index', [ return view('base.api.index', [
@ -43,11 +49,23 @@ class APIController extends Controller
]); ]);
} }
/**
* Display API key creation page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function create(Request $request) public function create(Request $request)
{ {
return view('base.api.new'); return view('base.api.new');
} }
/**
* Handle saving new API key.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function save(Request $request) public function save(Request $request)
{ {
try { try {
@ -71,6 +89,13 @@ class APIController extends Controller
return redirect()->route('account.api.new')->withInput(); return redirect()->route('account.api.new')->withInput();
} }
/**
* Handle revoking API key.
*
* @param \Illuminate\Http\Request $request
* @param string $key
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function revoke(Request $request, $key) public function revoke(Request $request, $key)
{ {
try { try {

View file

@ -38,8 +38,8 @@ class AccountController extends Controller
/** /**
* Display base account information page. * Display base account information page.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
{ {
@ -48,8 +48,10 @@ class AccountController extends Controller
/** /**
* Update details for a users account. * Update details for a users account.
* @param \Illuminate\Http\Request $request *
* @return void * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*/ */
public function update(Request $request) public function update(Request $request)
{ {

View file

@ -30,19 +30,11 @@ use Pterodactyl\Http\Controllers\Controller;
class IndexController extends Controller class IndexController extends Controller
{ {
/**
* Controller Constructor.
*/
public function __construct()
{
//
}
/** /**
* Returns listing of user's servers. * Returns listing of user's servers.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View
*/ */
public function getIndex(Request $request) public function getIndex(Request $request)
{ {
@ -54,8 +46,10 @@ class IndexController extends Controller
/** /**
* Generate a random string. * Generate a random string.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param int $length
* @return string * @return string
* @deprecated
*/ */
public function getPassword(Request $request, $length = 16) public function getPassword(Request $request, $length = 16)
{ {

View file

@ -32,6 +32,11 @@ use Pterodactyl\Http\Controllers\Controller;
class LanguageController extends Controller class LanguageController extends Controller
{ {
/**
* A list of supported languages on the panel.
*
* @var array
*/
protected $languages = [ protected $languages = [
'de' => 'German', 'de' => 'German',
'en' => 'English', 'en' => 'English',
@ -44,13 +49,12 @@ class LanguageController extends Controller
]; ];
/** /**
* Controller Constructor. * Sets the language for a user.
*
* @param \Illuminate\Http\Request $request
* @param string $language
* @return \Illuminate\Http\RedirectResponse
*/ */
public function __construct()
{
//
}
public function setLanguage(Request $request, $language) public function setLanguage(Request $request, $language)
{ {
if (array_key_exists($language, $this->languages)) { if (array_key_exists($language, $this->languages)) {

View file

@ -36,8 +36,8 @@ class SecurityController extends Controller
/** /**
* Returns Security Management Page. * Returns Security Management Page.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View
*/ */
public function index(Request $request) public function index(Request $request)
{ {
@ -50,8 +50,8 @@ class SecurityController extends Controller
* Generates TOTP Secret and returns popup data for user to verify * Generates TOTP Secret and returns popup data for user to verify
* that they can generate a valid response. * that they can generate a valid response.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @return \Illuminate\Http\JsonResponse
*/ */
public function generateTotp(Request $request) public function generateTotp(Request $request)
{ {
@ -73,7 +73,7 @@ class SecurityController extends Controller
/** /**
* Verifies that 2FA token recieved is valid and will work on the account. * Verifies that 2FA token recieved is valid and will work on the account.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function setTotp(Request $request) public function setTotp(Request $request)
@ -95,8 +95,8 @@ class SecurityController extends Controller
/** /**
* Disables TOTP on an account. * Disables TOTP on an account.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return \Illuminate\Http\RedirectResponse
*/ */
public function disableTotp(Request $request) public function disableTotp(Request $request)
{ {
@ -116,6 +116,13 @@ class SecurityController extends Controller
return redirect()->route('account.security'); return redirect()->route('account.security');
} }
/**
* Revokes a user session.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function revoke(Request $request, $id) public function revoke(Request $request, $id)
{ {
Session::where('user_id', $request->user()->id)->findOrFail($id)->delete(); Session::where('user_id', $request->user()->id)->findOrFail($id)->delete();

View file

@ -31,19 +31,12 @@ use Pterodactyl\Http\Controllers\Controller;
class PackController extends Controller class PackController extends Controller
{ {
/**
* Controller Constructor.
*/
public function __construct()
{
//
}
/** /**
* Pulls an install pack archive from the system. * Pulls an install pack archive from the system.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @param string $uuid
* @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse
*/ */
public function pull(Request $request, $uuid) public function pull(Request $request, $uuid)
{ {
@ -63,8 +56,9 @@ class PackController extends Controller
/** /**
* Returns the hash information for a pack. * Returns the hash information for a pack.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @param string $uuid
* @return \Illuminate\Http\JsonResponse
*/ */
public function hash(Request $request, $uuid) public function hash(Request $request, $uuid)
{ {
@ -87,9 +81,10 @@ class PackController extends Controller
* Pulls an update pack archive from the system. * Pulls an update pack archive from the system.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @return void
*/ */
public function pullUpdate(Request $request) public function pullUpdate(Request $request)
{ {
//
} }
} }

View file

@ -36,7 +36,7 @@ class ServiceController extends Controller
* as well as the associated files and the file hashes for * as well as the associated files and the file hashes for
* caching purposes. * caching purposes.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse * @return \Illuminate\Http\JsonResponse
*/ */
public function list(Request $request) public function list(Request $request)
@ -77,7 +77,7 @@ class ServiceController extends Controller
* Returns a `main.json` file based on the configuration * Returns a `main.json` file based on the configuration
* of each service option. * of each service option.
* *
* @param int $id * @param int $id
* @return \Illuminate\Support\Collection * @return \Illuminate\Support\Collection
*/ */
protected function getConfiguration($id) protected function getConfiguration($id)

View file

@ -32,13 +32,11 @@ use Pterodactyl\Http\Controllers\Controller;
class RemoteController extends Controller class RemoteController extends Controller
{ {
/** /**
* Controller Constructor. * Handles download request from daemon.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/ */
public function __construct()
{
// No middleware for this route.
}
public function postDownload(Request $request) public function postDownload(Request $request)
{ {
$download = Models\Download::where('token', $request->input('token'))->first(); $download = Models\Download::where('token', $request->input('token'))->first();
@ -56,6 +54,12 @@ class RemoteController extends Controller
]); ]);
} }
/**
* Handles install toggle request from daemon.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function postInstall(Request $request) public function postInstall(Request $request)
{ {
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first(); $server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
@ -82,6 +86,13 @@ class RemoteController extends Controller
], 200); ], 200);
} }
/**
* Handles event from daemon.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
* @deprecated
*/
public function event(Request $request) public function event(Request $request)
{ {
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first(); $server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
@ -101,6 +112,13 @@ class RemoteController extends Controller
return response('', 201); return response('', 201);
} }
/**
* Handles configuration data request from daemon.
*
* @param \Illuminate\Http\Request $request
* @param string $token
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function getConfiguration(Request $request, $token) public function getConfiguration(Request $request, $token)
{ {
// Try to query the token and the node from the database // Try to query the token and the node from the database

View file

@ -50,20 +50,12 @@ class AjaxController extends Controller
*/ */
protected $directory; protected $directory;
/**
* Controller Constructor.
*/
public function __construct()
{
//
}
/** /**
* Returns true or false depending on the power status of the requested server. * Returns true or false depending on the power status of the requested server.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param string $uuid * @param string $uuid
* @return \Illuminate\Contracts\View\View * @return \Illuminate\Http\JsonResponse
*/ */
public function getStatus(Request $request, $uuid) public function getStatus(Request $request, $uuid)
{ {
@ -96,9 +88,9 @@ class AjaxController extends Controller
/** /**
* Returns a listing of files in a given directory for a server. * Returns a listing of files in a given directory for a server.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param string $uuid` * @param string $uuid
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View|\Illuminate\Http\Response
*/ */
public function postDirectoryList(Request $request, $uuid) public function postDirectoryList(Request $request, $uuid)
{ {
@ -147,8 +139,8 @@ class AjaxController extends Controller
/** /**
* Handles a POST request to save a file. * Handles a POST request to save a file.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param string $uuid * @param string $uuid
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function postSaveFile(Request $request, $uuid) public function postSaveFile(Request $request, $uuid)
@ -172,10 +164,12 @@ class AjaxController extends Controller
} }
/** /**
* [postSetPrimary description]. * Sets the primary allocation for a server.
* @param Request $request *
* @param string $uuid * @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response * @param string $uuid
* @return \Illuminate\Http\JsonResponse
* @deprecated
*/ */
public function postSetPrimary(Request $request, $uuid) public function postSetPrimary(Request $request, $uuid)
{ {
@ -219,6 +213,14 @@ class AjaxController extends Controller
} }
} }
/**
* Resets a database password for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
* @deprecated
*/
public function postResetDatabasePassword(Request $request, $uuid) public function postResetDatabasePassword(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);

View file

@ -37,21 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class ServerController extends Controller class ServerController extends Controller
{ {
/**
* Controller Constructor.
*
* @return void
*/
public function __construct()
{
//
}
/** /**
* Renders server index page for specified server. * Renders server index page for specified server.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @param string $uuid
* @return \Illuminate\View\View
*/ */
public function getIndex(Request $request, $uuid) public function getIndex(Request $request, $uuid)
{ {
@ -77,8 +68,9 @@ class ServerController extends Controller
/** /**
* Renders file overview page. * Renders file overview page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @param string $uuid
* @return \Illuminate\View\View
*/ */
public function getFiles(Request $request, $uuid) public function getFiles(Request $request, $uuid)
{ {
@ -110,8 +102,9 @@ class ServerController extends Controller
/** /**
* Renders add file page. * Renders add file page.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View * @param string $uuid
* @return \Illuminate\View\View
*/ */
public function getAddFile(Request $request, $uuid) public function getAddFile(Request $request, $uuid)
{ {
@ -130,10 +123,10 @@ class ServerController extends Controller
/** /**
* Renders edit file page for a given file. * Renders edit file page for a given file.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param string $uuid * @param string $uuid
* @param string $file * @param string $file
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View
*/ */
public function getEditFile(Request $request, $uuid, $file) public function getEditFile(Request $request, $uuid, $file)
{ {
@ -173,10 +166,10 @@ class ServerController extends Controller
/** /**
* Handles downloading a file for the user. * Handles downloading a file for the user.
* *
* @param Request $request * @param \Illuminate\Http\Request $request
* @param string $uuid * @param string $uuid
* @param string $file * @param string $file
* @return \Illuminate\Contracts\View\View * @return \Illuminate\View\View
*/ */
public function getDownloadFile(Request $request, $uuid, $file) public function getDownloadFile(Request $request, $uuid, $file)
{ {
@ -194,6 +187,13 @@ class ServerController extends Controller
return redirect($server->node->scheme . '://' . $server->node->fqdn . ':' . $server->node->daemonListen . '/server/file/download/' . $download->token); return redirect($server->node->scheme . '://' . $server->node->fqdn . ':' . $server->node->daemonListen . '/server/file/download/' . $download->token);
} }
/**
* Returns the allocation overview for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getAllocation(Request $request, $uuid) public function getAllocation(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -209,6 +209,13 @@ class ServerController extends Controller
]); ]);
} }
/**
* Returns the startup overview for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getStartup(Request $request, $uuid) public function getStartup(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -239,6 +246,13 @@ class ServerController extends Controller
]); ]);
} }
/**
* Returns the database overview for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getDatabases(Request $request, $uuid) public function getDatabases(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -254,6 +268,13 @@ class ServerController extends Controller
]); ]);
} }
/**
* Returns the SFTP overview for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getSFTP(Request $request, $uuid) public function getSFTP(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -266,6 +287,13 @@ class ServerController extends Controller
]); ]);
} }
/**
* Handles changing the SFTP password for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\RedirectResponse
*/
public function postSettingsSFTP(Request $request, $uuid) public function postSettingsSFTP(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -287,6 +315,13 @@ class ServerController extends Controller
return redirect()->route('server.settings.sftp', $uuid); return redirect()->route('server.settings.sftp', $uuid);
} }
/**
* Handles changing the startup settings for a server.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\RedirectResponse
*/
public function postSettingsStartup(Request $request, $uuid) public function postSettingsStartup(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);

View file

@ -37,15 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class SubuserController extends Controller class SubuserController extends Controller
{ {
/** /**
* Controller Constructor. * Displays the subuser overview index.
* *
* @return void * @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/ */
public function __construct()
{
//
}
public function getIndex(Request $request, $uuid) public function getIndex(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid)->load('subusers.user'); $server = Models\Server::byUuid($uuid)->load('subusers.user');
@ -60,6 +57,14 @@ class SubuserController extends Controller
]); ]);
} }
/**
* Displays the a single subuser overview.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param int $id
* @return \Illuminate\View\View
*/
public function getView(Request $request, $uuid, $id) public function getView(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid)->load('node'); $server = Models\Server::byUuid($uuid)->load('node');
@ -80,6 +85,14 @@ class SubuserController extends Controller
]); ]);
} }
/**
* Handles editing a subuser.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function postView(Request $request, $uuid, $id) public function postView(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -118,6 +131,13 @@ class SubuserController extends Controller
]); ]);
} }
/**
* Display new subuser creation page.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getNew(Request $request, $uuid) public function getNew(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -130,6 +150,13 @@ class SubuserController extends Controller
]); ]);
} }
/**
* Handles creating a new subuser.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\RedirectResponse
*/
public function postNew(Request $request, $uuid) public function postNew(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -158,6 +185,14 @@ class SubuserController extends Controller
return redirect()->route('server.subusers.new', $uuid)->withInput(); return redirect()->route('server.subusers.new', $uuid)->withInput();
} }
/**
* Handles deleting a subuser.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param int $id
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
*/
public function deleteSubuser(Request $request, $uuid, $id) public function deleteSubuser(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);

View file

@ -35,11 +35,13 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class TaskController extends Controller class TaskController extends Controller
{ {
public function __constructor() /**
{ * Display task index page.
// *
} * @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getIndex(Request $request, $uuid) public function getIndex(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid)->load('tasks'); $server = Models\Server::byUuid($uuid)->load('tasks');
@ -57,6 +59,13 @@ class TaskController extends Controller
]); ]);
} }
/**
* Display new task page.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getNew(Request $request, $uuid) public function getNew(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -69,6 +78,13 @@ class TaskController extends Controller
]); ]);
} }
/**
* Handle creation of new task.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\RedirectResponse
*/
public function postNew(Request $request, $uuid) public function postNew(Request $request, $uuid)
{ {
$server = Models\Server::byUuid($uuid); $server = Models\Server::byUuid($uuid);
@ -93,6 +109,14 @@ class TaskController extends Controller
return redirect()->route('server.tasks.new', $uuid); return redirect()->route('server.tasks.new', $uuid);
} }
/**
* Handle deletion of a task.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param int $id
* @return \Illuminate\Http\JsonResponse
*/
public function deleteTask(Request $request, $uuid, $id) public function deleteTask(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid)->load('tasks'); $server = Models\Server::byUuid($uuid)->load('tasks');
@ -119,6 +143,14 @@ class TaskController extends Controller
} }
} }
/**
* Toggle the status of a task.
*
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param int $id
* @return \Illuminate\Http\JsonResponse
*/
public function toggleTask(Request $request, $uuid, $id) public function toggleTask(Request $request, $uuid, $id)
{ {
$server = Models\Server::byUuid($uuid)->load('tasks'); $server = Models\Server::byUuid($uuid)->load('tasks');

View file

@ -32,14 +32,14 @@ class AdminAuthenticate
/** /**
* The Guard implementation. * The Guard implementation.
* *
* @var Guard * @var \Illuminate\Contracts\Auth\Guard
*/ */
protected $auth; protected $auth;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @return void * @return void
*/ */
public function __construct(Guard $auth) public function __construct(Guard $auth)
@ -51,7 +51,7 @@ class AdminAuthenticate
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View file

@ -10,14 +10,14 @@ class Authenticate
/** /**
* The Guard implementation. * The Guard implementation.
* *
* @var Guard * @var \Illuminate\Contracts\Auth\Guard
*/ */
protected $auth; protected $auth;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @return void * @return void
*/ */
public function __construct(Guard $auth) public function __construct(Guard $auth)
@ -29,7 +29,7 @@ class Authenticate
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View file

@ -35,7 +35,7 @@ class CheckServer
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle(Request $request, Closure $next) public function handle(Request $request, Closure $next)

View file

@ -33,14 +33,14 @@ class DaemonAuthenticate
/** /**
* The Guard implementation. * The Guard implementation.
* *
* @var Guard * @var \Illuminate\Contracts\Auth\Guard
*/ */
protected $auth; protected $auth;
/** /**
* Create a new filter instance. * Create a new filter instance.
* *
* @param Guard $auth * @param \Illuminate\Contracts\Auth\Guard $auth
* @return void * @return void
*/ */
public function __construct(Guard $auth) public function __construct(Guard $auth)
@ -52,7 +52,7 @@ class DaemonAuthenticate
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View file

@ -32,16 +32,11 @@ use Illuminate\Support\Facades\App;
class LanguageMiddleware class LanguageMiddleware
{ {
public function __construct()
{
//
}
/** /**
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next) public function handle($request, Closure $next)

View file

@ -11,8 +11,8 @@ class RedirectIfAuthenticated
* Handle an incoming request. * Handle an incoming request.
* *
* @param \Illuminate\Http\Request $request * @param \Illuminate\Http\Request $request
* @param \Closure $next * @param \Closure $next
* @param string|null $guard * @param string|null $guard
* @return mixed * @return mixed
*/ */
public function handle($request, Closure $next, $guard = null) public function handle($request, Closure $next, $guard = null)

View file

@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
class APIRoutes class APIRoutes
{ {
/**
* API routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
$api = app('Dingo\Api\Routing\Router'); $api = app('Dingo\Api\Routing\Router');

View file

@ -29,6 +29,12 @@ use Illuminate\Routing\Router;
class AdminRoutes class AdminRoutes
{ {
/**
* Admin routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {

View file

@ -30,6 +30,12 @@ use Illuminate\Routing\Router;
class AuthRoutes class AuthRoutes
{ {
/**
* Authentication routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
$router->group([ $router->group([

View file

@ -29,6 +29,12 @@ use Illuminate\Routing\Router;
class BaseRoutes class BaseRoutes
{ {
/**
* Base routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {

View file

@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
class DaemonRoutes class DaemonRoutes
{ {
/**
* Daemon routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
$router->group(['prefix' => 'daemon', 'middleware' => 'daemon'], function () use ($router) { $router->group(['prefix' => 'daemon', 'middleware' => 'daemon'], function () use ($router) {

View file

@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
class LanguageRoutes class LanguageRoutes
{ {
/**
* Language controller routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
$router->get('language/{lang}', [ $router->get('language/{lang}', [

View file

@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
class RemoteRoutes class RemoteRoutes
{ {
/**
* Remote daemon routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
$router->group(['prefix' => 'remote'], function () use ($router) { $router->group(['prefix' => 'remote'], function () use ($router) {

View file

@ -28,6 +28,12 @@ use Illuminate\Routing\Router;
class ServerRoutes class ServerRoutes
{ {
/**
* Server routes.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
public function map(Router $router) public function map(Router $router)
{ {
// Returns Server Status // Returns Server Status

View file

@ -34,15 +34,16 @@ class DeleteServer extends Job implements ShouldQueue
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, SerializesModels;
/** /**
* Id of server to be deleted. * ID of server to be deleted.
* @var object *
* @var int
*/ */
protected $id; protected $id;
/** /**
* Create a new job instance. * Create a new job instance.
* *
* @param int $server * @param int $id
* @return void * @return void
*/ */
public function __construct($id) public function __construct($id)

View file

@ -37,8 +37,14 @@ class SendScheduledTask extends Job implements ShouldQueue
{ {
use InteractsWithQueue, SerializesModels; use InteractsWithQueue, SerializesModels;
/**
* @var \Pterodactyl\Models\Server
*/
protected $server; protected $server;
/**
* @var \Pterodactyl\Models\Task
*/
protected $task; protected $task;
/** /**

View file

@ -35,7 +35,8 @@ class SuspendServer extends Job implements ShouldQueue
/** /**
* ID of associated server model. * ID of associated server model.
* @var object *
* @var int
*/ */
protected $id; protected $id;

View file

@ -49,12 +49,12 @@ class APILog extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'authorized' => 'boolean', 'authorized' => 'boolean',
]; ];
} }

View file

@ -42,14 +42,14 @@ class APIPermission extends Model
*/ */
protected $guarded = ['id']; protected $guarded = ['id'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'key_id' => 'integer', 'key_id' => 'integer',
]; ];
/** /**
* Disable timestamps for this table. * Disable timestamps for this table.

View file

@ -56,7 +56,7 @@ class Allocation extends Model
/** /**
* Accessor to automatically provide the IP alias if defined. * Accessor to automatically provide the IP alias if defined.
* *
* @param null|string $value * @param null|string $value
* @return string * @return string
*/ */
public function getAliasAttribute($value) public function getAliasAttribute($value)
@ -67,7 +67,7 @@ class Allocation extends Model
/** /**
* Accessor to quickly determine if this allocation has an alias. * Accessor to quickly determine if this allocation has an alias.
* *
* @param null|string $value * @param null|string $value
* @return bool * @return bool
*/ */
public function getHasAliasAttribute($value) public function getHasAliasAttribute($value)

View file

@ -51,33 +51,33 @@ class Database extends Model
'server_id', 'database_host_id', 'database', 'username', 'remote', 'server_id', 'database_host_id', 'database', 'username', 'remote',
]; ];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'server_id' => 'integer', 'server_id' => 'integer',
'database_host_id' => 'integer', 'database_host_id' => 'integer',
]; ];
/** /**
* Gets the host database server associated with a database. * Gets the host database server associated with a database.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function host() public function host()
{ {
return $this->belongsTo(DatabaseHost::class, 'database_host_id'); return $this->belongsTo(DatabaseHost::class, 'database_host_id');
} }
/** /**
* Gets the server associated with a database. * Gets the server associated with a database.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function server() public function server()
{ {
return $this->belongsTo(Server::class); return $this->belongsTo(Server::class);
} }
} }

View file

@ -51,34 +51,34 @@ class DatabaseHost extends Model
'name', 'host', 'port', 'username', 'max_databases', 'node_id', 'name', 'host', 'port', 'username', 'max_databases', 'node_id',
]; ];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'max_databases' => 'integer', 'max_databases' => 'integer',
'node_id' => 'integer', 'node_id' => 'integer',
]; ];
/** /**
* Gets the node associated with a database host. * Gets the node associated with a database host.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function node() public function node()
{ {
return $this->belongsTo(Node::class); return $this->belongsTo(Node::class);
} }
/** /**
* Gets the databases assocaited with this host. * Gets the databases assocaited with this host.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function databases() public function databases()
{ {
return $this->hasMany(Database::class); return $this->hasMany(Database::class);
} }
} }

View file

@ -75,6 +75,11 @@ class Node extends Model
'daemonSFTP', 'daemonListen', 'daemonSFTP', 'daemonListen',
]; ];
/**
* Fields that are searchable.
*
* @var array
*/
protected $searchable = [ protected $searchable = [
'columns' => [ 'columns' => [
'nodes.name' => 10, 'nodes.name' => 10,
@ -90,7 +95,7 @@ class Node extends Model
/** /**
* Return an instance of the Guzzle client for this specific node. * Return an instance of the Guzzle client for this specific node.
* *
* @param array $headers * @param array $headers
* @return \GuzzleHttp\Client * @return \GuzzleHttp\Client
*/ */
public function guzzleClient($headers = []) public function guzzleClient($headers = [])
@ -106,8 +111,8 @@ class Node extends Model
/** /**
* Returns the configuration in JSON format. * Returns the configuration in JSON format.
* *
* @param bool $pretty Wether to pretty print the JSON or not * @param bool $pretty
* @return string The configration in JSON format * @return string
*/ */
public function getConfigurationAsJson($pretty = false) public function getConfigurationAsJson($pretty = false)
{ {

View file

@ -83,7 +83,7 @@ class Pack extends Model
/** /**
* Returns all of the archived files for a given pack. * Returns all of the archived files for a given pack.
* *
* @param bool $collection * @param bool $collection
* @return \Illuminate\Support\Collection|object * @return \Illuminate\Support\Collection|object
*/ */
public function files($collection = false) public function files($collection = false)

View file

@ -115,8 +115,11 @@ class Server extends Model
* DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS. * DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS.
* YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS. * YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS.
* *
* @param string $uuid The Short-UUID of the server to return an object about. * @param string $uuid
* @return \Illuminate\Database\Eloquent\Collection * @param array $with
* @param array $withCount
* @return \Pterodactyl\Models\Server
* @todo Remove $with and $withCount due to cache issues, they aren't used anyways.
*/ */
public static function byUuid($uuid, array $with = [], array $withCount = []) public static function byUuid($uuid, array $with = [], array $withCount = [])
{ {
@ -147,7 +150,6 @@ class Server extends Model
/** /**
* Returns non-administrative headers for accessing a server on the daemon. * Returns non-administrative headers for accessing a server on the daemon.
* *
* @param string $uuid
* @return array * @return array
*/ */
public function guzzleHeaders() public function guzzleHeaders()
@ -171,6 +173,8 @@ class Server extends Model
/** /**
* Returns javascript object to be embedded on server view pages with relevant information. * Returns javascript object to be embedded on server view pages with relevant information.
* *
* @param array|null $additional
* @param array|null $overwrite
* @return \Laracasts\Utilities\JavaScript\JavaScriptFacade * @return \Laracasts\Utilities\JavaScript\JavaScriptFacade
*/ */
public function js($additional = null, $overwrite = null) public function js($additional = null, $overwrite = null)

View file

@ -42,63 +42,63 @@ class ServiceOption extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'service_id' => 'integer', 'service_id' => 'integer',
]; ];
/** /**
* Returns the display startup string for the option and will use the parent * Returns the display startup string for the option and will use the parent
* service one if the option does not have one defined. * service one if the option does not have one defined.
* *
* @return string * @return string
*/ */
public function getDisplayStartupAttribute($value) public function getDisplayStartupAttribute($value)
{ {
return (is_null($this->startup)) ? $this->service->startup : $this->startup; return (is_null($this->startup)) ? $this->service->startup : $this->startup;
} }
/** /**
* Gets service associated with a service option. * Gets service associated with a service option.
* *
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/ */
public function service() public function service()
{ {
return $this->belongsTo(Service::class); return $this->belongsTo(Service::class);
} }
/** /**
* Gets all servers associated with this service option. * Gets all servers associated with this service option.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function servers() public function servers()
{ {
return $this->hasMany(Server::class, 'option_id'); return $this->hasMany(Server::class, 'option_id');
} }
/** /**
* Gets all variables associated with this service. * Gets all variables associated with this service.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function variables() public function variables()
{ {
return $this->hasMany(ServiceVariable::class, 'option_id'); return $this->hasMany(ServiceVariable::class, 'option_id');
} }
/** /**
* Gets all packs associated with this service. * Gets all packs associated with this service.
* *
* @return \Illuminate\Database\Eloquent\Relations\HasMany * @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function packs() public function packs()
{ {
return $this->hasMany(Pack::class, 'option_id'); return $this->hasMany(Pack::class, 'option_id');
} }
} }

View file

@ -57,7 +57,7 @@ class ServiceVariable extends Model
* Returns the display executable for the option and will use the parent * Returns the display executable for the option and will use the parent
* service one if the option does not have one defined. * service one if the option does not have one defined.
* *
* @return string * @return bool
*/ */
public function getRequiredAttribute($value) public function getRequiredAttribute($value)
{ {

View file

@ -35,13 +35,13 @@ class Session extends Model
*/ */
protected $table = 'sessions'; protected $table = 'sessions';
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'string', 'id' => 'string',
'user_id' => 'integer', 'user_id' => 'integer',
]; ];
} }

View file

@ -42,16 +42,16 @@ class Task extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'server' => 'integer', 'server' => 'integer',
'queued' => 'integer', 'queued' => 'integer',
]; ];
/** /**
* The attributes that should be mutated to dates. * The attributes that should be mutated to dates.

View file

@ -42,16 +42,16 @@ class TaskLog extends Model
*/ */
protected $guarded = ['id', 'created_at', 'updated_at']; protected $guarded = ['id', 'created_at', 'updated_at'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'id' => 'integer', 'id' => 'integer',
'task_id' => 'integer', 'task_id' => 'integer',
'run_status' => 'integer', 'run_status' => 'integer',
]; ];
/** /**
* The attributes that should be mutated to dates. * The attributes that should be mutated to dates.

View file

@ -70,16 +70,16 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
*/ */
protected $fillable = ['username', 'email', 'name_first', 'name_last', 'password', 'language', 'use_totp', 'totp_secret', 'gravatar', 'root_admin']; protected $fillable = ['username', 'email', 'name_first', 'name_last', 'password', 'language', 'use_totp', 'totp_secret', 'gravatar', 'root_admin'];
/** /**
* Cast values to correct type. * Cast values to correct type.
* *
* @var array * @var array
*/ */
protected $casts = [ protected $casts = [
'root_admin' => 'integer', 'root_admin' => 'integer',
'use_totp' => 'integer', 'use_totp' => 'integer',
'gravatar' => 'integer', 'gravatar' => 'integer',
]; ];
/** /**
* The attributes excluded from the model's JSON form. * The attributes excluded from the model's JSON form.
@ -106,7 +106,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
/** /**
* Enables or disables TOTP on an account if the token is valid. * Enables or disables TOTP on an account if the token is valid.
* *
* @param int $token The token that we want to verify. * @param int $token
* @return bool * @return bool
*/ */
public function toggleTotp($token) public function toggleTotp($token)
@ -116,9 +116,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
} }
$this->use_totp = ! $this->use_totp; $this->use_totp = ! $this->use_totp;
$this->save(); return $this->save();
return true;
} }
/** /**
@ -128,8 +126,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
* - at least one lowercase character * - at least one lowercase character
* - at least one number. * - at least one number.
* *
* @param string $password The raw password to set the account password to. * @param string $password
* @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'. * @param string $regex
* @return void * @return void
*/ */
public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})') public function setPassword($password, $regex = '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})')
@ -156,7 +154,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
/** /**
* Return true or false depending on wether the user is root admin or not. * Return true or false depending on wether the user is root admin or not.
* *
* @return bool the user is root admin * @return bool
*/ */
public function isRootAdmin() public function isRootAdmin()
{ {
@ -165,7 +163,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
/** /**
* Returns the user's daemon secret for a given server. * Returns the user's daemon secret for a given server.
* @param Server $server \Pterodactyl\Models\Server *
* @param \Pterodactyl\Models\Server $server
* @return null|string * @return null|string
*/ */
public function daemonToken(Server $server) public function daemonToken(Server $server)
@ -200,7 +199,9 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
* Returns an array of all servers a user is able to access. * Returns an array of all servers a user is able to access.
* Note: does not account for user admin status. * Note: does not account for user admin status.
* *
* @return Collection * @param int|null $paginate
* @param array $load
* @return \Illuminate\Pagination\LengthAwarePagination|\Illuiminate\Database\Eloquent\Collection
*/ */
public function serverAccessCollection($paginate = null, $load = ['service', 'node', 'allocation']) public function serverAccessCollection($paginate = null, $load = ['service', 'node', 'allocation'])
{ {

View file

@ -36,13 +36,14 @@ class AccountCreated extends Notification implements ShouldQueue
/** /**
* The password reset token to send. * The password reset token to send.
* *
* @var string * @var object
*/ */
public $user; public $user;
/** /**
* Create a new notification instance. * Create a new notification instance.
* *
* @param aray $user
* @return void * @return void
*/ */
public function __construct(array $user) public function __construct(array $user)

View file

@ -33,12 +33,15 @@ class AddedToServer extends Notification implements ShouldQueue
{ {
use Queueable; use Queueable;
/**
* @var object
*/
public $server; public $server;
/** /**
* Create a new notification instance. * Create a new notification instance.
* *
* @param array $server * @param array $server
* @return void * @return void
*/ */
public function __construct(array $server) public function __construct(array $server)

View file

@ -33,12 +33,15 @@ class RemovedFromServer extends Notification implements ShouldQueue
{ {
use Queueable; use Queueable;
/**
* @var object
*/
public $server; public $server;
/** /**
* Create a new notification instance. * Create a new notification instance.
* *
* @param array $server * @param array $server
* @return void * @return void
*/ */
public function __construct(array $server) public function __construct(array $server)

View file

@ -43,6 +43,7 @@ class SendPasswordReset extends Notification implements ShouldQueue
/** /**
* Create a new notification instance. * Create a new notification instance.
* *
* @param string $token
* @return void * @return void
*/ */
public function __construct($token) public function __construct($token)

View file

@ -33,6 +33,9 @@ class ServerCreated extends Notification implements ShouldQueue
{ {
use Queueable; use Queueable;
/**
* @var object
*/
public $server; public $server;
/** /**

View file

@ -40,7 +40,7 @@ class ServerObserver
/** /**
* Listen to the Server creating event. * Listen to the Server creating event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function creating(Server $server) public function creating(Server $server)
@ -51,7 +51,7 @@ class ServerObserver
/** /**
* Listen to the Server created event. * Listen to the Server created event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function created(Server $server) public function created(Server $server)
@ -72,7 +72,7 @@ class ServerObserver
/** /**
* Listen to the Server deleting event. * Listen to the Server deleting event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function deleting(Server $server) public function deleting(Server $server)
@ -85,7 +85,7 @@ class ServerObserver
/** /**
* Listen to the Server deleted event. * Listen to the Server deleted event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function deleted(Server $server) public function deleted(Server $server)
@ -102,7 +102,7 @@ class ServerObserver
/** /**
* Listen to the Server saving event. * Listen to the Server saving event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function saving(Server $server) public function saving(Server $server)
@ -113,7 +113,7 @@ class ServerObserver
/** /**
* Listen to the Server saved event. * Listen to the Server saved event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function saved(Server $server) public function saved(Server $server)
@ -124,7 +124,7 @@ class ServerObserver
/** /**
* Listen to the Server updating event. * Listen to the Server updating event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function updating(Server $server) public function updating(Server $server)
@ -135,7 +135,7 @@ class ServerObserver
/** /**
* Listen to the Server saved event. * Listen to the Server saved event.
* *
* @param Server $server The server model. * @param \Pterodactyl\Models\Server $server
* @return void * @return void
*/ */
public function updated(Server $server) public function updated(Server $server)

View file

@ -34,7 +34,7 @@ class SubuserObserver
/** /**
* Listen to the Subuser creating event. * Listen to the Subuser creating event.
* *
* @param Subuser $subuser The eloquent Subuser model. * @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function creating(Subuser $subuser) public function creating(Subuser $subuser)
@ -45,7 +45,7 @@ class SubuserObserver
/** /**
* Listen to the Subuser created event. * Listen to the Subuser created event.
* *
* @param Subuser $subuser The eloquent Subuser model. * @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function created(Subuser $subuser) public function created(Subuser $subuser)
@ -62,7 +62,7 @@ class SubuserObserver
/** /**
* Listen to the Subuser deleting event. * Listen to the Subuser deleting event.
* *
* @param Subuser $subuser The eloquent Subuser model. * @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function deleting(Subuser $subuser) public function deleting(Subuser $subuser)
@ -73,7 +73,7 @@ class SubuserObserver
/** /**
* Listen to the Subuser deleted event. * Listen to the Subuser deleted event.
* *
* @param Subuser $subuser The eloquent Subuser model. * @param \Pterodactyl\Models\Subuser $subuser
* @return void * @return void
*/ */
public function deleted(Subuser $subuser) public function deleted(Subuser $subuser)

View file

@ -34,7 +34,7 @@ class UserObserver
/** /**
* Listen to the User creating event. * Listen to the User creating event.
* *
* @param User $user The eloquent User model. * @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function creating(User $user) public function creating(User $user)
@ -45,7 +45,7 @@ class UserObserver
/** /**
* Listen to the User created event. * Listen to the User created event.
* *
* @param User $user The eloquent User model. * @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function created(User $user) public function created(User $user)
@ -63,7 +63,7 @@ class UserObserver
/** /**
* Listen to the User deleting event. * Listen to the User deleting event.
* *
* @param User $user The eloquent User model. * @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function deleting(User $user) public function deleting(User $user)
@ -74,7 +74,7 @@ class UserObserver
/** /**
* Listen to the User deleted event. * Listen to the User deleted event.
* *
* @param User $user The eloquent User model. * @param \Pterodactyl\Models\User $user
* @return void * @return void
*/ */
public function deleted(User $user) public function deleted(User $user)

View file

@ -31,22 +31,12 @@ use Pterodactyl\Models\Server;
class ServerPolicy class ServerPolicy
{ {
/**
* Create a new policy instance.
*
* @return void
*/
public function __construct()
{
//
}
/** /**
* Checks if the user has the given permission on/for the server. * Checks if the user has the given permission on/for the server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @param $permission * @param string $permission
* @return bool * @return bool
*/ */
private function checkPermission(User $user, Server $server, $permission) private function checkPermission(User $user, Server $server, $permission)
@ -93,8 +83,8 @@ class ServerPolicy
/** /**
* Check if user has permission to control power for a server. * Check if user has permission to control power for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function power(User $user, Server $server) public function power(User $user, Server $server)
@ -105,8 +95,8 @@ class ServerPolicy
/** /**
* Check if user has permission to start a server. * Check if user has permission to start a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function powerStart(User $user, Server $server) public function powerStart(User $user, Server $server)
@ -117,8 +107,8 @@ class ServerPolicy
/** /**
* Check if user has permission to stop a server. * Check if user has permission to stop a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function powerStop(User $user, Server $server) public function powerStop(User $user, Server $server)
@ -129,8 +119,8 @@ class ServerPolicy
/** /**
* Check if user has permission to restart a server. * Check if user has permission to restart a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function powerRestart(User $user, Server $server) public function powerRestart(User $user, Server $server)
@ -141,8 +131,8 @@ class ServerPolicy
/** /**
* Check if user has permission to kill a server. * Check if user has permission to kill a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function powerKill(User $user, Server $server) public function powerKill(User $user, Server $server)
@ -153,8 +143,8 @@ class ServerPolicy
/** /**
* Check if user has permission to run a command on a server. * Check if user has permission to run a command on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function sendCommand(User $user, Server $server) public function sendCommand(User $user, Server $server)
@ -165,8 +155,8 @@ class ServerPolicy
/** /**
* Check if user has permission to list files on a server. * Check if user has permission to list files on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function listFiles(User $user, Server $server) public function listFiles(User $user, Server $server)
@ -177,8 +167,8 @@ class ServerPolicy
/** /**
* Check if user has permission to edit files on a server. * Check if user has permission to edit files on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function editFiles(User $user, Server $server) public function editFiles(User $user, Server $server)
@ -189,8 +179,8 @@ class ServerPolicy
/** /**
* Check if user has permission to save files on a server. * Check if user has permission to save files on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function saveFiles(User $user, Server $server) public function saveFiles(User $user, Server $server)
@ -201,8 +191,8 @@ class ServerPolicy
/** /**
* Check if user has permission to move and rename files and folders on a server. * Check if user has permission to move and rename files and folders on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function moveFiles(User $user, Server $server) public function moveFiles(User $user, Server $server)
@ -213,8 +203,8 @@ class ServerPolicy
/** /**
* Check if user has permission to copy folders and files on a server. * Check if user has permission to copy folders and files on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function copyFiles(User $user, Server $server) public function copyFiles(User $user, Server $server)
@ -225,8 +215,8 @@ class ServerPolicy
/** /**
* Check if user has permission to compress files and folders on a server. * Check if user has permission to compress files and folders on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function compressFiles(User $user, Server $server) public function compressFiles(User $user, Server $server)
@ -237,8 +227,8 @@ class ServerPolicy
/** /**
* Check if user has permission to decompress files on a server. * Check if user has permission to decompress files on a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function decompressFiles(User $user, Server $server) public function decompressFiles(User $user, Server $server)
@ -249,8 +239,8 @@ class ServerPolicy
/** /**
* Check if user has permission to add files to a server. * Check if user has permission to add files to a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function createFiles(User $user, Server $server) public function createFiles(User $user, Server $server)
@ -262,8 +252,8 @@ class ServerPolicy
* Check if user has permission to upload files to a server. * Check if user has permission to upload files to a server.
* This permission relies on the user having the 'create-files' permission as well due to page authorization. * This permission relies on the user having the 'create-files' permission as well due to page authorization.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function uploadFiles(User $user, Server $server) public function uploadFiles(User $user, Server $server)
@ -274,8 +264,8 @@ class ServerPolicy
/** /**
* Check if user has permission to download files from a server. * Check if user has permission to download files from a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function downloadFiles(User $user, Server $server) public function downloadFiles(User $user, Server $server)
@ -286,8 +276,8 @@ class ServerPolicy
/** /**
* Check if user has permission to delete files from a server. * Check if user has permission to delete files from a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function deleteFiles(User $user, Server $server) public function deleteFiles(User $user, Server $server)
@ -298,8 +288,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view subusers for the server. * Check if user has permission to view subusers for the server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function listSubusers(User $user, Server $server) public function listSubusers(User $user, Server $server)
@ -310,8 +300,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view specific subuser permissions. * Check if user has permission to view specific subuser permissions.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewSubuser(User $user, Server $server) public function viewSubuser(User $user, Server $server)
@ -322,8 +312,8 @@ class ServerPolicy
/** /**
* Check if user has permission to edit a subuser. * Check if user has permission to edit a subuser.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function editSubuser(User $user, Server $server) public function editSubuser(User $user, Server $server)
@ -334,8 +324,8 @@ class ServerPolicy
/** /**
* Check if user has permission to delete a subuser. * Check if user has permission to delete a subuser.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function deleteSubuser(User $user, Server $server) public function deleteSubuser(User $user, Server $server)
@ -346,8 +336,8 @@ class ServerPolicy
/** /**
* Check if user has permission to edit a subuser. * Check if user has permission to edit a subuser.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function createSubuser(User $user, Server $server) public function createSubuser(User $user, Server $server)
@ -358,8 +348,8 @@ class ServerPolicy
/** /**
* Check if user has permission to set the default connection for a server. * Check if user has permission to set the default connection for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function setConnection(User $user, Server $server) public function setConnection(User $user, Server $server)
@ -370,8 +360,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view the startup command used for a server. * Check if user has permission to view the startup command used for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewStartup(User $user, Server $server) public function viewStartup(User $user, Server $server)
@ -382,8 +372,8 @@ class ServerPolicy
/** /**
* Check if user has permission to edit the startup command used for a server. * Check if user has permission to edit the startup command used for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function editStartup(User $user, Server $server) public function editStartup(User $user, Server $server)
@ -394,8 +384,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view the SFTP information for a server. * Check if user has permission to view the SFTP information for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewSftp(User $user, Server $server) public function viewSftp(User $user, Server $server)
@ -406,8 +396,8 @@ class ServerPolicy
/** /**
* Check if user has permission to reset the SFTP password for a server. * Check if user has permission to reset the SFTP password for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function resetSftp(User $user, Server $server) public function resetSftp(User $user, Server $server)
@ -418,8 +408,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view the SFTP password for a server. * Check if user has permission to view the SFTP password for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewSftpPassword(User $user, Server $server) public function viewSftpPassword(User $user, Server $server)
@ -430,8 +420,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view databases for a server. * Check if user has permission to view databases for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewDatabases(User $user, Server $server) public function viewDatabases(User $user, Server $server)
@ -442,8 +432,8 @@ class ServerPolicy
/** /**
* Check if user has permission to reset database passwords. * Check if user has permission to reset database passwords.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function resetDbPassword(User $user, Server $server) public function resetDbPassword(User $user, Server $server)
@ -454,8 +444,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view all tasks for a server. * Check if user has permission to view all tasks for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function listTasks(User $user, Server $server) public function listTasks(User $user, Server $server)
@ -466,8 +456,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view a specific task for a server. * Check if user has permission to view a specific task for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewTask(User $user, Server $server) public function viewTask(User $user, Server $server)
@ -478,8 +468,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view a toggle a task for a server. * Check if user has permission to view a toggle a task for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function toggleTask(User $user, Server $server) public function toggleTask(User $user, Server $server)
@ -490,8 +480,8 @@ class ServerPolicy
/** /**
* Check if user has permission to queue a task for a server. * Check if user has permission to queue a task for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function queueTask(User $user, Server $server) public function queueTask(User $user, Server $server)
@ -502,8 +492,8 @@ class ServerPolicy
/** /**
* Check if user has permission to delete a specific task for a server. * Check if user has permission to delete a specific task for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function deleteTask(User $user, Server $server) public function deleteTask(User $user, Server $server)
@ -514,8 +504,8 @@ class ServerPolicy
/** /**
* Check if user has permission to create a task for a server. * Check if user has permission to create a task for a server.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function createTask(User $user, Server $server) public function createTask(User $user, Server $server)
@ -526,8 +516,8 @@ class ServerPolicy
/** /**
* Check if user has permission to view server allocations. * Check if user has permission to view server allocations.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function viewAllocation(User $user, Server $server) public function viewAllocation(User $user, Server $server)
@ -538,8 +528,8 @@ class ServerPolicy
/** /**
* Check if user has permission to set the default allocation. * Check if user has permission to set the default allocation.
* *
* @param \Pterodactyl\Models\User $user * @param \Pterodactyl\Models\User $user
* @param \Pterodactyl\Models\Server $server * @param \Pterodactyl\Models\Server $server
* @return bool * @return bool
*/ */
public function setAllocation(User $user, Server $server) public function setAllocation(User $user, Server $server)

View file

@ -25,7 +25,5 @@ class AuthServiceProvider extends ServiceProvider
public function boot(GateContract $gate) public function boot(GateContract $gate)
{ {
parent::registerPolicies($gate); parent::registerPolicies($gate);
//
} }
} }

View file

@ -22,7 +22,5 @@ class EventServiceProvider extends ServiceProvider
public function boot() public function boot()
{ {
parent::boot(); parent::boot();
//
} }
} }

View file

@ -19,13 +19,10 @@ class RouteServiceProvider extends ServiceProvider
/** /**
* Define your route model bindings, pattern filters, etc. * Define your route model bindings, pattern filters, etc.
* *
* @param \Illuminate\Routing\Router $router
* @return void * @return void
*/ */
public function boot() public function boot()
{ {
//
parent::boot(); parent::boot();
} }

View file

@ -37,6 +37,7 @@ class APIRepository
{ {
/** /**
* Valid API permissions. * Valid API permissions.
*
* @var array * @var array
*/ */
protected $permissions = [ protected $permissions = [
@ -89,14 +90,23 @@ class APIRepository
/** /**
* Holder for listing of allowed IPs when creating a new key. * Holder for listing of allowed IPs when creating a new key.
*
* @var array * @var array
*/ */
protected $allowed = []; protected $allowed = [];
/**
* The eloquent model for a user.
*
* @var \Pterodactyl\Models\User
*/
protected $user; protected $user;
/** /**
* Constructor. * Constructor for API Repository.
*
* @param null|\Pterodactyl\Models\User $user
* @return void
*/ */
public function __construct(Models\User $user = null) public function __construct(Models\User $user = null)
{ {
@ -109,12 +119,11 @@ class APIRepository
/** /**
* Create a New API Keypair on the system. * Create a New API Keypair on the system.
* *
* @param array $data An array with a permissions and allowed_ips key. * @param array $data
* @return string
* *
* @throws Pterodactyl\Exceptions\DisplayException if there was an error that can be safely displayed to end-users. * @throws \Pterodactyl\Exceptions\DisplayException
* @throws Pterodactyl\Exceptions\DisplayValidationException if there was a validation error. * @throws \Pterodactyl\Exceptions\DisplayValidationException
*
* @return string Returns the generated secret token.
*/ */
public function create(array $data) public function create(array $data)
{ {
@ -213,11 +222,10 @@ class APIRepository
/** /**
* Revokes an API key and associated permissions. * Revokes an API key and associated permissions.
* *
* @param string $key The public key. * @param string $key
*
* @throws Illuminate\Database\Eloquent\ModelNotFoundException
*
* @return void * @return void
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/ */
public function revoke($key) public function revoke($key)
{ {

View file

@ -30,19 +30,32 @@ use Pterodactyl\Exceptions\DisplayException;
class CommandRepository class CommandRepository
{ {
/**
* The Eloquent Model associated with the requested server.
*
* @var \Pterodactyl\Models\Server
*/
protected $server; protected $server;
/**
* Constuctor for repository.
*
* @param int|\Pterodactyl\Models\Server $server
* @return void
*/
public function __construct($server) public function __construct($server)
{ {
$this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server); $this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server);
} }
/** /**
* [send description]. * Sends a command to the daemon.
* @param string $command *
* @return bool * @param string $command
* @throws DisplayException * @return string
* @throws RequestException *
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \GuzzleHttp\Exception\RequestException
*/ */
public function send($command) public function send($command)
{ {

View file

@ -35,14 +35,15 @@ class FileRepository
/** /**
* The Eloquent Model associated with the requested server. * The Eloquent Model associated with the requested server.
* *
* @var \Illuminate\Database\Eloquent\Model * @var \Pterodactyl\Models\Server
*/ */
protected $server; protected $server;
/** /**
* Constructor. * Constructor.
* *
* @param string $server The server Short UUID * @param string $uuid
* @return void
*/ */
public function __construct($uuid) public function __construct($uuid)
{ {
@ -52,8 +53,11 @@ class FileRepository
/** /**
* Get the contents of a requested file for the server. * Get the contents of a requested file for the server.
* *
* @param string $file * @param string $file
* @return array * @return array
*
* @throws \GuzzleHttp\Exception\RequestException
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function returnFileContents($file) public function returnFileContents($file)
{ {
@ -95,9 +99,12 @@ class FileRepository
/** /**
* Save the contents of a requested file on the daemon. * Save the contents of a requested file on the daemon.
* *
* @param string $file * @param string $file
* @param string $content * @param string $content
* @return bool * @return bool
*
* @throws \GuzzleHttp\Exception\RequestException
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function saveFileContents($file, $content) public function saveFileContents($file, $content)
{ {
@ -125,8 +132,11 @@ class FileRepository
/** /**
* Returns a listing of all files and folders within a specified directory on the daemon. * Returns a listing of all files and folders within a specified directory on the daemon.
* *
* @param string $directory * @param string $directory
* @return object * @return object
*
* @throws \GuzzleHttp\Exception\RequestException
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function returnDirectoryListing($directory) public function returnDirectoryListing($directory)
{ {

View file

@ -29,13 +29,33 @@ use Pterodactyl\Exceptions\DisplayException;
class PowerRepository class PowerRepository
{ {
/**
* The Eloquent Model associated with the requested server.
*
* @var \Pterodactyl\Models\Server
*/
protected $server; protected $server;
/**
* Constuctor for repository.
*
* @param int|\Pterodactyl\Models\Server $server
* @return void
*/
public function __construct($server) public function __construct($server)
{ {
$this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server); $this->server = ($server instanceof Models\Server) ? $server : Models\Server::findOrFail($server);
} }
/**
* Sends a power option to the daemon.
*
* @param string $action
* @return string
*
* @throws \GuzzleHttp\Exception\RequestException
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function do($action) public function do($action)
{ {
// We don't use the user's specific daemon secret here since we // We don't use the user's specific daemon secret here since we
@ -58,21 +78,41 @@ class PowerRepository
} }
} }
/**
* Starts a server.
*
* @return void
*/
public function start() public function start()
{ {
$this->do('start'); $this->do('start');
} }
/**
* Stops a server.
*
* @return void
*/
public function stop() public function stop()
{ {
$this->do('stop'); $this->do('stop');
} }
/**
* Restarts a server.
*
* @return void
*/
public function restart() public function restart()
{ {
$this->do('restart'); $this->do('restart');
} }
/**
* Kills a server.
*
* @return void
*/
public function kill() public function kill()
{ {
$this->do('kill'); $this->do('kill');

View file

@ -39,8 +39,8 @@ class DatabaseRepository
/** /**
* Adds a new database to a specified database host server. * Adds a new database to a specified database host server.
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Database * @return \Pterodactyl\Models\Database
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
@ -128,8 +128,8 @@ class DatabaseRepository
/** /**
* Updates the password for a given database. * Updates the password for a given database.
* *
* @param int $id * @param int $id
* @param string $password * @param string $password
* @return void * @return void
* *
* @todo Fix logic behind resetting passwords. * @todo Fix logic behind resetting passwords.
@ -174,7 +174,7 @@ class DatabaseRepository
/** /**
* Drops a database from the associated database host. * Drops a database from the associated database host.
* *
* @param int $id * @param int $id
* @return void * @return void
*/ */
public function drop($id) public function drop($id)
@ -204,7 +204,7 @@ class DatabaseRepository
/** /**
* Deletes a database host from the system if it has no associated databases. * Deletes a database host from the system if it has no associated databases.
* *
* @param int $server * @param int $id
* @return void * @return void
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
@ -223,7 +223,7 @@ class DatabaseRepository
/** /**
* Adds a new Database Host to the system. * Adds a new Database Host to the system.
* *
* @param array $data * @param array $data
* @return \Pterodactyl\Models\DatabaseHost * @return \Pterodactyl\Models\DatabaseHost
* *
* @throws \Pterodactyl\Exceptions\DisplayValidationException * @throws \Pterodactyl\Exceptions\DisplayValidationException
@ -281,8 +281,8 @@ class DatabaseRepository
/** /**
* Updates a Database Host on the system. * Updates a Database Host on the system.
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return \Pterodactyl\Models\DatabaseHost * @return \Pterodactyl\Models\DatabaseHost
* *
* @throws \Pterodactyl\Exceptions\DisplayValidationException * @throws \Pterodactyl\Exceptions\DisplayValidationException

View file

@ -28,6 +28,7 @@ class HelperRepository
{ {
/** /**
* Listing of editable files in the control panel. * Listing of editable files in the control panel.
*
* @var array * @var array
*/ */
protected static $editable = [ protected static $editable = [
@ -44,17 +45,13 @@ class HelperRepository
'inode/x-empty', 'inode/x-empty',
]; ];
public function __construct()
{
//
}
/** /**
* Converts from bytes to the largest possible size that is still readable. * Converts from bytes to the largest possible size that is still readable.
* *
* @param int $bytes * @param int $bytes
* @param int $decimals * @param int $decimals
* @return string * @return string
* @deprecated
*/ */
public static function bytesToHuman($bytes, $decimals = 2) public static function bytesToHuman($bytes, $decimals = 2)
{ {
@ -64,6 +61,11 @@ class HelperRepository
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . $sz[$factor]; return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . ' ' . $sz[$factor];
} }
/**
* Returns array of editable files.
*
* @return array
*/
public static function editableFiles() public static function editableFiles()
{ {
return self::$editable; return self::$editable;

View file

@ -35,8 +35,9 @@ class LocationRepository
* Creates a new location on the system. * Creates a new location on the system.
* *
* @param array $data * @param array $data
* @throws \Pterodactyl\Exceptions\DisplayValidationException
* @return \Pterodactyl\Models\Location * @return \Pterodactyl\Models\Location
*
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function create(array $data) public function create(array $data)
{ {
@ -58,11 +59,11 @@ class LocationRepository
/** /**
* Modifies a location. * Modifies a location.
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Location * @return \Pterodactyl\Models\Location
* *
* @throws Pterodactyl\Exceptions\DisplayValidationException * @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function update($id, array $data) public function update($id, array $data)
{ {
@ -85,10 +86,10 @@ class LocationRepository
/** /**
* Deletes a location from the system. * Deletes a location from the system.
* *
* @param int $id * @param int $id
* @return void * @return void
* *
* @throws Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function delete($id) public function delete($id)
{ {

View file

@ -34,11 +34,15 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class NodeRepository class NodeRepository
{ {
public function __construct() /**
{ * Creates a new node on the system.
// *
} * @param array $data
* @return \Pterodactyl\Models\Node
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function create(array $data) public function create(array $data)
{ {
// Validate Fields // Validate Fields
@ -84,6 +88,16 @@ class NodeRepository
return Models\Node::create($data); return Models\Node::create($data);
} }
/**
* Updates a node on the system.
*
* @param int $id
* @param array $data
* @return \Pterodactyl\Models\Node
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function update($id, array $data) public function update($id, array $data)
{ {
$node = Models\Node::findOrFail($id); $node = Models\Node::findOrFail($id);
@ -179,8 +193,13 @@ class NodeRepository
/** /**
* Adds allocations to a provided node. * Adds allocations to a provided node.
* @param int $id *
* @param array $data * @param int $id
* @param array $data
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function addAllocations($id, array $data) public function addAllocations($id, array $data)
{ {
@ -243,6 +262,14 @@ class NodeRepository
}); });
} }
/**
* Deletes a node on the system.
*
* @param int $id
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function delete($id) public function delete($id)
{ {
$node = Models\Node::withCount('servers')->findOrFail($id); $node = Models\Node::withCount('servers')->findOrFail($id);

View file

@ -73,7 +73,7 @@ class OptionRepository
/** /**
* Deletes a service option from the system. * Deletes a service option from the system.
* *
* @param int $id * @param int $id
* @return void * @return void
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException

View file

@ -38,7 +38,7 @@ class PackRepository
/** /**
* Creates a new pack on the system. * Creates a new pack on the system.
* *
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Pack * @return \Pterodactyl\Models\Pack
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
@ -101,7 +101,7 @@ class PackRepository
/** /**
* Creates a new pack on the system given a template file. * Creates a new pack on the system given a template file.
* *
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Pack * @return \Pterodactyl\Models\Pack
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
@ -173,8 +173,8 @@ class PackRepository
/** /**
* Updates a pack on the system. * Updates a pack on the system.
* *
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Pack * @return \Pterodactyl\Models\Pack
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException

View file

@ -37,21 +37,21 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class ServerRepository class ServerRepository
{ {
/**
* An array of daemon permission to assign to this server.
*
* @var array
*/
protected $daemonPermissions = [ protected $daemonPermissions = [
's:*', 's:*',
]; ];
public function __construct()
{
//
}
/** /**
* Generates a SFTP username for a server given a server name. * Generates a SFTP username for a server given a server name.
* format: mumble_67c7a4b0. * format: mumble_67c7a4b0.
* *
* @param string $name * @param string $name
* @param string $identifier * @param null|string $identifier
* @return string * @return string
*/ */
protected function generateSFTPUsername($name, $identifier = null) protected function generateSFTPUsername($name, $identifier = null)
@ -75,8 +75,12 @@ class ServerRepository
/** /**
* Adds a new server to the system. * Adds a new server to the system.
* @param array $data An array of data descriptors for creating the server. These should align to the columns in the database. *
* @return int * @param array $data
* @return \Pterodactyl\Models\Server
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function create(array $data) public function create(array $data)
{ {
@ -341,10 +345,14 @@ class ServerRepository
} }
/** /**
* [updateDetails description]. * Update the details for a server.
* @param int $id *
* @param array $data * @param int $id
* @param array $data
* @return bool * @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function updateDetails($id, array $data) public function updateDetails($id, array $data)
{ {
@ -424,10 +432,14 @@ class ServerRepository
} }
/** /**
* [updateContainer description]. * Update the container for a server.
* @param int $id *
* @param array $data * @param int $id
* @param array $data
* @return bool * @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function updateContainer($id, array $data) public function updateContainer($id, array $data)
{ {
@ -472,10 +484,14 @@ class ServerRepository
} }
/** /**
* [changeBuild description]. * Update the build details for a server.
* @param int $id *
* @param array $data * @param int $id
* @return bool * @param array $data
* @return \Pterodactyl\Models\Server
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function changeBuild($id, array $data) public function changeBuild($id, array $data)
{ {
@ -614,6 +630,18 @@ class ServerRepository
} }
} }
/**
* Update the startup details for a server.
*
* @param int $id
* @param array $data
* @param bool $admin
* @return void
*
* @throws \GuzzleHttp\Exception\RequestException
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function updateStartup($id, array $data, $admin = false) public function updateStartup($id, array $data, $admin = false)
{ {
$server = Models\Server::with('variables', 'option.variables')->findOrFail($id); $server = Models\Server::with('variables', 'option.variables')->findOrFail($id);
@ -691,25 +719,34 @@ class ServerRepository
}); });
} }
/**
* Queue a server for deletion
*
* @param int $id
* @param bool $force
* @return void
*/
public function queueDeletion($id, $force = false) public function queueDeletion($id, $force = false)
{ {
$server = Models\Server::findOrFail($id); $server = Models\Server::findOrFail($id);
DB::beginTransaction();
try { DB::transaction(function () use ($force, $server) {
if ($force) { $server->installed = $force ? 3 : $server->installed;
$server->installed = 3; $server->save();
$server->save();
}
$server->delete(); $server->delete();
});
return DB::commit();
} catch (\Exception $ex) {
DB::rollBack();
throw $ex;
}
} }
/**
* Delete a server from the system permanetly.
*
* @param int $id
* @param bool $force
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function delete($id, $force = false) public function delete($id, $force = false)
{ {
$server = Models\Server::withTrashed()->with('node', 'allocations', 'variables')->findOrFail($id); $server = Models\Server::withTrashed()->with('node', 'allocations', 'variables')->findOrFail($id);
@ -774,6 +811,12 @@ class ServerRepository
}); });
} }
/**
* Cancel the deletion of a server.
*
* @param int $id
* @return void
*/
public function cancelDeletion($id) public function cancelDeletion($id)
{ {
$server = Models\Server::withTrashed()->findOrFail($id); $server = Models\Server::withTrashed()->findOrFail($id);
@ -783,6 +826,14 @@ class ServerRepository
$server->save(); $server->save();
} }
/**
* Toggle the install status of a serve.
*
* @param int $id
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function toggleInstall($id) public function toggleInstall($id)
{ {
$server = Models\Server::findOrFail($id); $server = Models\Server::findOrFail($id);
@ -795,9 +846,13 @@ class ServerRepository
} }
/** /**
* Suspends a server instance making it unable to be booted or used by a user. * Suspends a server.
* @param int $id *
* @return bool * @param int $id
* @param bool $deleted
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function suspend($id, $deleted = false) public function suspend($id, $deleted = false)
{ {
@ -831,9 +886,12 @@ class ServerRepository
} }
/** /**
* Unsuspends a server instance. * Unsuspends a server.
* @param int $id *
* @return bool * @param int $id
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function unsuspend($id) public function unsuspend($id)
{ {
@ -866,6 +924,16 @@ class ServerRepository
} }
} }
/**
* Updates the SFTP password for a server.
*
* @param int $id
* @param string $password
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function updateSFTPPassword($id, $password) public function updateSFTPPassword($id, $password)
{ {
$server = Models\Server::with('node')->findOrFail($id); $server = Models\Server::with('node')->findOrFail($id);

Some files were not shown because too many files have changed in this diff Show more