Commit 0b6071d6 authored by Dominik Hebeler's avatar Dominik Hebeler

Update auf Laravel 5.3 durchgeführt

parent a2d2ee7a
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
......@@ -10,6 +11,7 @@ DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
......@@ -24,3 +26,7 @@ MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
PUSHER_APP_ID=
PUSHER_KEY=
PUSHER_SECRET=
/vendor
/node_modules
/public/storage
*.sh
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;
class Inspire extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'inspire';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}
}
......@@ -25,7 +25,15 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
$schedule->command('log:rotate')->everyTenMinutes();
// $schedule->command('inspire')
// ->hourly();
}
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
}
<?php
namespace App\Events;
abstract class Event
{
//
}
......@@ -3,10 +3,7 @@
namespace App\Exceptions;
use Exception;
use Illuminate\Validation\ValidationException;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
class Handler extends ExceptionHandler
......@@ -17,10 +14,12 @@ class Handler extends ExceptionHandler
* @var array
*/
protected $dontReport = [
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
ValidationException::class,
\Illuminate\Auth\AuthenticationException::class,
\Illuminate\Auth\Access\AuthorizationException::class,
\Symfony\Component\HttpKernel\Exception\HttpException::class,
\Illuminate\Database\Eloquent\ModelNotFoundException::class,
\Illuminate\Session\TokenMismatchException::class,
\Illuminate\Validation\ValidationException::class,
];
/**
......@@ -28,23 +27,39 @@ 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 $e)
public function report(Exception $exception)
{
parent::report($e);
parent::report($exception);
}
/**
* 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 $e)
public function render($request, Exception $exception)
{
return parent::render($request, $e);
return parent::render($request, $exception);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
class ForgotPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset emails and
| includes a trait which assists in sending these notifications from
| your application to your users. Feel free to explore this trait.
|
*/
use SendsPasswordResetEmails;
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}
}
......@@ -5,39 +5,38 @@ namespace App\Http\Controllers\Auth;
use App\User;
use Validator;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Foundation\Auth\RegistersUsers;
class AuthController extends Controller
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
use RegistersUsers;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/';
protected $redirectTo = '/home';
/**
* Create a new authentication controller instance.
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
$this->middleware('guest');
}
/**
......
......@@ -5,7 +5,7 @@ namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
class PasswordController extends Controller
class ResetPasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
......@@ -21,7 +21,7 @@ class PasswordController extends Controller
use ResetsPasswords;
/**
* Create a new password controller instance.
* Create a new controller instance.
*
* @return void
*/
......
......@@ -6,9 +6,8 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
class Controller extends BaseController
{
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
......@@ -2,34 +2,32 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use File;
use Response;
use App\Http\Requests;
use Illuminate\Http\Request;
use PiwikTracker;
use Response;
class ImageController extends Controller
{
public function generateImage(Request $request)
{
#Piwik Code
PiwikTracker::$URL = 'http://piwik.metager3.de';
$piwikTracker = new PiwikTracker( $idSite = 1 );
// Cookies ausschalten
$piwikTracker->disableCookieSupport();
$piwikTracker->deleteCookies();
#Piwik Code
PiwikTracker::$URL = 'http://piwik.metager3.de';
$piwikTracker = new PiwikTracker($idSite = 1);
$site = $request->input('site', '/');
// Cookies ausschalten
$piwikTracker->disableCookieSupport();
$piwikTracker->deleteCookies();
// Sendet Tracker request per http
$piwikTracker->doTrackPageView($site);
$site = $request->input('site', '/');
// Sendet Tracker request per http
$piwikTracker->doTrackPageView($site);
$path = public_path() . '/img/1px.png';
$fileType = File::type($path);
$response = Response::make( File::get($path), 200);
$response->header('Content-Type', $fileType);
return $response;
$path = public_path() . '/img/1px.png';
$fileType = File::type($path);
$response = Response::make(File::get($path), 200);
$response->header('Content-Type', $fileType);
return $response;
}
}
......@@ -2,19 +2,17 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Redis;
class LogController extends Controller
{
function clicklog(Request $request)
public function clicklog(Request $request)
{
$redis = Redis::connection('redisLogs');
if( $redis )
{
if ($redis) {
$logEntry = "";
$logEntry .= "[" . date(DATE_RFC822, mktime(date("H"),date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
$logEntry .= "[" . date(DATE_RFC822, mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"))) . "]";
$logEntry .= " " . $request->input('i');
$logEntry .= " " . $request->input('s');
$logEntry .= " " . $request->input('q');
......@@ -24,24 +22,21 @@ class LogController extends Controller
$redis->rpush('logs.clicks', $logEntry);
}
return '';
}
}
function pluginClose()
public function pluginClose()
{
$redis = Redis::connection('redisLogs');
if( $redis )
{
if ($redis) {
$redis->incr('logs.plugin.close');
}
}
function pluginInstall()
public function pluginInstall()
{
$redis = Redis::connection('redisLogs');
if( $redis )
{
if ($redis) {
$redis->incr('logs.plugin.install');
}
}
}
\ No newline at end of file
}
......@@ -2,7 +2,6 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use LaravelLocalization;
......
......@@ -3,7 +3,6 @@
namespace App\Http\Controllers;
use App;
use App\Http\Controllers\Controller;
use App\MetaGer;
use Illuminate\Http\Request;
use LaravelLocalization;
......@@ -138,5 +137,4 @@ class MetaGerSearch extends Controller
{
return file_get_contents($url);
}
}
......@@ -2,47 +2,37 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
#use App\MetaGer\Forwarder;
#use App\MetaGer\Results;
#use App\MetaGer\Search;
use App;
use App\MetaGer;
use Illuminate\Http\Request;
use Response;
class Pictureproxy extends Controller
{
function get(Request $request) {
if( $request->has('url') )
{
try{
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
public function get(Request $request)
{
if ($request->has('url')) {
try {
$arrContextOptions = array(
"ssl" => array(
"verify_peer" => false,
"verify_peer_name" => false,
),
);
$file = file_get_contents($request->input('url'), false, stream_context_create($arrContextOptions));
);
$file = file_get_contents($request->input('url'), false, stream_context_create($arrContextOptions));
$responseCode = explode(" ", $http_response_header[0])[1];
$contentType = "";
foreach($http_response_header as $header)
{
if( strpos($header, "Content-Type:") === 0)
{
$tmp = explode(": ", $header);
$contentType = "";
foreach ($http_response_header as $header) {
if (strpos($header, "Content-Type:") === 0) {
$tmp = explode(": ", $header);
$contentType = $tmp[1];
}
}
$response = Response::make($file, $responseCode);
$response->header('Content-Type', $contentType);
}catch(\ErrorException $e)
{
} catch (\ErrorException $e) {
$response = Response::make("", 404);
}
return $response;
}
}
}
\ No newline at end of file
}
}
......@@ -2,10 +2,7 @@
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App;
class SitesearchController extends Controller
{
......@@ -17,4 +14,4 @@ class SitesearchController extends Controller
->with('site', $request->input('site', ''))
->with('navbarFocus', 'dienste');
}
}
\ No newline at end of file
}
......@@ -2,11 +2,8 @@
namespace App\Http\Controllers;
use App;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
use Response;
class StartpageController extends Controller
{
......
......@@ -15,7 +15,6 @@ class Kernel extends HttpKernel
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Fideloper\Proxy\TrustProxies::class,
];
/**
......@@ -30,10 +29,12 @@ class Kernel extends HttpKernel
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
#\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
......@@ -45,14 +46,11 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class,
'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
];
}
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Authenticate
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->guest()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('login');
}
}
return $next($request);
}
}
......@@ -18,7 +18,7 @@ class RedirectIfAuthenticated
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/');
return redirect('/home');
}
return $next($request);
......
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest
{
//
}
<?php
namespace App\Jobs;
use Illuminate\Bus\Queueable;
abstract class Job
{
/*
|--------------------------------------------------------------------------
| Queueable Jobs
|--------------------------------------------------------------------------
|
| This job base class provides a central location to place any logic that
| is shared across all of your jobs. The trait included with the class
| provides access to the "onQueue" and "delay" queue helper methods.
|
*/
use Queueable;
}
......@@ -2,16 +2,15 @@
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Http\Request;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Redis;
class Search extends Job implements ShouldQueue
class Search implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
use InteractsWithQueue, Queueable, SerializesModels;
protected $hash, $host, $port, $name, $getString, $useragent, $fp, $additionalHeaders;
protected $buffer_length = 8192;
......@@ -37,7 +36,7 @@ class Search extends Job implements ShouldQueue
*
* @return void
*/
public function handle(Request $request)
public function handle()
{
$this->fp = $this->getFreeSocket();
......
......@@ -2,7 +2,6 @@
namespace App;
use App;
use App\lib\TextLanguageDetect\TextLanguageDetect;
use Cache;
use Illuminate\Http\Request;
use Jenssegers\Agent\Agent;
......@@ -74,10 +73,6 @@ class MetaGer
}
}
# Spracherkennung starten