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 App\Http\Controllers\Admin; use App\Common\Authorizable; use App\Http\Req..

Decoded Output download

<?php 
namespace App\Http\Controllers\Admin; use App\Common\Authorizable; use App\Http\Requests\Validations\ThemeInstallationRequest; use App\Models\SystemConfig; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Session; use App\Events\System\SystemConfigUpdated; class ThemeController extends Controller { use Authorizable; public function all() { $storeFrontThemes = collect($this->storeFrontThemes()); $t_theme = active_theme(); $active_theme = $storeFrontThemes->firstWhere("slug", $t_theme); $storeFrontThemes = $storeFrontThemes->filter(function ($value, $key) use($t_theme) { return $value["slug"] != $t_theme; }); $sellingThemes = collect($this->sellingThemes()); return view("admin.theme.index", compact("storeFrontThemes", "active_theme", "sellingThemes")); } public function initiate(Request $request, $theme) { if (!(config("app.demo") == true && config("app.debug") !== true)) { goto X2HgT; } return back()->with("warning", trans("messages.demo_restriction")); X2HgT: return view("admin.theme._initiate", compact("theme")); } public function activate(ThemeInstallationRequest $request, $theme, $type = "storefront") { if (!(config("app.demo") == true)) { goto kQkkg; } Session::put("theme", $theme); return back()->with("success", trans("messages.theme_activated", ["theme" => $theme])); kQkkg: $system = SystemConfig::orderBy("id", "asc")->first(); $this->authorize("update", $system); Log::info("Installing theme " . $theme); try { if ($type == "selling") { goto blhqJ; } $installable = $this->storeFrontThemes($theme); $system->active_theme = $theme; goto aBuo5; blhqJ: $installable = $this->sellingThemes($theme); $system->selling_theme = $theme; aBuo5: preparePackageInstallation(array_merge($request->all(), $installable)); } catch (\Exception $exception) { Log::info("Theme installation failed " . $theme); Log::error(get_exception_message($exception)); return back()->with("error", $exception->getMessage()); } if (!$system->save()) { goto Zqhut; } event(new SystemConfigUpdated($system)); return back()->with("success", trans("messages.theme_activated", ["theme" => $theme])); Zqhut: return back()->with("error", trans("messages.failed")); } private function storeFrontThemes($slug = null) { $storeFrontThemes = []; foreach (glob(theme_path("*"), GLOB_ONLYDIR) as $themeFolder) { $themeFolder = realpath($themeFolder); if (!file_exists($jsonFilename = $themeFolder . "/" . "theme.json")) { goto JKVy4; } $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); $themeName = end($folders); $data = []; $json = file_get_contents($jsonFilename); if (!($json !== '')) { goto IF1zW; } $data = json_decode($json, true); if (!($data === null)) { goto ceGNj; } throw new \Exception("Invalid theme.json file at [{$themeFolder}]"); ceGNj: if (!(!$data["released"] && App::environment(["production"]))) { goto oV7XE; } goto rOkfb; oV7XE: IF1zW: if (!($slug && $data["slug"] == $slug)) { goto rS_BP; } $data["path"] = $themeFolder; return $data; rS_BP: $data["assets-path"] = theme_assets_path($data["slug"]); $data["views-path"] = theme_views_path($data["slug"]); $storeFrontThemes[] = $data; JKVy4: rOkfb: } FmvU0: usort($storeFrontThemes, function ($x, $y) { return strnatcmp($x["name"], $y["name"]); }); return $storeFrontThemes; } private function sellingThemes($slug = null) { $sellingThemes = []; foreach (glob(selling_theme_path("*"), GLOB_ONLYDIR) as $themeFolder) { $themeFolder = realpath($themeFolder); if (!file_exists($jsonFilename = $themeFolder . "/" . "theme.json")) { goto kxvjw; } $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); $themeName = end($folders); $data = []; $json = file_get_contents($jsonFilename); if (!($json !== '')) { goto unsD1; } $data = json_decode($json, true); if (!($data === null)) { goto LRCEq; } throw new \Exception("Invalid theme.json file at [{$themeFolder}]"); LRCEq: unsD1: if (!($slug && $data["slug"] == $slug)) { goto FX9H2; } $data["path"] = $themeFolder; return $data; FX9H2: $data["assets-path"] = selling_theme_assets_path($data["slug"]); $data["views-path"] = selling_theme_views_path($data["slug"]); $sellingThemes[] = $data; kxvjw: eitsU: } aUO3O: usort($sellingThemes, function ($x, $y) { return strnatcmp($x["name"], $y["name"]); }); return $sellingThemes; } } ?>

Did this file decode correctly?

Original Code

<?php
namespace App\Http\Controllers\Admin; use App\Common\Authorizable; use App\Http\Requests\Validations\ThemeInstallationRequest; use App\Models\SystemConfig; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Session; use App\Events\System\SystemConfigUpdated; class ThemeController extends Controller { use Authorizable; public function all() { $storeFrontThemes = collect($this->storeFrontThemes()); $t_theme = active_theme(); $active_theme = $storeFrontThemes->firstWhere("\x73\x6c\x75\147", $t_theme); $storeFrontThemes = $storeFrontThemes->filter(function ($value, $key) use($t_theme) { return $value["\x73\x6c\165\147"] != $t_theme; }); $sellingThemes = collect($this->sellingThemes()); return view("\x61\x64\155\151\x6e\56\x74\x68\x65\x6d\145\56\x69\x6e\144\x65\x78", compact("\163\x74\157\x72\145\x46\x72\x6f\156\164\124\150\x65\155\145\x73", "\141\x63\164\x69\x76\145\137\x74\x68\145\155\x65", "\163\145\x6c\154\151\156\147\x54\x68\x65\x6d\x65\x73")); } public function initiate(Request $request, $theme) { if (!(config("\141\160\x70\x2e\x64\x65\x6d\157") == true && config("\141\x70\160\x2e\x64\x65\x62\x75\147") !== true)) { goto X2HgT; } return back()->with("\167\x61\162\x6e\x69\x6e\x67", trans("\155\145\x73\x73\x61\147\145\x73\56\144\145\155\157\137\x72\145\x73\164\162\x69\x63\164\x69\x6f\156")); X2HgT: return view("\141\144\155\151\x6e\x2e\164\150\145\155\145\x2e\137\x69\156\x69\164\151\x61\164\145", compact("\164\x68\x65\x6d\x65")); } public function activate(ThemeInstallationRequest $request, $theme, $type = "\163\x74\157\162\x65\146\x72\x6f\x6e\164") { if (!(config("\141\160\x70\56\x64\145\155\157") == true)) { goto kQkkg; } Session::put("\164\x68\x65\155\145", $theme); return back()->with("\x73\165\x63\x63\x65\x73\163", trans("\155\145\163\163\141\x67\x65\x73\x2e\x74\x68\x65\155\x65\137\x61\143\x74\151\166\x61\164\x65\x64", ["\x74\150\145\x6d\145" => $theme])); kQkkg: $system = SystemConfig::orderBy("\151\144", "\141\x73\143")->first(); $this->authorize("\165\x70\144\x61\x74\145", $system); Log::info("\111\x6e\163\x74\141\x6c\154\151\x6e\x67\40\164\x68\145\155\145\x20" . $theme); try { if ($type == "\x73\x65\x6c\x6c\151\x6e\147") { goto blhqJ; } $installable = $this->storeFrontThemes($theme); $system->active_theme = $theme; goto aBuo5; blhqJ: $installable = $this->sellingThemes($theme); $system->selling_theme = $theme; aBuo5: preparePackageInstallation(array_merge($request->all(), $installable)); } catch (\Exception $exception) { Log::info("\124\x68\145\155\145\40\x69\156\163\164\141\154\x6c\141\x74\x69\157\x6e\x20\146\141\x69\154\x65\x64\40" . $theme); Log::error(get_exception_message($exception)); return back()->with("\145\x72\162\157\x72", $exception->getMessage()); } if (!$system->save()) { goto Zqhut; } event(new SystemConfigUpdated($system)); return back()->with("\163\165\x63\143\x65\163\163", trans("\155\x65\x73\x73\141\x67\145\163\56\x74\150\x65\155\145\137\141\143\164\151\166\141\x74\x65\x64", ["\x74\x68\145\155\x65" => $theme])); Zqhut: return back()->with("\145\x72\162\157\x72", trans("\155\145\x73\163\x61\147\145\x73\56\146\x61\x69\154\145\144")); } private function storeFrontThemes($slug = null) { $storeFrontThemes = []; foreach (glob(theme_path("\x2a"), GLOB_ONLYDIR) as $themeFolder) { $themeFolder = realpath($themeFolder); if (!file_exists($jsonFilename = $themeFolder . "\x2f" . "\164\150\x65\x6d\145\x2e\152\163\157\x6e")) { goto JKVy4; } $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); $themeName = end($folders); $data = []; $json = file_get_contents($jsonFilename); if (!($json !== '')) { goto IF1zW; } $data = json_decode($json, true); if (!($data === null)) { goto ceGNj; } throw new \Exception("\x49\156\166\141\x6c\x69\144\x20\x74\x68\145\x6d\145\x2e\152\x73\157\156\x20\x66\x69\x6c\x65\40\x61\164\40\133{$themeFolder}\x5d"); ceGNj: if (!(!$data["\162\145\154\x65\141\x73\x65\144"] && App::environment(["\160\x72\x6f\x64\165\x63\x74\x69\157\156"]))) { goto oV7XE; } goto rOkfb; oV7XE: IF1zW: if (!($slug && $data["\163\154\165\x67"] == $slug)) { goto rS_BP; } $data["\x70\x61\164\150"] = $themeFolder; return $data; rS_BP: $data["\x61\163\x73\x65\164\163\x2d\160\141\x74\150"] = theme_assets_path($data["\x73\154\x75\147"]); $data["\166\x69\x65\167\163\55\x70\141\164\x68"] = theme_views_path($data["\163\154\165\x67"]); $storeFrontThemes[] = $data; JKVy4: rOkfb: } FmvU0: usort($storeFrontThemes, function ($x, $y) { return strnatcmp($x["\156\141\x6d\x65"], $y["\x6e\x61\x6d\145"]); }); return $storeFrontThemes; } private function sellingThemes($slug = null) { $sellingThemes = []; foreach (glob(selling_theme_path("\52"), GLOB_ONLYDIR) as $themeFolder) { $themeFolder = realpath($themeFolder); if (!file_exists($jsonFilename = $themeFolder . "\57" . "\x74\150\x65\x6d\x65\x2e\152\x73\157\x6e")) { goto kxvjw; } $folders = explode(DIRECTORY_SEPARATOR, $themeFolder); $themeName = end($folders); $data = []; $json = file_get_contents($jsonFilename); if (!($json !== '')) { goto unsD1; } $data = json_decode($json, true); if (!($data === null)) { goto LRCEq; } throw new \Exception("\x49\x6e\166\141\154\151\144\40\x74\150\x65\x6d\145\56\152\x73\x6f\156\x20\x66\x69\154\x65\x20\141\x74\x20\x5b{$themeFolder}\x5d"); LRCEq: unsD1: if (!($slug && $data["\163\x6c\x75\x67"] == $slug)) { goto FX9H2; } $data["\160\141\164\150"] = $themeFolder; return $data; FX9H2: $data["\141\x73\x73\x65\x74\163\55\160\x61\x74\150"] = selling_theme_assets_path($data["\163\154\165\147"]); $data["\166\151\x65\x77\x73\55\160\141\164\x68"] = selling_theme_views_path($data["\x73\154\165\x67"]); $sellingThemes[] = $data; kxvjw: eitsU: } aUO3O: usort($sellingThemes, function ($x, $y) { return strnatcmp($x["\x6e\x61\155\x65"], $y["\x6e\141\155\145"]); }); return $sellingThemes; } }

Function Calls

None

Variables

None

Stats

MD5 1367fcb0bbc6aec10c313cd7370a7d75
Eval Count 0
Decode Time 61 ms