1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Pterodactyl - Panel |
4
|
|
|
* Copyright (c) 2015 - 2017 Dane Everitt <[email protected]>. |
5
|
|
|
* |
6
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7
|
|
|
* of this software and associated documentation files (the "Software"), to deal |
8
|
|
|
* in the Software without restriction, including without limitation the rights |
9
|
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
10
|
|
|
* copies of the Software, and to permit persons to whom the Software is |
11
|
|
|
* furnished to do so, subject to the following conditions: |
12
|
|
|
* |
13
|
|
|
* The above copyright notice and this permission notice shall be included in all |
14
|
|
|
* copies or substantial portions of the Software. |
15
|
|
|
* |
16
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
20
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
21
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22
|
|
|
* SOFTWARE. |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace Pterodactyl\Http\Controllers\Admin; |
26
|
|
|
|
27
|
|
|
use Alert; |
28
|
|
|
use Settings; |
29
|
|
|
use Validator; |
30
|
|
|
use Illuminate\Http\Request; |
31
|
|
|
use Pterodactyl\Http\Controllers\Controller; |
32
|
|
|
|
33
|
|
|
class BaseController extends Controller |
34
|
|
|
{ |
35
|
|
|
public function getIndex(Request $request) |
|
|
|
|
36
|
|
|
{ |
37
|
|
|
return view('admin.index'); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function getSettings(Request $request) |
|
|
|
|
41
|
|
|
{ |
42
|
|
|
return view('admin.settings'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function postSettings(Request $request) |
46
|
|
|
{ |
47
|
|
|
$validator = Validator::make($request->all(), [ |
48
|
|
|
'company' => 'required|between:1,256', |
49
|
|
|
'default_language' => 'required|alpha_dash|min:2|max:5', |
50
|
|
|
]); |
51
|
|
|
|
52
|
|
|
if ($validator->fails()) { |
53
|
|
|
return redirect()->route('admin.settings')->withErrors($validator->errors())->withInput(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
Settings::set('company', $request->input('company')); |
57
|
|
|
Settings::set('default_language', $request->input('default_language')); |
58
|
|
|
|
59
|
|
|
Alert::success('Settings have been successfully updated.')->flash(); |
60
|
|
|
|
61
|
|
|
return redirect()->route('admin.settings'); |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.