Skip to content

Commit 5927e0e

Browse files
committed
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # app/Http/Controllers/Base/LanguageController.php # app/Http/Kernel.php # app/Http/Middleware/TrimStrings.php # app/Providers/RouteServiceProvider.php
2 parents d80c59a + 9c30345 commit 5927e0e

24 files changed

+637
-587
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
1919
* `[pre.7]` — Sidebar for file manager now is a single link rather than a dropdown.
2020
* Attempting to reset a password for an account that does not exist no longer returns an error, rather it displays a success message. Failed resets trigger a `Pterodactyl\Events\Auth\FailedPasswordReset` event that can be caught if needed to perform other actions.
2121
* Servers are no longer queued for deletion due to the general hassle and extra logic required.
22+
* Updated all panel components to run on Laravel v5.4 rather than 5.3 which is EOL.
2223

2324
## v0.6.0-pre.7 (Courageous Carniadactylus)
2425
### Fixed

app/Console/Commands/UpdateEnvironment.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,19 @@ public function handle()
154154
$variables['SESSION_DRIVER'] = $this->option('session-driver');
155155
}
156156

157+
if (is_null($this->option('queue-driver'))) {
158+
$this->line('If you chose redis as your cache driver backend, you *must* have a redis server configured already.');
159+
$variables['QUEUE_DRIVER'] = $this->choice('Which cache driver backend would you like to use?', [
160+
'database' => 'Database (recommended)',
161+
'redis' => 'Redis',
162+
'sqs' => 'Amazon SQS',
163+
'sync' => 'Sync',
164+
'null' => 'None',
165+
], config('queue.driver', 'database'));
166+
} else {
167+
$variables['QUEUE_DRIVER'] = $this->option('queue-driver');
168+
}
169+
157170
$bar = $this->output->createProgressBar(count($variables));
158171

159172
foreach ($variables as $key => $value) {

app/Exceptions/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,6 @@ protected function unauthenticated($request, AuthenticationException $exception)
7070
return response()->json(['error' => 'Unauthenticated.'], 401);
7171
}
7272

73-
return redirect()->guest('/auth/login');
73+
return redirect()->guest(route('auth.login'));
7474
}
7575
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
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\Base;
26+
27+
use Auth;
28+
use Session;
29+
use Illuminate\Http\Request;
30+
use Pterodactyl\Models\User;
31+
use Pterodactyl\Http\Controllers\Controller;
32+
33+
class LanguageController extends Controller
34+
{
35+
/**
36+
* A list of supported languages on the panel.
37+
*
38+
* @var array
39+
*/
40+
protected $languages = [
41+
'de' => 'German',
42+
'en' => 'English',
43+
'et' => 'Estonian',
44+
'nb' => 'Norwegian',
45+
'nl' => 'Dutch',
46+
'pt' => 'Portuguese',
47+
'ro' => 'Romanian',
48+
'ru' => 'Russian',
49+
];
50+
51+
/**
52+
* Sets the language for a user.
53+
*
54+
* @param \Illuminate\Http\Request $request
55+
* @param string $language
56+
* @return \Illuminate\Http\RedirectResponse
57+
*/
58+
public function setLanguage(Request $request, $language)
59+
{
60+
if (array_key_exists($language, $this->languages)) {
61+
if (Auth::check()) {
62+
$user = User::findOrFail(Auth::user()->id);
63+
$user->language = $language;
64+
$user->save();
65+
}
66+
Session::put('applocale', $language);
67+
}
68+
69+
return redirect()->back();
70+
}
71+
}

app/Http/Middleware/LanguageMiddleware.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function handle($request, Closure $next)
4444
if (Session::has('applocale')) {
4545
App::setLocale(Session::get('applocale'));
4646
} elseif (Auth::check() && isset(Auth::user()->language)) {
47-
Session::set('applocale', Auth::user()->language);
47+
Session::put('applocale', Auth::user()->language);
4848
App::setLocale(Auth::user()->language);
4949
} else {
5050
App::setLocale(Settings::get('default_language', 'en'));

app/Http/Middleware/RedirectIfAuthenticated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class RedirectIfAuthenticated
1818
public function handle($request, Closure $next, $guard = null)
1919
{
2020
if (Auth::guard($guard)->check()) {
21-
return redirect('/');
21+
return redirect(route('index'));
2222
}
2323

2424
return $next($request);

app/Http/Middleware/TrimStrings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace App\Http\Middleware;
3+
namespace Pterodactyl\Http\Middleware;
44

55
use Illuminate\Foundation\Http\Middleware\TrimStrings as BaseTrimmer;
66

app/Observers/ServerObserver.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@
2525
namespace Pterodactyl\Observers;
2626

2727
use Cache;
28-
use Carbon;
2928
use Pterodactyl\Events;
3029
use Pterodactyl\Models\Server;
31-
use Pterodactyl\Jobs\DeleteServer;
32-
use Pterodactyl\Jobs\SuspendServer;
3330
use Pterodactyl\Notifications\ServerCreated;
3431
use Illuminate\Foundation\Bus\DispatchesJobs;
3532

app/Providers/AuthServiceProvider.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Pterodactyl\Providers;
44

5-
use Illuminate\Contracts\Auth\Access\Gate as GateContract;
65
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
76

87
class AuthServiceProvider extends ServiceProvider
@@ -22,8 +21,8 @@ class AuthServiceProvider extends ServiceProvider
2221
* @param \Illuminate\Contracts\Auth\Access\Gate $gate
2322
* @return void
2423
*/
25-
public function boot(GateContract $gate)
24+
public function boot()
2625
{
27-
parent::registerPolicies($gate);
26+
$this->registerPolicies();
2827
}
2928
}

app/Providers/RouteServiceProvider.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,6 @@ public function boot()
3333
*/
3434
public function map()
3535
{
36-
$this->mapper();
37-
38-
Route::group(['namespace' => $this->namespace], function ($router) {
39-
foreach (glob(app_path('Http//Routes') . '/*.php') as $file) {
40-
$this->app->make('Pterodactyl\\Http\\Routes\\' . basename($file, '.php'))->map($router);
41-
}
42-
});
43-
}
44-
45-
/**
46-
* Configure all routes used by the application.
47-
*
48-
* @return void
49-
*/
50-
protected function mapper() {
5136
Route::middleware(['web', 'auth', 'csrf'])
5237
->namespace($this->namespace . '\Base')
5338
->group(base_path('routes/base.php'));

0 commit comments

Comments
 (0)