Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit ab53769

Browse files
committed
Merge pull request #8 from lbausch/development
Minor Updates
2 parents 5ef7dfb + 3327180 commit ab53769

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+5771
-1679
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ MAIL_HOST=mailtrap.io
2727
MAIL_PORT=2525
2828
MAIL_USERNAME=null
2929
MAIL_PASSWORD=null
30+
MAIL_ENCRYPTION=null
3031

31-
ASSETS_PIPELINE=true
32+
ASSETS_PIPELINE=auto

.gitignore

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
/vendor
22
/node_modules
3+
Homestead.yaml
4+
Homestead.json
35
.env
46

5-
## Composer
6-
composer.lock
7+
## PhpStorm
8+
.idea/
79

810
## Assets
911
/public/assets/min
10-
11-
## PhpStorm
12-
.idea/

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ SQLgreyGUI
33

44
Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel 5](http://laravel.com/) Framework.
55

6-
76
## Features
87
* Dashboard: quick overview of emails / domains in greylist, whitelist, opt-out and opt-in
98
* Greylist: delete entries or move them to the whitelist
@@ -23,12 +22,12 @@ Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel
2322
1. grab a copy of the code (download [master.zip](https://github.com/lbausch/SQLgreyGUI/archive/master.zip) or use `git clone https://github.com/lbausch/SQLgreyGUI.git`)
2423
2. make your webserver use the `public` directory as document root
2524
3. copy `.env.example` to `.env` and adjust it to your needs (`APP_URL`, `APP_TIMEZONE`, `APP_KEY` and database settings)
26-
4. run `composer update` to install all necessary dependencies and set a new application key with `php artisan key:generate`
27-
5. run `php artisan migrate --force` to create the database tables
28-
6. run `php artisan db:seed --force` to create an admin user
25+
4. run `composer install` to install all necessary dependencies
26+
5. set a new application key with `php artisan key:generate`
27+
6. run `php artisan migrate --seed --force` to create the database tables and an admin user
2928
7. login with the username `admin` and the password `joh316` (you can change the password in "Settings")
3029

3130

3231
## Screenshots
3332
![Dasboard](/../screenshots/dashboard.png?raw=true "Dashboard")
34-
![Auto-Whitelist](/../screenshots/auto-whitelist.png?raw=true "Auto-Whitelist")
33+
![Auto-Whitelist](/../screenshots/auto-whitelist.png?raw=true "Auto-Whitelist")

app/Console/Commands/Inspire.php

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
1-
<?php namespace SQLgreyGUI\Console\Commands;
1+
<?php
2+
3+
namespace SQLgreyGUI\Console\Commands;
24

35
use Illuminate\Console\Command;
46
use Illuminate\Foundation\Inspiring;
57

6-
class Inspire extends Command {
7-
8-
/**
9-
* The console command name.
10-
*
11-
* @var string
12-
*/
13-
protected $name = 'inspire';
14-
15-
/**
16-
* The console command description.
17-
*
18-
* @var string
19-
*/
20-
protected $description = 'Display an inspiring quote';
8+
class Inspire extends Command
9+
{
10+
/**
11+
* The name and signature of the console command.
12+
*
13+
* @var string
14+
*/
15+
protected $signature = 'inspire';
2116

22-
/**
23-
* Execute the console command.
24-
*
25-
* @return mixed
26-
*/
27-
public function handle()
28-
{
29-
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
30-
}
17+
/**
18+
* The console command description.
19+
*
20+
* @var string
21+
*/
22+
protected $description = 'Display an inspiring quote';
3123

24+
/**
25+
* Execute the console command.
26+
*
27+
* @return mixed
28+
*/
29+
public function handle()
30+
{
31+
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
32+
}
3233
}

app/Console/Kernel.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@
77

88
class Kernel extends ConsoleKernel
99
{
10-
1110
/**
1211
* The Artisan commands provided by your application.
1312
*
1413
* @var array
1514
*/
1615
protected $commands = [
17-
'SQLgreyGUI\Console\Commands\Inspire',
16+
//\SQLgreyGUI\Console\Commands\Inspire::class,
1817
];
1918

2019
/**
2120
* Define the application's command schedule.
2221
*
23-
* @param \Illuminate\Console\Scheduling\Schedule $schedule
24-
* @return void
22+
* @param \Illuminate\Console\Scheduling\Schedule $schedule
2523
*/
2624
protected function schedule(Schedule $schedule)
2725
{
2826
//$schedule->command('inspire')->hourly();
2927
}
30-
3128
}

app/Events/Event.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
<?php namespace SQLgreyGUI\Events;
1+
<?php
22

3-
abstract class Event {
4-
5-
//
3+
namespace SQLgreyGUI\Events;
64

5+
abstract class Event
6+
{
7+
//
78
}

app/Exceptions/Handler.php

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,51 @@
1-
<?php namespace SQLgreyGUI\Exceptions;
1+
<?php
2+
3+
namespace SQLgreyGUI\Exceptions;
24

35
use Exception;
6+
use Illuminate\Database\Eloquent\ModelNotFoundException;
7+
use Symfony\Component\HttpKernel\Exception\HttpException;
8+
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
49
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
510

6-
class Handler extends ExceptionHandler {
7-
8-
/**
9-
* A list of the exception types that should not be reported.
10-
*
11-
* @var array
12-
*/
13-
protected $dontReport = [
14-
'Symfony\Component\HttpKernel\Exception\HttpException'
15-
];
11+
class Handler extends ExceptionHandler
12+
{
13+
/**
14+
* A list of the exception types that should not be reported.
15+
*
16+
* @var array
17+
*/
18+
protected $dontReport = [
19+
HttpException::class,
20+
ModelNotFoundException::class,
21+
];
1622

17-
/**
18-
* Report or log an exception.
19-
*
20-
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
21-
*
22-
* @param \Exception $e
23-
* @return void
24-
*/
25-
public function report(Exception $e)
26-
{
27-
return parent::report($e);
28-
}
23+
/**
24+
* Report or log an exception.
25+
*
26+
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
27+
*
28+
* @param \Exception $e
29+
*/
30+
public function report(Exception $e)
31+
{
32+
return parent::report($e);
33+
}
2934

30-
/**
31-
* Render an exception into an HTTP response.
32-
*
33-
* @param \Illuminate\Http\Request $request
34-
* @param \Exception $e
35-
* @return \Illuminate\Http\Response
36-
*/
37-
public function render($request, Exception $e)
38-
{
39-
return parent::render($request, $e);
40-
}
35+
/**
36+
* Render an exception into an HTTP response.
37+
*
38+
* @param \Illuminate\Http\Request $request
39+
* @param \Exception $e
40+
*
41+
* @return \Illuminate\Http\Response
42+
*/
43+
public function render($request, Exception $e)
44+
{
45+
if ($e instanceof ModelNotFoundException) {
46+
$e = new NotFoundHttpException($e->getMessage(), $e);
47+
}
4148

49+
return parent::render($request, $e);
50+
}
4251
}

app/Http/Controllers/AboutController.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,21 @@
44

55
class AboutController extends Controller
66
{
7-
87
/**
9-
* Constructor
10-
*
11-
* @return void
8+
* Constructor.
129
*/
1310
public function __construct()
1411
{
1512
parent::__construct();
1613
}
1714

1815
/**
19-
* index
16+
* Index.
2017
*
21-
* @return Response
18+
* @return \Illuminate\Http\Response
2219
*/
2320
public function index()
2421
{
2522
return view('about.index');
2623
}
27-
2824
}

app/Http/Controllers/AuthController.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@
33
namespace SQLgreyGUI\Http\Controllers;
44

55
use Illuminate\Http\Request;
6+
use Auth;
67

78
class AuthController extends Controller
89
{
9-
1010
/**
11-
* show login form
11+
* Show login form.
1212
*
13-
* @return Response
13+
* @return \Illuminate\Http\Response
1414
*/
1515
public function showLogin()
1616
{
1717
return view('auth.login');
1818
}
1919

2020
/**
21-
* login
22-
*
23-
* @return Response
21+
* Login.
22+
*
23+
* @return \Illuminate\Http\Response
2424
*/
2525
public function login(Request $req)
2626
{
@@ -36,35 +36,35 @@ public function login(Request $req)
3636
$this->validate($req, $rules);
3737

3838
// Try to log the user in.
39-
if (\Auth::attempt([
40-
'username' => $req->input('username'),
41-
'password' => $req->input('password'),
42-
'enabled' => 1,
43-
], $remember)) {
39+
if (Auth::attempt([
40+
'username' => $req->input('username'),
41+
'password' => $req->input('password'),
42+
'enabled' => 1,
43+
], $remember)
44+
) {
4445

4546
// Redirect to dashboard
46-
return \Redirect::intended('/')
47-
->withSuccess('You have logged in successfully');
47+
return redirect()->intended('/')
48+
->withSuccess('You have logged in successfully');
4849
}
4950

5051
// Redirect to the login page
5152
return redirect(action('AuthController@showLogin'))
52-
->withErrors(['general' => 'Username/ Password invalid'])
53-
->withInput($req->except('password'));
53+
->withErrors(['general' => 'Username/ Password invalid'])
54+
->withInput($req->except('password'));
5455
}
5556

5657
/**
57-
* logout
58+
* logout.
5859
*
5960
* @return Response
6061
*/
6162
public function logout()
6263
{
63-
\Auth::logout();
64+
Auth::logout();
6465

6566
// Redirect to homepage
6667
return redirect('/')
67-
->withSuccess('You are logged out');
68+
->withSuccess('You are logged out');
6869
}
69-
7070
}

0 commit comments

Comments
 (0)