2017-10-03 05:01:04 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Pterodactyl - Panel
|
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
|
|
|
*
|
|
|
|
* This software is licensed under the terms of the MIT license.
|
|
|
|
* https://opensource.org/licenses/MIT
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Pterodactyl\Http\Controllers\Admin\Services\Options;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\ServiceOption;
|
|
|
|
use Pterodactyl\Http\Controllers\Controller;
|
2017-10-04 01:18:27 +00:00
|
|
|
use Symfony\Component\HttpFoundation\Response;
|
2017-10-03 05:01:04 +00:00
|
|
|
use Pterodactyl\Services\Services\Exporter\XMLExporterService;
|
|
|
|
|
|
|
|
class OptionShareController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var \Pterodactyl\Services\Services\Exporter\XMLExporterService
|
|
|
|
*/
|
|
|
|
protected $exporterService;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* OptionShareController constructor.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Services\Services\Exporter\XMLExporterService $exporterService
|
|
|
|
*/
|
|
|
|
public function __construct(XMLExporterService $exporterService)
|
|
|
|
{
|
|
|
|
$this->exporterService = $exporterService;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param \Pterodactyl\Models\ServiceOption $option
|
2017-10-04 01:18:27 +00:00
|
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
2017-10-03 05:01:04 +00:00
|
|
|
*
|
|
|
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
|
|
*/
|
2017-10-04 01:18:27 +00:00
|
|
|
public function export(ServiceOption $option): Response
|
2017-10-03 05:01:04 +00:00
|
|
|
{
|
2017-10-04 01:18:27 +00:00
|
|
|
return response($this->exporterService->handle($option->id), 200, [
|
|
|
|
'Content-Transfer-Encoding' => 'binary',
|
|
|
|
'Content-Description' => 'File Transfer',
|
|
|
|
'Content-Disposition' => 'attachment; filename=' . kebab_case($option->name) . '.xml',
|
2017-10-03 05:01:04 +00:00
|
|
|
'Content-Type' => 'application/xml',
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|