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 /* * Copyright (C) Incevio Systems, Inc - All Rights Reserved * Unauthorized copy..
Decoded Output download
<?php
/*
* Copyright (C) Incevio Systems, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Munna Khan <[email protected]>, September 2018
*/
namespace App\Http\Controllers\Admin;
use App\Models\Package;
use App\Http\Controllers\Controller;
use App\Http\Requests\Validations\PackageInstallationRequest;
use App\Services\PackageInstaller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class PackagesController extends Controller
{
public function index()
{
$installables = $this->scanPackages();
$installs = Package::all();
return view("admin.packages.index", compact("installables", "installs"));
}
public function upload()
{
return view("admin.packages._upload");
}
public function save(Request $request)
{
echo "<pre>";
print_r($request->all());
echo "<pre>";
exit("end!");
}
public function initiate(Request $request, $package)
{
if (!(config("app.demo") == true && config("app.debug") !== true)) {
goto g6mHm;
}
return back()->with("warning", trans("messages.demo_restriction"));
g6mHm:
$installable = $this->scanPackages($package);
if (!$installable) {
goto e22GE;
}
if (!Package::where("slug", $installable["slug"])->first()) {
goto vRZmM;
}
return back()->with("error", trans("messages.package_installed_already", ["package" => $package]));
vRZmM:
e22GE:
return view("admin.packages._initiate", compact("installable"));
}
public function install(PackageInstallationRequest $request, $package)
{
if (!(config("app.demo") == true && config("app.debug") !== true)) {
goto Y_wIe;
}
return back()->with("warning", trans("messages.demo_restriction"));
Y_wIe:
$installable = $this->scanPackages($package);
if (!$installable) {
goto HMyPV;
}
try {
$installer = new PackageInstaller($request, $installable);
$installer->install();
} catch (\Exception $e) {
Log::error($e);
$installer->uninstall();
$registered = Package::where("slug", $package)->first();
if (!$registered) {
goto DFfE0;
}
$registered->delete();
DFfE0:
return back()->with("error", $e->getMessage());
}
Artisan::call("cache:clear");
Artisan::call("route:clear");
return back()->with("success", trans("messages.package_installed_success", ["package" => $package]));
HMyPV:
return back()->with("error", trans("messages.failed"));
}
public function uninstall(Request $request, $package)
{
if (!(config("app.demo") == true && config("app.debug") !== true)) {
goto TgGOU;
}
return back()->with("warning", trans("messages.demo_restriction"));
TgGOU:
$registered = Package::where("slug", $package)->firstOrFail();
$uninstallable = $this->scanPackages($package);
DB::beginTransaction();
try {
$installer = new PackageInstaller($request, $uninstallable);
if (!$installer->uninstall()) {
goto tie2u;
}
Artisan::call("cache:clear");
Artisan::call("route:clear");
if (!$registered->delete()) {
goto a8UMB;
}
$msg = trans("messages.package_uninstalled_success", ["package" => $package]);
DB::commit();
return back()->with("success", $msg);
a8UMB:
tie2u:
} catch (\Exception $e) {
DB::rollback();
Log::error($e);
return back()->with("error", $e->getMessage());
}
return back()->with("error", trans("messages.failed"));
}
public function activation(Request $request, $package)
{
if (!(config("app.demo") == true && config("app.debug") !== true)) {
goto X5wpQ;
}
return response("error", 444);
X5wpQ:
if (!($registered = Package::where("slug", $package)->first())) {
goto k_kyK;
}
$registered->active = !$registered->active;
$registered->save();
Artisan::call("cache:clear");
return response("success", 200);
k_kyK:
$unregistered = $this->scanPackages($package);
Log::info($unregistered);
if (!$unregistered) {
goto nFP6F;
}
$registered = Package::create($unregistered);
nFP6F:
return response("success", 200);
}
public function updateConfig(Request $request)
{
if (!updateOptionTable($request)) {
goto N3RVb;
}
Artisan::call("cache:clear");
return back()->with("success", trans("messages.package_settings_updated"));
N3RVb:
return back()->with("error", trans("messages.failed"));
}
public function toggleConfig(Request $request, $option)
{
if (!(config("app.demo") == true && config("app.debug") !== true)) {
goto hxdmO;
}
return response("error", 444);
hxdmO:
if (!DB::table("options")->where("option_name", $option)->update(["option_value" => DB::raw("NOT option_value")])) {
goto WydCI;
}
Artisan::call("cache:clear");
return response("success", 200);
WydCI:
return response("error", 405);
}
private function scanPackages($slug = null)
{
$packages = [];
foreach (glob(base_path("packages/*"), GLOB_ONLYDIR) as $dir) {
if (!file_exists($manifest = $dir . "/manifest.json")) {
goto pP_lm;
}
$json = file_get_contents($manifest);
if (!($json !== '')) {
goto aq220;
}
$data = json_decode($json, true);
if (!($data === null)) {
goto H01sz;
}
throw new \Exception("Invalid manifest.json file at [{$dir}]");
H01sz:
$data["path"] = $dir;
if (!($slug && $data["slug"] == $slug)) {
goto wsCzT;
}
return $data;
wsCzT:
$packages[] = $data;
aq220:
pP_lm:
ZHy6T:
}
fB9Tn:
return $packages;
}
}
?>
Did this file decode correctly?
Original Code
<?php
/*
* Copyright (C) Incevio Systems, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Munna Khan <[email protected]>, September 2018
*/
namespace App\Http\Controllers\Admin;
use App\Models\Package;
use App\Http\Controllers\Controller;
use App\Http\Requests\Validations\PackageInstallationRequest;
use App\Services\PackageInstaller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
class PackagesController extends Controller
{
public function index()
{
$installables = $this->scanPackages();
$installs = Package::all();
return view("\x61\x64\155\x69\x6e\x2e\160\141\143\153\141\x67\145\163\56\151\156\144\x65\170", compact("\x69\156\163\x74\x61\x6c\154\x61\142\x6c\145\163", "\x69\156\163\x74\x61\x6c\x6c\x73"));
}
public function upload()
{
return view("\141\x64\x6d\151\156\x2e\160\141\x63\153\141\x67\x65\x73\x2e\137\165\x70\154\x6f\x61\x64");
}
public function save(Request $request)
{
echo "\x3c\x70\162\x65\x3e";
print_r($request->all());
echo "\74\160\162\x65\76";
exit("\x65\156\144\x21");
}
public function initiate(Request $request, $package)
{
if (!(config("\141\160\160\56\144\145\155\x6f") == true && config("\x61\160\x70\56\144\x65\x62\165\147") !== true)) {
goto g6mHm;
}
return back()->with("\x77\141\162\156\151\156\147", trans("\x6d\145\x73\163\141\x67\145\163\x2e\144\x65\155\157\137\162\145\x73\x74\x72\151\x63\x74\151\x6f\x6e"));
g6mHm:
$installable = $this->scanPackages($package);
if (!$installable) {
goto e22GE;
}
if (!Package::where("\163\x6c\x75\147", $installable["\x73\154\x75\147"])->first()) {
goto vRZmM;
}
return back()->with("\145\162\162\157\x72", trans("\x6d\145\x73\163\x61\x67\x65\x73\56\160\141\143\x6b\141\x67\145\137\151\156\163\164\141\154\154\145\x64\137\x61\154\x72\x65\141\144\171", ["\160\x61\x63\x6b\x61\147\145" => $package]));
vRZmM:
e22GE:
return view("\141\x64\x6d\x69\x6e\56\x70\x61\x63\153\x61\x67\x65\163\x2e\137\151\x6e\151\x74\x69\x61\164\x65", compact("\x69\156\163\164\x61\154\154\x61\142\x6c\145"));
}
public function install(PackageInstallationRequest $request, $package)
{
if (!(config("\141\160\x70\56\x64\x65\155\x6f") == true && config("\x61\x70\160\56\144\x65\x62\x75\147") !== true)) {
goto Y_wIe;
}
return back()->with("\167\x61\x72\x6e\x69\156\x67", trans("\x6d\145\163\163\x61\147\x65\163\x2e\144\145\155\x6f\137\x72\x65\163\164\162\x69\143\x74\151\157\156"));
Y_wIe:
$installable = $this->scanPackages($package);
if (!$installable) {
goto HMyPV;
}
try {
$installer = new PackageInstaller($request, $installable);
$installer->install();
} catch (\Exception $e) {
Log::error($e);
$installer->uninstall();
$registered = Package::where("\163\x6c\x75\x67", $package)->first();
if (!$registered) {
goto DFfE0;
}
$registered->delete();
DFfE0:
return back()->with("\x65\x72\162\157\x72", $e->getMessage());
}
Artisan::call("\143\x61\143\x68\x65\72\143\x6c\145\x61\x72");
Artisan::call("\162\157\x75\164\x65\72\143\x6c\145\141\162");
return back()->with("\x73\x75\x63\x63\x65\x73\x73", trans("\155\x65\163\163\141\x67\x65\x73\x2e\160\x61\x63\x6b\141\147\x65\137\151\x6e\x73\x74\x61\154\x6c\x65\x64\137\163\165\143\143\145\x73\x73", ["\160\141\x63\153\141\147\145" => $package]));
HMyPV:
return back()->with("\x65\x72\162\x6f\162", trans("\x6d\145\163\163\x61\147\x65\163\56\146\x61\x69\x6c\145\x64"));
}
public function uninstall(Request $request, $package)
{
if (!(config("\141\x70\x70\x2e\144\145\x6d\157") == true && config("\141\160\160\56\x64\145\x62\x75\x67") !== true)) {
goto TgGOU;
}
return back()->with("\x77\x61\x72\156\x69\x6e\147", trans("\x6d\x65\163\x73\x61\x67\145\163\x2e\x64\x65\155\157\137\162\145\x73\164\x72\151\x63\164\151\x6f\x6e"));
TgGOU:
$registered = Package::where("\x73\154\x75\147", $package)->firstOrFail();
$uninstallable = $this->scanPackages($package);
DB::beginTransaction();
try {
$installer = new PackageInstaller($request, $uninstallable);
if (!$installer->uninstall()) {
goto tie2u;
}
Artisan::call("\143\141\143\x68\145\72\143\x6c\x65\141\x72");
Artisan::call("\162\157\165\164\145\72\143\x6c\x65\141\162");
if (!$registered->delete()) {
goto a8UMB;
}
$msg = trans("\155\145\x73\163\141\147\145\x73\x2e\x70\x61\143\x6b\141\x67\x65\137\165\x6e\x69\x6e\x73\164\141\x6c\154\x65\x64\137\163\x75\x63\x63\145\x73\163", ["\x70\x61\x63\x6b\141\147\145" => $package]);
DB::commit();
return back()->with("\x73\165\143\x63\145\163\x73", $msg);
a8UMB:
tie2u:
} catch (\Exception $e) {
DB::rollback();
Log::error($e);
return back()->with("\145\162\162\x6f\x72", $e->getMessage());
}
return back()->with("\x65\x72\x72\157\162", trans("\x6d\145\x73\163\x61\147\x65\x73\x2e\146\x61\x69\154\145\x64"));
}
public function activation(Request $request, $package)
{
if (!(config("\141\160\x70\56\x64\145\155\x6f") == true && config("\x61\x70\160\56\x64\x65\142\165\x67") !== true)) {
goto X5wpQ;
}
return response("\x65\162\162\x6f\x72", 444);
X5wpQ:
if (!($registered = Package::where("\x73\x6c\x75\147", $package)->first())) {
goto k_kyK;
}
$registered->active = !$registered->active;
$registered->save();
Artisan::call("\143\x61\x63\x68\x65\72\x63\x6c\x65\141\162");
return response("\x73\x75\143\143\x65\163\163", 200);
k_kyK:
$unregistered = $this->scanPackages($package);
Log::info($unregistered);
if (!$unregistered) {
goto nFP6F;
}
$registered = Package::create($unregistered);
nFP6F:
return response("\163\x75\x63\143\x65\x73\163", 200);
}
public function updateConfig(Request $request)
{
if (!updateOptionTable($request)) {
goto N3RVb;
}
Artisan::call("\x63\x61\143\150\x65\x3a\143\154\145\141\x72");
return back()->with("\x73\165\143\x63\145\x73\163", trans("\x6d\x65\x73\163\x61\147\x65\x73\56\160\x61\143\153\x61\x67\145\x5f\x73\x65\164\x74\x69\156\147\163\x5f\165\160\144\x61\164\145\x64"));
N3RVb:
return back()->with("\145\162\x72\x6f\x72", trans("\155\145\163\163\x61\147\x65\x73\x2e\146\141\x69\154\x65\144"));
}
public function toggleConfig(Request $request, $option)
{
if (!(config("\x61\160\160\x2e\144\x65\x6d\157") == true && config("\141\x70\160\x2e\144\145\142\x75\147") !== true)) {
goto hxdmO;
}
return response("\x65\162\162\157\x72", 444);
hxdmO:
if (!DB::table("\157\x70\164\x69\x6f\x6e\163")->where("\x6f\x70\x74\151\x6f\x6e\137\156\x61\155\x65", $option)->update(["\x6f\160\164\x69\x6f\156\x5f\166\x61\x6c\165\145" => DB::raw("\116\117\124\x20\157\x70\164\151\x6f\156\x5f\166\141\x6c\x75\x65")])) {
goto WydCI;
}
Artisan::call("\x63\x61\x63\150\145\72\x63\x6c\x65\141\x72");
return response("\x73\165\143\143\145\163\163", 200);
WydCI:
return response("\145\162\x72\157\x72", 405);
}
private function scanPackages($slug = null)
{
$packages = [];
foreach (glob(base_path("\160\141\143\x6b\x61\x67\x65\163\x2f\x2a"), GLOB_ONLYDIR) as $dir) {
if (!file_exists($manifest = $dir . "\57\x6d\141\x6e\151\146\x65\163\164\56\152\x73\157\x6e")) {
goto pP_lm;
}
$json = file_get_contents($manifest);
if (!($json !== '')) {
goto aq220;
}
$data = json_decode($json, true);
if (!($data === null)) {
goto H01sz;
}
throw new \Exception("\111\x6e\166\141\154\x69\144\40\x6d\x61\156\x69\x66\x65\163\164\56\x6a\x73\157\156\x20\x66\151\154\145\x20\x61\164\x20\133{$dir}\135");
H01sz:
$data["\x70\x61\164\x68"] = $dir;
if (!($slug && $data["\x73\154\x75\147"] == $slug)) {
goto wsCzT;
}
return $data;
wsCzT:
$packages[] = $data;
aq220:
pP_lm:
ZHy6T:
}
fB9Tn:
return $packages;
}
}
Function Calls
None |
Stats
MD5 | a0b8a187659723df7f8a63c2ff3a5cfc |
Eval Count | 0 |
Decode Time | 60 ms |