HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers60/agrimac.nl/app/controllers/BaseController.php
<?php

use Illuminate\Routing\Controller;

class BaseController extends Controller
{


    public function __construct()
    {
        $this->setWebsiteConfig();
    }


    public function setWebsiteConfig(){

        // Only use the session when in production
        if(\App::environment() == 'production')
        {
            $config = \Session::get('webConfig', null);
        }

        // Check Config Session is filled else load config data
        if(!isset($config)){
            $config = \Komma\Kms\WebsiteConfig\Model\WebsiteConfig::all();
            \Session::set('webConfig', $config);
        }

        // Loop through Config and append data to business config
        foreach ($config as $setting){
            if($setting->value == '') continue;
            \Config::set('business.'.$setting->code_name, $setting->value);
        }
    }


    public function emailAdministrator($exception, $code)
	{

        return false;
        if(\App::environment() == 'local') return false;

		//Check if we exclude the email for the current url
		if($this->checkExcludedErrors($code)) return false;

		if(!in_array($code, \Config::get('business.send_errors'))){
		    return false;
        }

		$mailer = \App::make('Komma\Mailers\Mailer');

		$mailer->sendTo(\Config::get('business.admin_emails'), 'Fout Code ' . $code, 'emails/error',
				[
						'code' => $code,
						'stack' => $exception->__toString(),
						'path' => \Request::path()
				]);
	}

	public function abortPage($type = 404)
	{

        $pageService = \App::make('Komma\Pages\PageService');

        //get all page links
        $links = $pageService->getAllRoutes();

		$view = \View::make('layouts.pages.errors.'.$type)->with('links', $links)->render();
		return \Response::make($view, $type);

	}


	public function checkExcludedErrors($code){

		if($code == 404) return true;

        if($code == 500 && \Request::segment(1) == 'kms') //Optional error if project images in kms give an error
        {
            switch (\Request::segment(2))
            {
                case 'posts':
                case 'projects':
                case 'services':
                case 'reference':
                    return true;
                default:
                    break;
            }

            if(strpos(\Request::segment(2),'-blocks')) return true;
        }

        //check if last segments starts with
        $segments = Request::segments();
        if(substr(end($segments), 0, 4)=== 'tel:') return true;
        if(substr(end($segments), 0, 2)=== 'wp') return true;

        switch (end($segments)){
            case ').html(msg[key][0]).addClass(':
            case '],_default:k.htmlSerialize':
            case ',data:b}).done(function(a){e=arguments,g.html(d':
            case ').length,k.htmlSerialize=!!b.getElementsByTagName(':
            case ').length,k.html5Clone=':
            case ',shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),':
                return true;
            default:
                break;
        }

        //check if first segments is
        $firstSegment = \Request::segment(1);
        $firstSegment = strtolower($firstSegment);
        switch($firstSegment){
            case 'xmlrpc.php':
            case 'wp-content':
            case 'kms':
            case 'apple-touch-icon.png':
            case 'wp-login.php':
            case 'wp-admin':
            case 'wp':
            case 'wordpress':
            case 'administrator':
            case 'www.googletagmanager.com':
            case 'autodiscover':
            case 'browserconfig.xml':
            case '_sql':
            case 'sql':
            case 'sqldatabase':
            case 'db':
            case 'database':
            case 'backup':
            case 'back-up':
            case 'mysql':
            case 'phpmyadmin':
            case 'editor':
            case 'manage':
            case 'admin':
            case 'fck':
            case 'fckeditor':
            case 'update.php':
                return true;

            default:
                break;
        }

        //check if in url there is a specific string, doesnt mather where
        $path = \Request::path();
        if(strpos($path, '.gzip')) return true;
        if(strpos($path, '.bzip')) return true;
        if(strpos($path, '.sql')) return true;
        if(strpos($path, '.bz2')) return true;
        if(strpos($path, '.tar')) return true;
        if(strpos($path, '.tgz')) return true;
        if(strpos($path, '.gz')) return true;
        if(strpos($path, '.zip')) return true;
        if(strpos($path, '.cnf')) return true;
        if(strpos($path, 'elfinder')) return true;

        return false;
	}

}