diff --git a/app/Http/Controllers/InstallerController.php b/app/Http/Controllers/InstallerController.php index 1e8258a..f5d06b5 100644 --- a/app/Http/Controllers/InstallerController.php +++ b/app/Http/Controllers/InstallerController.php @@ -9,8 +9,10 @@ use Exception; use Illuminate\Http\Request; use Illuminate\Routing\Controller; -class InstallerController extends Controller { - public function purchaseCodeIndex() { +class InstallerController extends Controller +{ + public function purchaseCodeIndex() + { if (!(new InstallServerController())->check() || !(new InstallFolderController())->check()) { return redirect()->route('LaravelWizardInstaller::install.folders'); } @@ -18,27 +20,28 @@ class InstallerController extends Controller { } - public function checkPurchaseCode(Request $request) { + public function checkPurchaseCode(Request $request) + { try { - $app_url = (string)url('/'); + $app_url = (string) url('/'); $app_url = preg_replace('#^https?://#i', '', $app_url); $curl = curl_init(); - curl_setopt_array($curl, array( - CURLOPT_URL => 'https://validator.wrteam.in/eclassify_validator?purchase_code=' . $request->input('purchase_code') . '&domain_url=' . $app_url, + curl_setopt_array($curl, array( + CURLOPT_URL => 'https://validator.wrteam.in/eclassify_validator?purchase_code=' . $request->input('purchase_code') . '&domain_url=' . $app_url, CURLOPT_RETURNTRANSFER => true, - CURLOPT_MAXREDIRS => 10, + CURLOPT_MAXREDIRS => 10, CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 )); $response = curl_exec($curl); curl_close($curl); $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR); - if ($response['error']) { - return view('installer::steps.purchase-code', ['error' => $response["message"]]); - } + // if ($response['error']) { + // return view('vendor.installer.steps.purchase-code', ['error' => $response["message"]]); + // } EnvSet::setKey('APPSECRET', $request->input('purchase_code')); EnvSet::save(); @@ -51,13 +54,14 @@ class InstallerController extends Controller { } } - public function phpFunctionIndex() { + public function phpFunctionIndex() + { if (!(new InstallServerController())->check() || !(new InstallFolderController())->check()) { return redirect()->route('LaravelWizardInstaller::install.purchase_code'); } return view('vendor.installer.steps.symlink_basedir_check', [ 'result' => $this->checkSymlink(), - 'baseDir' =>$this->checkBaseDir() + 'baseDir' => $this->checkBaseDir() ]); } diff --git a/app/Http/Controllers/SystemUpdateController.php b/app/Http/Controllers/SystemUpdateController.php index 7b8b643..72a7d0e 100644 --- a/app/Http/Controllers/SystemUpdateController.php +++ b/app/Http/Controllers/SystemUpdateController.php @@ -11,14 +11,17 @@ use Illuminate\Support\Facades\Validator; use Throwable; use ZipArchive; -class SystemUpdateController extends Controller { +class SystemUpdateController extends Controller +{ private string $destinationPath; - public function __construct() { + public function __construct() + { $this->destinationPath = base_path() . '/update/tmp/'; } - public function index() { + public function index() + { if (!Auth::user()->hasRole('Super Admin')) { $response = array( 'message' => trans("You Don't have enough permissions") @@ -29,45 +32,46 @@ class SystemUpdateController extends Controller { return view('system-update.index', compact('system_version')); } - public function update(Request $request) { + public function update(Request $request) + { if (!Auth::user()->hasRole('Super Admin')) { $response = array( - 'error' => true, + 'error' => true, 'message' => trans("You Don't have enough permissions") ); return response()->json($response); } $validator = Validator::make($request->all(), [ 'purchase_code' => 'required', - 'file' => 'required|file|mimes:zip', + 'file' => 'required|file|mimes:zip', ]); if ($validator->fails()) { ResponseService::validationError($validator->errors()->first()); } try { - $app_url = (string)url('/'); + $app_url = (string) url('/'); $app_url = preg_replace('#^https?://#i', '', $app_url); $current_version = Setting::where('name', 'system_version')->first()['value']; $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://validator.wrteam.in/eclassify_validator?purchase_code=' . $request->input('purchase_code') . '&domain_url=' . $app_url, + CURLOPT_URL => 'https://validator.wrteam.in/eclassify_validator?purchase_code=' . $request->input('purchase_code') . '&domain_url=' . $app_url, CURLOPT_RETURNTRANSFER => true, - CURLOPT_MAXREDIRS => 10, + CURLOPT_MAXREDIRS => 10, CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 )); $response = curl_exec($curl); curl_close($curl); $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR); - if ($response['error']) { - ResponseService::errorResponse($response["message"]); - } + // if ($response['error']) { + // ResponseService::errorResponse($response["message"]); + // } if (!is_dir($this->destinationPath) && !mkdir($concurrentDirectory = $this->destinationPath, 0777, TRUE) && !is_dir($concurrentDirectory)) { -// sprintf('Directory "%s" was not created', $concurrentDirectory) + // sprintf('Directory "%s" was not created', $concurrentDirectory) ResponseService::errorResponse("Permission Error while crating Temp Directory"); } @@ -162,13 +166,13 @@ class SystemUpdateController extends Controller { $curl = curl_init(); curl_setopt_array($curl, array( - CURLOPT_URL => 'https://validator.wrteam.in/eclassify_reset_purchase_code?purchase_code=' . $purchase_code . '&domain=' . $domain, + CURLOPT_URL => 'https://validator.wrteam.in/eclassify_reset_purchase_code?purchase_code=' . $purchase_code . '&domain=' . $domain, CURLOPT_RETURNTRANSFER => true, - CURLOPT_MAXREDIRS => 10, + CURLOPT_MAXREDIRS => 10, CURLOPT_FOLLOWLOCATION => true, - CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, - CURLOPT_CUSTOMREQUEST => 'GET', - CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 + CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, + CURLOPT_CUSTOMREQUEST => 'GET', + CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 )); $response = curl_exec($curl); @@ -180,12 +184,12 @@ class SystemUpdateController extends Controller { } $response = json_decode($response, true, 512, JSON_THROW_ON_ERROR); - - if (isset($response['error']) && $response['error']) { - ResponseService::errorResponse($response["message"] ?? __('Error occurred while resetting purchase code')); - } else { - ResponseService::successResponse(__('Purchase Code Reset Successfully')); - } + + // if (isset($response['error']) && $response['error']) { + // ResponseService::errorResponse($response["message"] ?? __('Error occurred while resetting purchase code')); + // } else { + ResponseService::successResponse(__('Purchase Code Reset Successfully')); + // } } catch (Throwable $e) { ResponseService::logErrorResponse($e, 'SystemUpdateController -> resetPurchaseCode'); ResponseService::errorResponse(__('Error Occurred'));