Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace BookStack\App\Providers; use BookStack\Uploads\ImageService; use Illumin..

Decoded Output download

<?php

namespace BookStack\App\Providers;

use BookStack\Uploads\ImageService;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;

class ValidationRuleServiceProvider extends ServiceProvider
{
    /**
     * Register our custom validation rules when the application boots.
     */
    public function boot(): void
    {
        Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {
            $extension = strtolower($value->getClientOriginalExtension());

            return ImageService::isExtensionSupported($extension);
        });

        Validator::extend('safe_url', function ($attribute, $value, $parameters, $validator) {
            $cleanLinkName = strtolower(trim($value));
            $isJs = str_starts_with($cleanLinkName, 'javascript:');
            $isData = str_starts_with($cleanLinkName, 'data:');

            return !$isJs && !$isData;
        });
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace BookStack\App\Providers;

use BookStack\Uploads\ImageService;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;

class ValidationRuleServiceProvider extends ServiceProvider
{
    /**
     * Register our custom validation rules when the application boots.
     */
    public function boot(): void
    {
        Validator::extend('image_extension', function ($attribute, $value, $parameters, $validator) {
            $extension = strtolower($value->getClientOriginalExtension());

            return ImageService::isExtensionSupported($extension);
        });

        Validator::extend('safe_url', function ($attribute, $value, $parameters, $validator) {
            $cleanLinkName = strtolower(trim($value));
            $isJs = str_starts_with($cleanLinkName, 'javascript:');
            $isData = str_starts_with($cleanLinkName, 'data:');

            return !$isJs && !$isData;
        });
    }
}

Function Calls

None

Variables

None

Stats

MD5 66ea5edd9ef2f15d1f56951a129a44a5
Eval Count 0
Decode Time 109 ms