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/*
composer.lock
Homestead.yaml
Vagrantfile
Vagrantfile
node_modules
yarn.lock
node_modules
_ide_helper_models.php
_ide_helper.php
sami.phar
sami.config.php
/sami

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -28,20 +28,19 @@ use Log;
class DisplayException extends \Exception
{
private $_logging = null;
/**
* Exception constructor.
*
* @param string $message
* @param mixed $log
* @return void
*/
public function __construct($message, $log = null)
{
$this->_logging = $log;
if ($this->_logging !== null) {
if (! is_null($log)) {
Log::error($log);
}
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.
*
* @param \Exception $e
* @param \Exception $exception
* @return void
*/
public function report(Exception $exception)
@ -41,7 +41,7 @@ class Handler extends ExceptionHandler
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
@ -60,7 +60,7 @@ class Handler extends ExceptionHandler
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/

View file

@ -31,11 +31,11 @@ class PhraseAppTranslator extends LaravelTranslator
/**
* Get the translation for the given key.
*
* @param string $key
* @param array $replace
* @param string $key
* @param array $replace
* @param string|null $locale
* @param bool $fallback
* @return string|array|null
* @param bool $fallback
* @return string
*/
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
{
/**
* Returns the facade accessor class.
*
* @return strig
*/
protected static function getFacadeAccessor()
{
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.
*
* @param Request $request
* @param int $id
* @return array
*/
public function allocationsView(Request $request, $id)

View file

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

View file

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

View file

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

View file

@ -41,7 +41,7 @@ class OptionController extends Controller
/**
* Handles request to view page for adding new option.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function new(Request $request)
@ -55,7 +55,7 @@ class OptionController extends Controller
/**
* Handles POST request to create a new option.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Response\RedirectResponse
*/
public function create(Request $request)
@ -86,9 +86,9 @@ class OptionController extends Controller
/**
* Handles POST request to create a new option variable.
*
* @param Request $request
* @param int $id The ID of the service option to assign this variable to.
* @return \Illuminate\Response\RedirectResponse
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function createVariable(Request $request, $id)
{
@ -116,8 +116,8 @@ class OptionController extends Controller
/**
* Display option overview page.
*
* @param Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\View\View
*/
public function viewConfiguration(Request $request, $id)
@ -128,8 +128,8 @@ class OptionController extends Controller
/**
* Display variable overview page for a service option.
*
* @param Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\View\View
*/
public function viewVariables(Request $request, $id)
@ -140,8 +140,9 @@ class OptionController extends Controller
/**
* Handles POST when editing a configration for a service option.
*
* @param Request $request
* @return \Illuminate\Response\RedirectResponse
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
public function editConfiguration(Request $request, $id)
{
@ -176,10 +177,10 @@ class OptionController extends Controller
/**
* Handles POST when editing a configration for a service option.
*
* @param Request $request
* @param int $option
* @param int $variable
* @return \Illuminate\Response\RedirectResponse
* @param \Illuminate\Http\Request $request
* @param int $option
* @param int $variable
* @return \Illuminate\Http\RedirectResponse
*/
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.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request)
@ -57,7 +57,7 @@ class PackController extends Controller
/**
* Display new pack creation form.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function new(Request $request)
@ -70,7 +70,7 @@ class PackController extends Controller
/**
* Display new pack creation modal for use with template upload.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function newTemplate(Request $request)
@ -83,7 +83,7 @@ class PackController extends Controller
/**
* Handle create pack request and route user to location.
*
* @param Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function create(Request $request)
@ -117,8 +117,8 @@ class PackController extends Controller
/**
* Display pack view template to user.
*
* @param Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\View\View
*/
public function view(Request $request, $id)
@ -132,9 +132,9 @@ class PackController extends Controller
/**
* Handle updating or deleting pack information.
*
* @param Request $request
* @param int $id
* @return \Illuminate\Response\RedirectResponse
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\RedirectResponse
*/
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.
*
* @param Request $request
* @param int $id
* @param bool $files
* @return \Illuminate\Response\BinaryFileResponse
* @param \Illuminate\Http\Request $request
* @param int $id
* @param bool $files
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse
*/
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);
} else {
$fp = fopen($filename, 'a+');
fwrite($fp, json_encode($json, JSON_PRETTY_PRINT));
fclose($fp);

View file

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

View file

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

View file

@ -37,14 +37,11 @@ use Pterodactyl\Exceptions\DisplayValidationException;
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)
{
$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)
{
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)
{
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)
{
try {
@ -88,6 +105,12 @@ class UserController extends Controller
return redirect()->route('admin.users.view', $id);
}
/**
* Create a user.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function postNew(Request $request)
{
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)
{
try {
@ -128,6 +158,12 @@ class UserController extends Controller
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)
{
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.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response|\Illuminate\Response\RedirectResponse
*/
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)
{
$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)
{
$G2FA = new Google2FA();

View file

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

View file

@ -36,6 +36,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class APIController extends Controller
{
/**
* Display base API index page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request)
{
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)
{
return view('base.api.new');
}
/**
* Handle saving new API key.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function save(Request $request)
{
try {
@ -71,6 +89,13 @@ class APIController extends Controller
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)
{
try {

View file

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

View file

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

View file

@ -32,6 +32,11 @@ use Pterodactyl\Http\Controllers\Controller;
class LanguageController extends Controller
{
/**
* A list of supported languages on the panel.
*
* @var array
*/
protected $languages = [
'de' => 'German',
'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)
{
if (array_key_exists($language, $this->languages)) {

View file

@ -36,8 +36,8 @@ class SecurityController extends Controller
/**
* Returns Security Management Page.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @return \Illuminate\View\View
*/
public function index(Request $request)
{
@ -50,8 +50,8 @@ class SecurityController extends Controller
* Generates TOTP Secret and returns popup data for user to verify
* that they can generate a valid response.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse
*/
public function generateTotp(Request $request)
{
@ -73,7 +73,7 @@ class SecurityController extends Controller
/**
* Verifies that 2FA token recieved is valid and will work on the account.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function setTotp(Request $request)
@ -95,8 +95,8 @@ class SecurityController extends Controller
/**
* Disables TOTP on an account.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function disableTotp(Request $request)
{
@ -116,6 +116,13 @@ class SecurityController extends Controller
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)
{
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
{
/**
* Controller Constructor.
*/
public function __construct()
{
//
}
/**
* Pulls an install pack archive from the system.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse|\Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public function pull(Request $request, $uuid)
{
@ -63,8 +56,9 @@ class PackController extends Controller
/**
* Returns the hash information for a pack.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\Http\JsonResponse
*/
public function hash(Request $request, $uuid)
{
@ -87,9 +81,10 @@ class PackController extends Controller
* Pulls an update pack archive from the system.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
* @return void
*/
public function pullUpdate(Request $request)
{
//
}
}

View file

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

View file

@ -32,13 +32,11 @@ use Pterodactyl\Http\Controllers\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)
{
$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)
{
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
@ -82,6 +86,13 @@ class RemoteController extends Controller
], 200);
}
/**
* Handles event from daemon.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
* @deprecated
*/
public function event(Request $request)
{
$server = Models\Server::where('uuid', $request->input('server'))->with('node')->first();
@ -101,6 +112,13 @@ class RemoteController extends Controller
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)
{
// Try to query the token and the node from the database

View file

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

View file

@ -37,21 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class ServerController extends Controller
{
/**
* Controller Constructor.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Renders server index page for specified server.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getIndex(Request $request, $uuid)
{
@ -77,8 +68,9 @@ class ServerController extends Controller
/**
* Renders file overview page.
*
* @param Request $request
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getFiles(Request $request, $uuid)
{
@ -110,8 +102,9 @@ class ServerController extends Controller
/**
* Renders add file page.
*
* @param Request $request
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @return \Illuminate\View\View
*/
public function getAddFile(Request $request, $uuid)
{
@ -130,10 +123,10 @@ class ServerController extends Controller
/**
* Renders edit file page for a given file.
*
* @param Request $request
* @param string $uuid
* @param string $file
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param string $file
* @return \Illuminate\View\View
*/
public function getEditFile(Request $request, $uuid, $file)
{
@ -173,10 +166,10 @@ class ServerController extends Controller
/**
* Handles downloading a file for the user.
*
* @param Request $request
* @param string $uuid
* @param string $file
* @return \Illuminate\Contracts\View\View
* @param \Illuminate\Http\Request $request
* @param string $uuid
* @param string $file
* @return \Illuminate\View\View
*/
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);
}
/**
* 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)
{
$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)
{
$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)
{
$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)
{
$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)
{
$server = Models\Server::byUuid($uuid);
@ -287,6 +315,13 @@ class ServerController extends Controller
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)
{
$server = Models\Server::byUuid($uuid);

View file

@ -37,15 +37,12 @@ use Pterodactyl\Exceptions\DisplayValidationException;
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)
{
$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)
{
$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)
{
$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)
{
$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)
{
$server = Models\Server::byUuid($uuid);
@ -158,6 +185,14 @@ class SubuserController extends Controller
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)
{
$server = Models\Server::byUuid($uuid);

View file

@ -35,11 +35,13 @@ use Pterodactyl\Exceptions\DisplayValidationException;
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)
{
$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)
{
$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)
{
$server = Models\Server::byUuid($uuid);
@ -93,6 +109,14 @@ class TaskController extends Controller
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)
{
$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)
{
$server = Models\Server::byUuid($uuid)->load('tasks');

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -115,8 +115,11 @@ class Server extends Model
* DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS.
* YOU WILL OVERWRITE THE SECRET KEY AND BREAK THINGS.
*
* @param string $uuid The Short-UUID of the server to return an object about.
* @return \Illuminate\Database\Eloquent\Collection
* @param string $uuid
* @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 = [])
{
@ -147,7 +150,6 @@ class Server extends Model
/**
* Returns non-administrative headers for accessing a server on the daemon.
*
* @param string $uuid
* @return array
*/
public function guzzleHeaders()
@ -171,6 +173,8 @@ class Server extends Model
/**
* 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
*/
public function js($additional = null, $overwrite = null)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -70,16 +70,16 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
*/
protected $fillable = ['username', 'email', 'name_first', 'name_last', 'password', 'language', 'use_totp', 'totp_secret', 'gravatar', 'root_admin'];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'root_admin' => 'integer',
'use_totp' => 'integer',
'gravatar' => 'integer',
];
/**
* Cast values to correct type.
*
* @var array
*/
protected $casts = [
'root_admin' => 'integer',
'use_totp' => 'integer',
'gravatar' => 'integer',
];
/**
* The attributes excluded from the model's JSON form.
@ -106,7 +106,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
/**
* Enables or disables TOTP on an account if the token is valid.
*
* @param int $token The token that we want to verify.
* @param int $token
* @return bool
*/
public function toggleTotp($token)
@ -116,9 +116,7 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
}
$this->use_totp = ! $this->use_totp;
$this->save();
return true;
return $this->save();
}
/**
@ -128,8 +126,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
* - at least one lowercase character
* - at least one number.
*
* @param string $password The raw password to set the account password to.
* @param string $regex The regex to use when validating the password. Defaults to '((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,})'.
* @param string $password
* @param string $regex
* @return void
*/
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 bool the user is root admin
* @return bool
*/
public function isRootAdmin()
{
@ -165,7 +163,8 @@ class User extends Model implements AuthenticatableContract, AuthorizableContrac
/**
* Returns the user's daemon secret for a given server.
* @param Server $server \Pterodactyl\Models\Server
*
* @param \Pterodactyl\Models\Server $server
* @return null|string
*/
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.
* 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'])
{

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,13 +29,33 @@ use Pterodactyl\Exceptions\DisplayException;
class PowerRepository
{
/**
* The Eloquent Model associated with the requested server.
*
* @var \Pterodactyl\Models\Server
*/
protected $server;
/**
* Constuctor for repository.
*
* @param int|\Pterodactyl\Models\Server $server
* @return void
*/
public function __construct($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)
{
// 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()
{
$this->do('start');
}
/**
* Stops a server.
*
* @return void
*/
public function stop()
{
$this->do('stop');
}
/**
* Restarts a server.
*
* @return void
*/
public function restart()
{
$this->do('restart');
}
/**
* Kills a server.
*
* @return void
*/
public function kill()
{
$this->do('kill');

View file

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

View file

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

View file

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

View file

@ -34,11 +34,15 @@ use Pterodactyl\Exceptions\DisplayValidationException;
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)
{
// Validate Fields
@ -84,6 +88,16 @@ class NodeRepository
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)
{
$node = Models\Node::findOrFail($id);
@ -179,8 +193,13 @@ class NodeRepository
/**
* Adds allocations to a provided node.
* @param int $id
* @param array $data
*
* @param int $id
* @param array $data
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function addAllocations($id, array $data)
{
@ -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)
{
$node = Models\Node::withCount('servers')->findOrFail($id);

View file

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

View file

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

View file

@ -37,21 +37,21 @@ use Pterodactyl\Exceptions\DisplayValidationException;
class ServerRepository
{
/**
* An array of daemon permission to assign to this server.
*
* @var array
*/
protected $daemonPermissions = [
's:*',
];
public function __construct()
{
//
}
/**
* Generates a SFTP username for a server given a server name.
* format: mumble_67c7a4b0.
*
* @param string $name
* @param string $identifier
* @param string $name
* @param null|string $identifier
* @return string
*/
protected function generateSFTPUsername($name, $identifier = null)
@ -75,8 +75,12 @@ class ServerRepository
/**
* 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)
{
@ -341,10 +345,14 @@ class ServerRepository
}
/**
* [updateDetails description].
* @param int $id
* @param array $data
* Update the details for a server.
*
* @param int $id
* @param array $data
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function updateDetails($id, array $data)
{
@ -424,10 +432,14 @@ class ServerRepository
}
/**
* [updateContainer description].
* @param int $id
* @param array $data
* Update the container for a server.
*
* @param int $id
* @param array $data
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
public function updateContainer($id, array $data)
{
@ -472,10 +484,14 @@ class ServerRepository
}
/**
* [changeBuild description].
* @param int $id
* @param array $data
* @return bool
* Update the build details for a server.
*
* @param int $id
* @param array $data
* @return \Pterodactyl\Models\Server
*
* @throws \Pterodactyl\Exceptions\DisplayException
* @throws \Pterodactyl\Exceptions\DisplayValidationException
*/
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)
{
$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)
{
$server = Models\Server::findOrFail($id);
DB::beginTransaction();
try {
if ($force) {
$server->installed = 3;
$server->save();
}
DB::transaction(function () use ($force, $server) {
$server->installed = $force ? 3 : $server->installed;
$server->save();
$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)
{
$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)
{
$server = Models\Server::withTrashed()->findOrFail($id);
@ -783,6 +826,14 @@ class ServerRepository
$server->save();
}
/**
* Toggle the install status of a serve.
*
* @param int $id
* @return bool
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function toggleInstall($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.
* @param int $id
* @return bool
* Suspends a server.
*
* @param int $id
* @param bool $deleted
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
public function suspend($id, $deleted = false)
{
@ -831,9 +886,12 @@ class ServerRepository
}
/**
* Unsuspends a server instance.
* @param int $id
* @return bool
* Unsuspends a server.
*
* @param int $id
* @return void
*
* @throws \Pterodactyl\Exceptions\DisplayException
*/
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)
{
$server = Models\Server::with('node')->findOrFail($id);

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