• The default language of any content posted is English.
    Do not create multi-accounts, you will be blocked!
6amTech Payment & SMS Gateway Addon

NULLED 6amTech Payment & SMS Gateway Addon 1.2 NULLED

raz0r

owner
Staff member
Administrator
Moderator
Messages
21,203
Files
6062
Reactions
82,131
raz0r submitted a new resource:

6amTech Payment & SMS Gateway Addon - Download 6amTech Payment SMS Gateway Addon Codecanyon ID 48481246

View attachment 22471

Introducing the new Payment & SMS Gateway addon from 6amTech. No matter where you want to run your business with 6amTech’s products, now you have multiple payment and SMS gateways to choose from. It packs with 33 payments and 14 SMS gateways.

Note: This addon isn’t an independent product. It only works with 6amTech-developed products.

Simply put, when you have multiple options in...

Read more about this resource...
 
raz0r 's signature
Reacted by:
  • Like
Reactions: justlipe, Peter55, hany and 2 others
Sorry, I installed it in this script. I don't know if they can work together or not.

 
Reacted by:
Sorry, I installed it in this script. I don't know if they can work together or not.

Open file app\Http\Controllers\Admin\System\AddonController.php
And replace all with this data:

And then enter any values in username and purchase code.
 
raz0r 's signature
Reacted by:
  • Like
  • Love
Reactions: yuyu, Ayyougo, wsd Dev and 67 others
Hi Can this also be used on 6valley Multi-Vendor E-commerce - Complete eCommerce Mobile App, Web, Seller and Admin Panel?
 
Reacted by:
Open file app\Http\Controllers\Admin\System\AddonController.php
And replace all with this data:
*** Hidden text: cannot be quoted. ***


And then enter any values in username and purchase code.
app\Http\Controllers\Admin\System\AddonController.php THIS IS NOT FOUND IN MAIN SCRIPT ...CAN SOMEONE HELP
 
Reacted by:
  • Like
Reactions: sobujmia76
app\Http\Controllers\Admin\System\AddonController.php THIS IS NOT FOUND IN MAIN SCRIPT ...CAN SOMEONE HELP
File - Modules\AddonModule\Http\Controllers\Web\Admin\AddonController.php

replace with
PHP:
<?php

namespace Modules\AddonModule\Http\Controllers\Web\Admin;

use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use function response;


class AddonController extends Controller
{
    /**
     * @return Factory|View|Application
     */
    public function index(): Factory|View|Application
    {
        $dir = 'Modules';
        $directories = self::getDirectories($dir);

        $addons = [];
        foreach ($directories as $directory) {
            $sub_dirs = self::getDirectories('Modules/' . $directory);
            if (in_array('Addon', $sub_dirs)) {
                $addons[] = 'Modules/' . $directory;
            }
        }

        $published_status = 0;
        $payment_published_status = config('get_payment_publish_status');
        if (isset($payment_published_status[0]['is_published'])) {
            $published_status = $payment_published_status[0]['is_published'];
        }

        return view('addonmodule::addon.index', compact('addons', 'published_status'));
    }

    /**
     * @param Request $request
     * @return JsonResponse|int
     */
    public function publish(Request $request): JsonResponse|int
    {

        $full_data = include($request['path'] . '/Addon/info.php');
        $path = $request['path'];
        $addon_name = $full_data['name'];

        if ($full_data['purchase_code'] == null || $full_data['username'] == null) {
            return response()->json([
                'flag' => 'inactive',
                'view' => view('addonmodule::addon.partials.activation-modal-data', compact('full_data', 'path', 'addon_name'))->render(),
            ]);
        }
        $full_data['is_published'] = $full_data['is_published'] ? 0 : 1;

        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        return response()->json([
            'status' => 'success',
            'message' => 'status_updated_successfully'
        ]);
    }

    /**
     * @param Request $request
     * @return Redirector|RedirectResponse|Application
     */
    public function activation(Request $request): Redirector|RedirectResponse|Application
    {
        $remove = ["http://", "https://", "www."];
        $url = str_replace($remove, "", url('/'));
        $full_data = include($request['path'] . '/Addon/info.php');

        $full_data['is_published'] = 1;
        $full_data['username'] = $request['username'];
        $full_data['purchase_code'] = $request['purchase_code'];
        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        Toastr::success(translate('activated_successfully'));
        return back();
    }

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function upload(Request $request): JsonResponse
    {
        $validator = Validator::make($request->all(), [
            'file_upload' => 'required|mimes:zip'
        ]);

        if ($validator->errors()->count() > 0) {
            $error = error_processor($validator);
            return response()->json(['status' => 'error', 'message' => $error[0]['message']]);
        }

        if (File::exists(base_path('Modules/').'/'.'Gateways')) {
            Toastr::warning(translate('already_installed!'));
            $message = translate('already_installed');
            $status = 'error';
            return response()->json([
                'status' => $status,
                'message' => $message
            ]);
        }

        $file = $request->file('file_upload');
        $filename = $file->getClientOriginalName();
        $tempPath = $file->storeAs('temp', $filename);
        $zip = new \ZipArchive();
        if ($zip->open(storage_path('app/' . $tempPath)) === TRUE) {
            // Extract the contents to a directory
            $extractPath = base_path('Modules/');
            $zip->extractTo($extractPath);
            $zip->close();
            if (File::exists($extractPath . '/' . explode('.', $filename)[0] . '/Addon/info.php')) {
                File::chmod($extractPath . '/' . explode('.', $filename)[0] . '/Addon', 0777);
                Toastr::success(translate('file_upload_successfully!'));
                $status = 'success';
                $message = translate('file_upload_successfully!');
            } else {
                File::deleteDirectory($extractPath . '/' . explode('.', $filename)[0]);
                $status = 'error';
                $message = translate('invalid_file!');
            }
        } else {
            $status = 'error';
            $message = translate('file_upload_fail!');
        }

        Storage::delete($tempPath);

        return response()->json([
            'status' => $status,
            'message' => $message
        ]);
    }

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function delete_theme(Request $request): JsonResponse
    {
        $path = $request->path;
        $full_path = base_path($path);

        if (File::deleteDirectory($full_path)) {
            return response()->json([
                'status' => 'success',
                'message' => translate('file_delete_successfully')
            ]);
        } else {
            return response()->json([
                'status' => 'error',
                'message' => translate('file_delete_fail')
            ]);
        }

    }

    //helper functions

    /**
     * @param string $path
     * @return array
     */
    function getDirectories(string $path): array
    {
        $directories = [];
        $items = scandir($path);
        foreach ($items as $item) {
            if ($item == '..' || $item == '.')
                continue;
            if (is_dir($path . '/' . $item))
                $directories[] = $item;
        }
        return $directories;
    }
}

activate with any username and pur code
 
raz0r 's signature
Reacted by:
  • Like
Reactions: justlipe
File - Modules\AddonModule\Http\Controllers\Web\Admin\AddonController.php

replace with
PHP:
<?php

namespace Modules\AddonModule\Http\Controllers\Web\Admin;

use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Validator;
use function response;


class AddonController extends Controller
{
    /**
     * @return Factory|View|Application
     */
    public function index(): Factory|View|Application
    {
        $dir = 'Modules';
        $directories = self::getDirectories($dir);

        $addons = [];
        foreach ($directories as $directory) {
            $sub_dirs = self::getDirectories('Modules/' . $directory);
            if (in_array('Addon', $sub_dirs)) {
                $addons[] = 'Modules/' . $directory;
            }
        }

        $published_status = 0;
        $payment_published_status = config('get_payment_publish_status');
        if (isset($payment_published_status[0]['is_published'])) {
            $published_status = $payment_published_status[0]['is_published'];
        }

        return view('addonmodule::addon.index', compact('addons', 'published_status'));
    }

    /**
     * @param Request $request
     * @return JsonResponse|int
     */
    public function publish(Request $request): JsonResponse|int
    {

        $full_data = include($request['path'] . '/Addon/info.php');
        $path = $request['path'];
        $addon_name = $full_data['name'];

        if ($full_data['purchase_code'] == null || $full_data['username'] == null) {
            return response()->json([
                'flag' => 'inactive',
                'view' => view('addonmodule::addon.partials.activation-modal-data', compact('full_data', 'path', 'addon_name'))->render(),
            ]);
        }
        $full_data['is_published'] = $full_data['is_published'] ? 0 : 1;

        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        return response()->json([
            'status' => 'success',
            'message' => 'status_updated_successfully'
        ]);
    }

    /**
     * @param Request $request
     * @return Redirector|RedirectResponse|Application
     */
    public function activation(Request $request): Redirector|RedirectResponse|Application
    {
        $remove = ["http://", "https://", "www."];
        $url = str_replace($remove, "", url('/'));
        $full_data = include($request['path'] . '/Addon/info.php');

        $full_data['is_published'] = 1;
        $full_data['username'] = $request['username'];
        $full_data['purchase_code'] = $request['purchase_code'];
        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        Toastr::success(translate('activated_successfully'));
        return back();
    }

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function upload(Request $request): JsonResponse
    {
        $validator = Validator::make($request->all(), [
            'file_upload' => 'required|mimes:zip'
        ]);

        if ($validator->errors()->count() > 0) {
            $error = error_processor($validator);
            return response()->json(['status' => 'error', 'message' => $error[0]['message']]);
        }

        if (File::exists(base_path('Modules/').'/'.'Gateways')) {
            Toastr::warning(translate('already_installed!'));
            $message = translate('already_installed');
            $status = 'error';
            return response()->json([
                'status' => $status,
                'message' => $message
            ]);
        }

        $file = $request->file('file_upload');
        $filename = $file->getClientOriginalName();
        $tempPath = $file->storeAs('temp', $filename);
        $zip = new \ZipArchive();
        if ($zip->open(storage_path('app/' . $tempPath)) === TRUE) {
            // Extract the contents to a directory
            $extractPath = base_path('Modules/');
            $zip->extractTo($extractPath);
            $zip->close();
            if (File::exists($extractPath . '/' . explode('.', $filename)[0] . '/Addon/info.php')) {
                File::chmod($extractPath . '/' . explode('.', $filename)[0] . '/Addon', 0777);
                Toastr::success(translate('file_upload_successfully!'));
                $status = 'success';
                $message = translate('file_upload_successfully!');
            } else {
                File::deleteDirectory($extractPath . '/' . explode('.', $filename)[0]);
                $status = 'error';
                $message = translate('invalid_file!');
            }
        } else {
            $status = 'error';
            $message = translate('file_upload_fail!');
        }

        Storage::delete($tempPath);

        return response()->json([
            'status' => $status,
            'message' => $message
        ]);
    }

    /**
     * @param Request $request
     * @return JsonResponse
     */
    public function delete_theme(Request $request): JsonResponse
    {
        $path = $request->path;
        $full_path = base_path($path);

        if (File::deleteDirectory($full_path)) {
            return response()->json([
                'status' => 'success',
                'message' => translate('file_delete_successfully')
            ]);
        } else {
            return response()->json([
                'status' => 'error',
                'message' => translate('file_delete_fail')
            ]);
        }

    }

    //helper functions

    /**
     * @param string $path
     * @return array
     */
    function getDirectories(string $path): array
    {
        $directories = [];
        $items = scandir($path);
        foreach ($items as $item) {
            if ($item == '..' || $item == '.')
                continue;
            if (is_dir($path . '/' . $item))
                $directories[] = $item;
        }
        return $directories;
    }
}

activate with any username and pur code
Hi Razor please also help for 6valley, I can't see the directory
 
Reacted by:
  • Like
Reactions: qweuser
Open file app\Http\Controllers\Admin\System\AddonController.php
And replace all with this data:
*** Hidden text: cannot be quoted. ***


And then enter any values in username and purchase code.
not working this shows the error
 
Reacted by:
Hi Razor please also help for 6valley, I can't see the directory
app\Http\Controllers\Admin\AddonController.php

replace with:

PHP:
<?php

namespace App\Http\Controllers\Admin;

use App\CPU\Helpers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Validator;
use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Http;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Redirector;
use Illuminate\Http\RedirectResponse;

class AddonController extends Controller
{
    public function index()
    {
        $module_dir = base_path('Modules/');
        if (!File::exists($module_dir)) {
            File::makeDirectory($module_dir);
            File::chmod($module_dir, 0777);
        }

        $dir = 'Modules';
        $directories = self::getDirectories($dir);
        $addons = [];
        foreach ($directories as $directory) {
            $sub_dirs = self::getDirectories('Modules/' . $directory);
            if (in_array('Addon', $sub_dirs)) {
                $addons[] = 'Modules/' . $directory;
            }
        }
        return view('admin-views.addons.index', compact('addons'));
    }

    public function publish(Request $request): JsonResponse|int
    {
        $full_data = include($request['path'] . '/Addon/info.php');
        $path = $request['path'];
        $addon_name = $full_data['name'];
        if ($full_data['purchase_code'] == null || $full_data['username'] == null) {
            return response()->json([
                'flag' => 'inactive',
                'view' => view('admin-views.addons.partials.activation-modal-data', compact('full_data', 'path', 'addon_name'))->render(),
            ]);
        }
        $full_data['is_published'] = $full_data['is_published'] ? 0 : 1;

        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        return response()->json([
            'status' => 'success',
            'message'=> 'status_updated_successfully'
        ]);
    }

    public function activation(Request $request): Redirector|RedirectResponse|Application
    {
        $remove = ["http://", "https://", "www."];
        $url = str_replace($remove, "", url('/'));
        $full_data = include($request['path'] . '/Addon/info.php');

        $full_data['is_published'] = 1;
        $full_data['username'] = $request['username'];
        $full_data['purchase_code'] = $request['purchase_code'];
        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        Toastr::success(translate('activated_successfully'));
        return back();
    }

    public function upload(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'file_upload' => 'required|mimes:zip'
        ]);

        if ($validator->errors()->count() > 0) {
            $error = Helpers::error_processor($validator);
            return response()->json(['status' => 'error', 'message' => $error[0]['message']]);
        }

        $extractPath = storage_path('app/temp/');
        if (!File::exists($extractPath)) {
            File::makeDirectory($extractPath);
        }

        $file = $request->file('file_upload');
        $filename = $file->getClientOriginalName();
        $tempPath = $file->storeAs('temp', $filename);
        $zip = new \ZipArchive();

        if ($zip->open(storage_path('app/' . $tempPath)) === TRUE) {
            // Extract the contents to a directory
            $zip->extractTo($extractPath);
            $zip->close();
            Storage::delete($tempPath);

            if(File::exists($extractPath.'/'.explode('.', $filename)[0].'/Addon/info.php')){

                $moveToPath = base_path('Modules/');
                if (!File::exists($moveToPath)) {
                    File::makeDirectory($moveToPath);
                }

                if (File::exists($moveToPath.'/'.explode('.', $filename)[0])) {
                    Toastr::warning(translate('already_installed!'));
                    $message = translate('already_installed');
                    $status = 'error';
                }else{
                    File::copyDirectory($extractPath, $moveToPath);
                    File::chmod($moveToPath, 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0], 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0].'/Addon', 0777);
                    Toastr::success(translate('file_upload_successfully!'));
                    $status = 'success';
                    $message = translate('file_upload_successfully!');
                }
            }else{
                File::deleteDirectory($extractPath.'/'.explode('.', $filename)[0]);
                $status = 'error';
                $message = translate('invalid_file!');
            }
        }else{
            $status = 'error';
            $message = translate('file_upload_fail!');
        }

        File::deleteDirectory($extractPath);

        return response()->json([
            'status' => $status,
            'message'=> $message
        ]);
    }

    public function delete_theme(Request $request){
        $path = $request->path;

        $full_path = base_path($path);

        $old = base_path('app/Traits/Payment.php');
        $new = base_path('app/Traits/Payment.txt');
        copy($new, $old);

        if(File::deleteDirectory($full_path)){
            return response()->json([
                'status' => 'success',
                'message'=> translate('file_delete_successfully')
            ]);
        }else{
            return response()->json([
                'status' => 'error',
                'message'=> translate('file_delete_fail')
            ]);
        }
    }

    //helper functions
    function getDirectories(string $path): array
    {
        $directories = [];
        $items = scandir($path);
        foreach ($items as $item) {
            if ($item == '..' || $item == '.')
                continue;
            if (is_dir($path . '/' . $item))
                $directories[] = $item;
        }
        return $directories;
    }
}
 
raz0r 's signature
app\Http\Controllers\Admin\AddonController.php

replace with:

PHP:
<?php

namespace App\Http\Controllers\Admin;

use App\CPU\Helpers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Validator;
use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Http;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Redirector;
use Illuminate\Http\RedirectResponse;

class AddonController extends Controller
{
    public function index()
    {
        $module_dir = base_path('Modules/');
        if (!File::exists($module_dir)) {
            File::makeDirectory($module_dir);
            File::chmod($module_dir, 0777);
        }

        $dir = 'Modules';
        $directories = self::getDirectories($dir);
        $addons = [];
        foreach ($directories as $directory) {
            $sub_dirs = self::getDirectories('Modules/' . $directory);
            if (in_array('Addon', $sub_dirs)) {
                $addons[] = 'Modules/' . $directory;
            }
        }
        return view('admin-views.addons.index', compact('addons'));
    }

    public function publish(Request $request): JsonResponse|int
    {
        $full_data = include($request['path'] . '/Addon/info.php');
        $path = $request['path'];
        $addon_name = $full_data['name'];
        if ($full_data['purchase_code'] == null || $full_data['username'] == null) {
            return response()->json([
                'flag' => 'inactive',
                'view' => view('admin-views.addons.partials.activation-modal-data', compact('full_data', 'path', 'addon_name'))->render(),
            ]);
        }
        $full_data['is_published'] = $full_data['is_published'] ? 0 : 1;

        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        return response()->json([
            'status' => 'success',
            'message'=> 'status_updated_successfully'
        ]);
    }

    public function activation(Request $request): Redirector|RedirectResponse|Application
    {
        $remove = ["http://", "https://", "www."];
        $url = str_replace($remove, "", url('/'));
        $full_data = include($request['path'] . '/Addon/info.php');

        $full_data['is_published'] = 1;
        $full_data['username'] = $request['username'];
        $full_data['purchase_code'] = $request['purchase_code'];
        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        Toastr::success(translate('activated_successfully'));
        return back();
    }

    public function upload(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'file_upload' => 'required|mimes:zip'
        ]);

        if ($validator->errors()->count() > 0) {
            $error = Helpers::error_processor($validator);
            return response()->json(['status' => 'error', 'message' => $error[0]['message']]);
        }

        $extractPath = storage_path('app/temp/');
        if (!File::exists($extractPath)) {
            File::makeDirectory($extractPath);
        }

        $file = $request->file('file_upload');
        $filename = $file->getClientOriginalName();
        $tempPath = $file->storeAs('temp', $filename);
        $zip = new \ZipArchive();

        if ($zip->open(storage_path('app/' . $tempPath)) === TRUE) {
            // Extract the contents to a directory
            $zip->extractTo($extractPath);
            $zip->close();
            Storage::delete($tempPath);

            if(File::exists($extractPath.'/'.explode('.', $filename)[0].'/Addon/info.php')){

                $moveToPath = base_path('Modules/');
                if (!File::exists($moveToPath)) {
                    File::makeDirectory($moveToPath);
                }

                if (File::exists($moveToPath.'/'.explode('.', $filename)[0])) {
                    Toastr::warning(translate('already_installed!'));
                    $message = translate('already_installed');
                    $status = 'error';
                }else{
                    File::copyDirectory($extractPath, $moveToPath);
                    File::chmod($moveToPath, 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0], 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0].'/Addon', 0777);
                    Toastr::success(translate('file_upload_successfully!'));
                    $status = 'success';
                    $message = translate('file_upload_successfully!');
                }
            }else{
                File::deleteDirectory($extractPath.'/'.explode('.', $filename)[0]);
                $status = 'error';
                $message = translate('invalid_file!');
            }
        }else{
            $status = 'error';
            $message = translate('file_upload_fail!');
        }

        File::deleteDirectory($extractPath);

        return response()->json([
            'status' => $status,
            'message'=> $message
        ]);
    }

    public function delete_theme(Request $request){
        $path = $request->path;

        $full_path = base_path($path);

        $old = base_path('app/Traits/Payment.php');
        $new = base_path('app/Traits/Payment.txt');
        copy($new, $old);

        if(File::deleteDirectory($full_path)){
            return response()->json([
                'status' => 'success',
                'message'=> translate('file_delete_successfully')
            ]);
        }else{
            return response()->json([
                'status' => 'error',
                'message'=> translate('file_delete_fail')
            ]);
        }
    }

    //helper functions
    function getDirectories(string $path): array
    {
        $directories = [];
        $items = scandir($path);
        foreach ($items as $item) {
            if ($item == '..' || $item == '.')
                continue;
            if (is_dir($path . '/' . $item))
                $directories[] = $item;
        }
        return $directories;
    }
}
Thanks, you are a star!
 
Reacted by:
app\Http\Controllers\Admin\AddonController.php

replace with:

PHP:
<?php

namespace App\Http\Controllers\Admin;

use App\CPU\Helpers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Validator;
use Brian2694\Toastr\Facades\Toastr;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Http;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Routing\Redirector;
use Illuminate\Http\RedirectResponse;

class AddonController extends Controller
{
    public function index()
    {
        $module_dir = base_path('Modules/');
        if (!File::exists($module_dir)) {
            File::makeDirectory($module_dir);
            File::chmod($module_dir, 0777);
        }

        $dir = 'Modules';
        $directories = self::getDirectories($dir);
        $addons = [];
        foreach ($directories as $directory) {
            $sub_dirs = self::getDirectories('Modules/' . $directory);
            if (in_array('Addon', $sub_dirs)) {
                $addons[] = 'Modules/' . $directory;
            }
        }
        return view('admin-views.addons.index', compact('addons'));
    }

    public function publish(Request $request): JsonResponse|int
    {
        $full_data = include($request['path'] . '/Addon/info.php');
        $path = $request['path'];
        $addon_name = $full_data['name'];
        if ($full_data['purchase_code'] == null || $full_data['username'] == null) {
            return response()->json([
                'flag' => 'inactive',
                'view' => view('admin-views.addons.partials.activation-modal-data', compact('full_data', 'path', 'addon_name'))->render(),
            ]);
        }
        $full_data['is_published'] = $full_data['is_published'] ? 0 : 1;

        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        return response()->json([
            'status' => 'success',
            'message'=> 'status_updated_successfully'
        ]);
    }

    public function activation(Request $request): Redirector|RedirectResponse|Application
    {
        $remove = ["http://", "https://", "www."];
        $url = str_replace($remove, "", url('/'));
        $full_data = include($request['path'] . '/Addon/info.php');

        $full_data['is_published'] = 1;
        $full_data['username'] = $request['username'];
        $full_data['purchase_code'] = $request['purchase_code'];
        $str = "<?php return " . var_export($full_data, true) . ";";
        file_put_contents(base_path($request['path'] . '/Addon/info.php'), $str);

        Toastr::success(translate('activated_successfully'));
        return back();
    }

    public function upload(Request $request)
    {
        $validator = Validator::make($request->all(), [
            'file_upload' => 'required|mimes:zip'
        ]);

        if ($validator->errors()->count() > 0) {
            $error = Helpers::error_processor($validator);
            return response()->json(['status' => 'error', 'message' => $error[0]['message']]);
        }

        $extractPath = storage_path('app/temp/');
        if (!File::exists($extractPath)) {
            File::makeDirectory($extractPath);
        }

        $file = $request->file('file_upload');
        $filename = $file->getClientOriginalName();
        $tempPath = $file->storeAs('temp', $filename);
        $zip = new \ZipArchive();

        if ($zip->open(storage_path('app/' . $tempPath)) === TRUE) {
            // Extract the contents to a directory
            $zip->extractTo($extractPath);
            $zip->close();
            Storage::delete($tempPath);

            if(File::exists($extractPath.'/'.explode('.', $filename)[0].'/Addon/info.php')){

                $moveToPath = base_path('Modules/');
                if (!File::exists($moveToPath)) {
                    File::makeDirectory($moveToPath);
                }

                if (File::exists($moveToPath.'/'.explode('.', $filename)[0])) {
                    Toastr::warning(translate('already_installed!'));
                    $message = translate('already_installed');
                    $status = 'error';
                }else{
                    File::copyDirectory($extractPath, $moveToPath);
                    File::chmod($moveToPath, 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0], 0777);
                    File::chmod($moveToPath.'/'.explode('.', $filename)[0].'/Addon', 0777);
                    Toastr::success(translate('file_upload_successfully!'));
                    $status = 'success';
                    $message = translate('file_upload_successfully!');
                }
            }else{
                File::deleteDirectory($extractPath.'/'.explode('.', $filename)[0]);
                $status = 'error';
                $message = translate('invalid_file!');
            }
        }else{
            $status = 'error';
            $message = translate('file_upload_fail!');
        }

        File::deleteDirectory($extractPath);

        return response()->json([
            'status' => $status,
            'message'=> $message
        ]);
    }

    public function delete_theme(Request $request){
        $path = $request->path;

        $full_path = base_path($path);

        $old = base_path('app/Traits/Payment.php');
        $new = base_path('app/Traits/Payment.txt');
        copy($new, $old);

        if(File::deleteDirectory($full_path)){
            return response()->json([
                'status' => 'success',
                'message'=> translate('file_delete_successfully')
            ]);
        }else{
            return response()->json([
                'status' => 'error',
                'message'=> translate('file_delete_fail')
            ]);
        }
    }

    //helper functions
    function getDirectories(string $path): array
    {
        $directories = [];
        $items = scandir($path);
        foreach ($items as $item) {
            if ($item == '..' || $item == '.')
                continue;
            if (is_dir($path . '/' . $item))
                $directories[] = $item;
        }
        return $directories;
    }
}
Hi @Razor please help for 6valley Version 14.2(Hotfix) – 03 November 2023 , after editing the file [app\Http\Controllers\Admin\AddonController.php] here is the error :

Server Error​

We are sorry server is not responding.
Try after sometime.
 
Reacted by:
  • Like
Reactions: abex4real2, sobujmia76 and Alex002
not working with Stackfood 7.2
can u please make edit for Stackfood 7.2 please
 
Reacted by:
Top