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 Pterodactyl\BlueprintFramework\Controllers; use Pterodactyl\Http\Control..

Decoded Output download

<?php

namespace Pterodactyl\BlueprintFramework\Controllers;

use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;

class ExtensionConfigurationController extends Controller
{
  /**
   * BlueprintExtensionController constructor.
   */
  public function __construct(private SettingsRepositoryInterface $settings,) {}

  /**
   * @throws \Pterodactyl\Exceptions\Model\DataValidationException
   * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
   */
  public function update(ExtensionConfigurationRequest $request): RedirectResponse
  {
    // set extension eggs to be -1 (Show all), then overwrite if needed
    $this->settings->set('blueprint::extensionconfig_' . $request->input('_identifier', 'blueprint') . '_eggs', '["-1"]');

    foreach ($request->normalize() as $key => $value) {
      if (str_ends_with($key, '_eggs')) {
        // if there are other eggs set, remove the -1 'egg'
        $eggs = (array)$value['*'];
        if (count($eggs) > 1 && in_array('-1', $eggs)) {
          $eggs = array_diff($eggs, ['-1']);
        }

        $value = json_encode(array_values($eggs));
      }

      $this->settings->set('blueprint::extensionconfig_' . $key, $value);
    }
  
    return redirect()->route('admin.extensions.'.$request->input('_identifier', 'blueprint').'.index');
  }
}

class ExtensionConfigurationRequest extends AdminFormRequest
{
  public function rules(): array {
    return [
      $this->input('_identifier', 'blueprint').'_adminlayouts' => 'boolean',
      $this->input('_identifier', 'blueprint').'_dashboardwrapper' => 'boolean',
      $this->input('_identifier', 'blueprint').'_eggs' => 'array',
      $this->input('_identifier', 'blueprint').'_eggs.*' => 'numeric',
    ];
  }

  public function attributes(): array {
    return [
      $this->input('_identifier', 'blueprint').'_adminlayouts' => 'admin layouts permission',
      $this->input('_identifier', 'blueprint').'_dashboardwrapper' => 'dashboard wrapper permission',
    ];
  }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Pterodactyl\BlueprintFramework\Controllers;

use Pterodactyl\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Pterodactyl\Http\Requests\Admin\AdminFormRequest;
use Pterodactyl\Contracts\Repository\SettingsRepositoryInterface;

class ExtensionConfigurationController extends Controller
{
  /**
   * BlueprintExtensionController constructor.
   */
  public function __construct(private SettingsRepositoryInterface $settings,) {}

  /**
   * @throws \Pterodactyl\Exceptions\Model\DataValidationException
   * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
   */
  public function update(ExtensionConfigurationRequest $request): RedirectResponse
  {
    // set extension eggs to be -1 (Show all), then overwrite if needed
    $this->settings->set('blueprint::extensionconfig_' . $request->input('_identifier', 'blueprint') . '_eggs', '["-1"]');

    foreach ($request->normalize() as $key => $value) {
      if (str_ends_with($key, '_eggs')) {
        // if there are other eggs set, remove the -1 'egg'
        $eggs = (array)$value['*'];
        if (count($eggs) > 1 && in_array('-1', $eggs)) {
          $eggs = array_diff($eggs, ['-1']);
        }

        $value = json_encode(array_values($eggs));
      }

      $this->settings->set('blueprint::extensionconfig_' . $key, $value);
    }
  
    return redirect()->route('admin.extensions.'.$request->input('_identifier', 'blueprint').'.index');
  }
}

class ExtensionConfigurationRequest extends AdminFormRequest
{
  public function rules(): array {
    return [
      $this->input('_identifier', 'blueprint').'_adminlayouts' => 'boolean',
      $this->input('_identifier', 'blueprint').'_dashboardwrapper' => 'boolean',
      $this->input('_identifier', 'blueprint').'_eggs' => 'array',
      $this->input('_identifier', 'blueprint').'_eggs.*' => 'numeric',
    ];
  }

  public function attributes(): array {
    return [
      $this->input('_identifier', 'blueprint').'_adminlayouts' => 'admin layouts permission',
      $this->input('_identifier', 'blueprint').'_dashboardwrapper' => 'dashboard wrapper permission',
    ];
  }
}

Function Calls

None

Variables

None

Stats

MD5 d30169bd547900221a30cdef4d4503dc
Eval Count 0
Decode Time 93 ms