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)

View file

@ -35,7 +35,7 @@ class PhraseAppTranslator extends LaravelTranslator
* @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,7 +54,7 @@ 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
*/ */
@ -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,7 +51,7 @@ 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
*/ */
@ -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,7 +259,7 @@ 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
*/ */
@ -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,7 +302,7 @@ 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
*/ */
@ -334,7 +328,7 @@ 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
*/ */
@ -360,7 +354,7 @@ 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
*/ */

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,7 +116,7 @@ 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
*/ */
@ -128,7 +128,7 @@ 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
*/ */
@ -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,7 +117,7 @@ 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
*/ */
@ -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,7 +140,7 @@ 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
*/ */
@ -152,7 +152,7 @@ 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
*/ */
@ -166,7 +166,7 @@ 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
*/ */
@ -184,7 +184,7 @@ 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
*/ */
@ -203,7 +203,7 @@ 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
*/ */
@ -220,7 +220,7 @@ 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
*/ */
@ -232,7 +232,7 @@ 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
*/ */
@ -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 \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @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 \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @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 \Illuminate\Http\Request $request
* @param int $id * @param int $id
* @return \Illuminate\Response\RedirectResponse * @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,7 +62,7 @@ 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
*/ */
@ -76,7 +76,7 @@ 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
*/ */
@ -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

@ -39,7 +39,7 @@ 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 * @param \Illuminate\Http\Request $request
* @return void * @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)
{ {
@ -55,7 +47,9 @@ 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

@ -37,7 +37,7 @@ 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)
{ {
@ -51,7 +51,7 @@ class SecurityController extends Controller
* 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)
{ {
@ -96,7 +96,7 @@ 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)
{ {
@ -64,7 +57,8 @@ 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

@ -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)
{ {
@ -97,8 +89,8 @@ 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,7 +139,7 @@ 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
*/ */
@ -172,10 +164,12 @@ class AjaxController extends Controller
} }
/** /**
* [postSetPrimary description]. * Sets the primary allocation for a server.
* @param Request $request *
* @param \Illuminate\Http\Request $request
* @param string $uuid * @param string $uuid
* @return \Illuminate\Http\Response * @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)

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)

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)

View file

@ -32,11 +32,6 @@ use Illuminate\Support\Facades\App;
class LanguageMiddleware class LanguageMiddleware
{ {
public function __construct()
{
//
}
/** /**
* Handle an incoming request. * Handle an incoming request.
* *

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

@ -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,
@ -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

@ -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

@ -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

@ -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,6 +33,9 @@ class AddedToServer extends Notification implements ShouldQueue
{ {
use Queueable; use Queueable;
/**
* @var object
*/
public $server; public $server;
/** /**

View file

@ -33,6 +33,9 @@ class RemovedFromServer extends Notification implements ShouldQueue
{ {
use Queueable; use Queueable;
/**
* @var object
*/
public $server; public $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)

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 * @param string $command
* @return bool * @return string
* @throws DisplayException *
* @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)
{ {
@ -54,6 +55,9 @@ class FileRepository
* *
* @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)
{ {
@ -98,6 +102,9 @@ class FileRepository
* @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)
{ {
@ -127,6 +134,9 @@ class FileRepository
* *
* @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

@ -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

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)
{ {
@ -62,7 +63,7 @@ class LocationRepository
* @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)
{ {
@ -88,7 +89,7 @@ class LocationRepository
* @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 int $id
* @param array $data * @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

@ -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 int $id
* @param array $data * @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 int $id
* @param array $data * @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 int $id
* @param array $data * @param array $data
* @return bool * @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 * @param int $id
* @return bool * @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 * @param int $id
* @return bool * @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);

View file

@ -37,6 +37,8 @@ class ServiceRepository
* *
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Service * @return \Pterodactyl\Models\Service
*
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function create(array $data) public function create(array $data)
{ {
@ -80,6 +82,8 @@ class ServiceRepository
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return \Pterodactyl\Models\Service * @return \Pterodactyl\Models\Service
*
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function update($id, array $data) public function update($id, array $data)
{ {
@ -109,6 +113,8 @@ class ServiceRepository
* *
* @param int $id * @param int $id
* @return void * @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function delete($id) public function delete($id)
{ {

View file

@ -37,6 +37,7 @@ class SubuserRepository
* Core permissions required for every subuser on the daemon. * Core permissions required for every subuser on the daemon.
* Without this we cannot connect the websocket or get basic * Without this we cannot connect the websocket or get basic
* information about the server. * information about the server.
*
* @var array * @var array
*/ */
protected $coreDaemonPermissions = [ protected $coreDaemonPermissions = [
@ -46,6 +47,7 @@ class SubuserRepository
/** /**
* Allowed permissions and their related daemon permission. * Allowed permissions and their related daemon permission.
*
* @var array * @var array
*/ */
protected $permissions = [ protected $permissions = [
@ -99,18 +101,15 @@ class SubuserRepository
'reset-db-password' => null, 'reset-db-password' => null,
]; ];
public function __construct()
{
//
}
/** /**
* Creates a new subuser on the server. * Creates a new subuser on the server.
* @param int $id The ID of the server to add this subuser to. *
* @param int $sid
* @param array $data * @param array $data
* @throws DisplayValidationException
* @throws DisplayException
* @return \Pterodactyl\Models\Subuser * @return \Pterodactyl\Models\Subuser
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function create($sid, array $data) public function create($sid, array $data)
{ {
@ -202,11 +201,11 @@ class SubuserRepository
/** /**
* Revokes a users permissions on a server. * Revokes a users permissions on a server.
* @param int $id The ID of the subuser row in MySQL. *
* @param array $data * @param int $id
* @throws DisplayValidationException
* @throws DisplayException
* @return void * @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function delete($id) public function delete($id)
{ {
@ -232,8 +231,6 @@ class SubuserRepository
} }
$subuser->delete(); $subuser->delete();
DB::commit(); DB::commit();
return true;
} catch (\GuzzleHttp\Exception\TransferException $ex) { } catch (\GuzzleHttp\Exception\TransferException $ex) {
DB::rollBack(); DB::rollBack();
throw new DisplayException('There was an error attempting to connect to the daemon to delete this subuser.', $ex); throw new DisplayException('There was an error attempting to connect to the daemon to delete this subuser.', $ex);
@ -241,17 +238,17 @@ class SubuserRepository
DB::rollBack(); DB::rollBack();
throw $ex; throw $ex;
} }
return false;
} }
/** /**
* Updates permissions for a given subuser. * Updates permissions for a given subuser.
* @param int $id The ID of the subuser row in MySQL. (Not the user ID) *
* @param int $id
* @param array $data * @param array $data
* @throws DisplayValidationException
* @throws DisplayException
* @return void * @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function update($id, array $data) public function update($id, array $data)
{ {
@ -304,8 +301,6 @@ class SubuserRepository
]); ]);
DB::commit(); DB::commit();
return true;
} catch (\GuzzleHttp\Exception\TransferException $ex) { } catch (\GuzzleHttp\Exception\TransferException $ex) {
DB::rollBack(); DB::rollBack();
throw new DisplayException('There was an error attempting to connect to the daemon to update permissions.', $ex); throw new DisplayException('There was an error attempting to connect to the daemon to update permissions.', $ex);
@ -313,7 +308,5 @@ class SubuserRepository
DB::rollBack(); DB::rollBack();
throw $ex; throw $ex;
} }
return false;
} }
} }

View file

@ -32,6 +32,11 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class TaskRepository class TaskRepository
{ {
/**
* The default values to use for new tasks.
*
* @var array
*/
protected $defaults = [ protected $defaults = [
'year' => '*', 'year' => '*',
'day_of_week' => '*', 'day_of_week' => '*',
@ -41,20 +46,20 @@ class TaskRepository
'minute' => '*/30', 'minute' => '*/30',
]; ];
/**
* Task action types.
*
* @var array
*/
protected $actions = [ protected $actions = [
'command', 'command',
'power', 'power',
]; ];
public function __construct()
{
//
}
/** /**
* Deletes a given task. * Deletes a given task.
* @param int $id
* *
* @param int $id
* @return bool * @return bool
*/ */
public function delete($id) public function delete($id)
@ -71,8 +76,8 @@ class TaskRepository
/** /**
* Toggles a task active or inactive. * Toggles a task active or inactive.
* @param int $id
* *
* @param int $id
* @return int * @return int
*/ */
public function toggle($id) public function toggle($id)
@ -91,12 +96,13 @@ class TaskRepository
/** /**
* Create a new scheduled task for a given server. * Create a new scheduled task for a given server.
*
* @param int $id * @param int $id
* @param array $data * @param array $data
* @return bool
* *
* @throws DisplayException * @throws \Pterodactyl\Exceptions\DisplayException
* @throws DisplayValidationException * @throws \Pterodactyl\Exceptions\DisplayValidationException
* @return void
*/ */
public function create($id, $data) public function create($id, $data)
{ {

View file

@ -38,19 +38,13 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class UserRepository class UserRepository
{ {
public function __construct()
{
//
}
/** /**
* Creates a user on the panel. Returns the created user's ID. * Creates a user on the panel. Returns the created user's ID.
* *
* @param string $email * @param array $data
* @param string|null $password An unhashed version of the user's password. * @return \Pterodactyl\Models\User
* @param bool $admin Boolean value if user should be an admin or not. *
* @param int $token A custom user ID. * @throws \Pterodactyl\Exceptions\DisplayValidationException
* @return bool|int
*/ */
public function create(array $data) public function create(array $data)
{ {
@ -119,8 +113,10 @@ class UserRepository
* Updates a user on the panel. * Updates a user on the panel.
* *
* @param int $id * @param int $id
* @param array $data An array of columns and their associated values to update for the user. * @param array $data
* @return bool * @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/ */
public function update($id, array $data) public function update($id, array $data)
{ {
@ -157,10 +153,13 @@ class UserRepository
} }
/** /**
* Deletes a user on the panel, returns the number of records deleted. * Deletes a user on the panel.
* *
* @param int $id * @param int $id
* @return int * @return void
* @todo Move user self-deletion checking to the controller, rather than the repository.
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/ */
public function delete($id) public function delete($id)
{ {
@ -168,8 +167,7 @@ class UserRepository
throw new DisplayException('Cannot delete a user with active servers attached to thier account.'); throw new DisplayException('Cannot delete a user with active servers attached to thier account.');
} }
// @TODO: this should probably be checked outside of this method because we won't always have Auth::user() if (! is_null(Auth::user()) && (int) Auth::user()->id === (int) $id) {
if (! is_null(Auth::user()) && Auth::user()->id === $id) {
throw new DisplayException('Cannot delete your own account.'); throw new DisplayException('Cannot delete your own account.');
} }
@ -186,8 +184,6 @@ class UserRepository
Models\User::destroy($id); Models\User::destroy($id);
DB::commit(); DB::commit();
return true;
} catch (\Exception $ex) { } catch (\Exception $ex) {
DB::rollBack(); DB::rollBack();
throw $ex; throw $ex;

View file

@ -30,11 +30,14 @@ use Pterodactyl\Models\APILog;
class APILogService class APILogService
{ {
public function __constructor() /**
{ * Log an API Request
// *
} * @param \Illuminate\Http\Request $request
* @param null|string $error
* @param bool $authorized
* @return void
*/
public static function log(Request $request, $error = null, $authorized = false) public static function log(Request $request, $error = null, $authorized = false)
{ {
if ($request->bearerToken() && ! empty($request->bearerToken())) { if ($request->bearerToken() && ! empty($request->bearerToken())) {

View file

@ -30,20 +30,13 @@ use Pterodactyl\Exceptions\DisplayException;
class DeploymentService class DeploymentService
{ {
public function __constructor()
{
//
}
/** /**
* Return a random location model. DO NOT USE. * Return a random location model. DO NOT USE.
* @return \Pterodactyl\Models\Node
* *
* @TODO Actually make this smarter. If we're selecting a random location * @return \Pterodactyl\Models\Node
* @todo Actually make this smarter. If we're selecting a random location
* but then it has no nodes we should probably continue attempting all locations * but then it has no nodes we should probably continue attempting all locations
* until we hit one. * until we hit one.
*
* Currently you should just pick a location and go from there.
*/ */
public static function randomLocation() public static function randomLocation()
{ {
@ -78,7 +71,7 @@ class DeploymentService
* over allocation limits. * over allocation limits.
* @param int $memory * @param int $memory
* @param int $disk * @param int $disk
* @param int $location * @param null|int $location
* @return \Pterodactyl\Models\Node * @return \Pterodactyl\Models\Node
* *
* @throws \Pterodactyl\Exceptions\DisplayException * @throws \Pterodactyl\Exceptions\DisplayException

View file

@ -29,21 +29,13 @@ use Uuid;
class UuidService class UuidService
{ {
/**
* Constructor.
*/
public function __construct()
{
//
}
/** /**
* Generate a unique UUID validating against specified table and column. * Generate a unique UUID validating against specified table and column.
* Defaults to `users.uuid`. * Defaults to `users.uuid`.
* *
* @param string $table * @param string $table
* @param string $field * @param string $field
* @param int $type The type of UUID to generate. * @param int $type
* @return string * @return string
*/ */
public function generate($table = 'users', $field = 'uuid', $type = 4) public function generate($table = 'users', $field = 'uuid', $type = 4)
@ -64,6 +56,7 @@ class UuidService
* *
* @param string $table * @param string $table
* @param string $field * @param string $field
* @param null|string $attachedUuid
* @return string * @return string
*/ */
public function generateShort($table = 'servers', $field = 'uuidShort', $attachedUuid = null) public function generateShort($table = 'servers', $field = 'uuidShort', $attachedUuid = null)

View file

@ -29,10 +29,17 @@ use GuzzleHttp\Client;
class VersionService class VersionService
{ {
/**
* The cached CDN response.
*
* @var object
*/
protected static $versions; protected static $versions;
/** /**
* Constructor. * Version constructor.
*
* @return void
*/ */
public function __construct() public function __construct()
{ {
@ -58,26 +65,51 @@ class VersionService
}); });
} }
/**
* Return current panel version from CDN.
*
* @return string
*/
public static function getPanel() public static function getPanel()
{ {
return self::$versions->panel; return self::$versions->panel;
} }
/**
* Return current daemon version from CDN.
*
* @return string
*/
public static function getDaemon() public static function getDaemon()
{ {
return self::$versions->daemon; return self::$versions->daemon;
} }
/**
* Return Discord link from CDN.
*
* @return string
*/
public static function getDiscord() public static function getDiscord()
{ {
return self::$versions->discord; return self::$versions->discord;
} }
/**
* Return current panel version.
*
* @return null|string
*/
public function getCurrentPanel() public function getCurrentPanel()
{ {
return config('app.version'); return config('app.version');
} }
/**
* Determine if panel is latest version.
*
* @return bool
*/
public static function isLatestPanel() public static function isLatestPanel()
{ {
if (config('app.version') === 'canary') { if (config('app.version') === 'canary') {
@ -87,6 +119,11 @@ class VersionService
return version_compare(config('app.version'), self::$versions->panel) >= 0; return version_compare(config('app.version'), self::$versions->panel) >= 0;
} }
/**
* Determine if daemon is latest version.
*
* @return bool
*/
public static function isLatestDaemon($daemon) public static function isLatestDaemon($daemon)
{ {
if ($daemon === '0.0.0-canary') { if ($daemon === '0.0.0-canary') {

View file

@ -1,41 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Transformers;
use Pterodactyl\Models\Allocation;
use League\Fractal\TransformerAbstract;
class AllocationTransformer extends TransformerAbstract
{
/**
* Turn this item object into a generic array.
*
* @return array
*/
public function transform(Allocation $allocation)
{
return array_except($allocation, ['created_at', 'updated_at']);
}
}

View file

@ -1,41 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Transformers;
use Pterodactyl\Models\Node;
use League\Fractal\TransformerAbstract;
class NodeTransformer extends TransformerAbstract
{
/**
* Turn this item object into a generic array.
*
* @return array
*/
public function transform(Node $node)
{
return $node;
}
}

View file

@ -1,41 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Transformers;
use Pterodactyl\Models\Server;
use League\Fractal\TransformerAbstract;
class ServerTransformer extends TransformerAbstract
{
/**
* Turn this item object into a generic array.
*
* @return array
*/
public function transform(Server $server)
{
return $server;
}
}

View file

@ -1,41 +0,0 @@
<?php
/**
* Pterodactyl - Panel
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Pterodactyl\Transformers;
use Pterodactyl\Models\User;
use League\Fractal\TransformerAbstract;
class UserTransformer extends TransformerAbstract
{
/**
* Turn this item object into a generic array.
*
* @return array
*/
public function transform(User $user)
{
return $user;
}
}