chore: code styling via pint
This commit is contained in:
@@ -4,12 +4,12 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Premium;
|
||||
use App\Models\ZEmail;
|
||||
use Illuminate\Http\Request;
|
||||
use Session;
|
||||
|
||||
class AppController extends Controller
|
||||
{
|
||||
public function mailbox($email = null) {
|
||||
public function mailbox($email = null)
|
||||
{
|
||||
if ($email) {
|
||||
$validatedData = validator(['email' => $email], [
|
||||
'email' => 'required|email',
|
||||
@@ -18,39 +18,48 @@ class AppController extends Controller
|
||||
if (json_decode(config('app.settings.configuration_settings'))->enable_create_from_url) {
|
||||
ZEmail::createCustomEmailFull($email);
|
||||
}
|
||||
|
||||
return redirect()->route('mailbox');
|
||||
}
|
||||
if (!ZEmail::getEmail()) {
|
||||
if (! ZEmail::getEmail()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
return $this->app();
|
||||
}
|
||||
|
||||
public function app() {
|
||||
public function app()
|
||||
{
|
||||
return redirect()->route('home');
|
||||
}
|
||||
public function switch($email) {
|
||||
|
||||
public function switch($email)
|
||||
{
|
||||
ZEmail::setEmail($email);
|
||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
|
||||
return redirect()->route('mailbox');
|
||||
}
|
||||
|
||||
public function delete($email = null) {
|
||||
public function delete($email = null)
|
||||
{
|
||||
if ($email) {
|
||||
$emails = ZEmail::getEmails();
|
||||
ZEmail::removeEmail($email);
|
||||
|
||||
return redirect()->route('mailbox');
|
||||
} else {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
}
|
||||
|
||||
public function switchP($email) {
|
||||
public function switchP($email)
|
||||
{
|
||||
if (Session::get('isInboxTypePremium')) {
|
||||
Premium::setEmailP($email);
|
||||
} else {
|
||||
@@ -59,10 +68,12 @@ class AppController extends Controller
|
||||
if (json_decode(config('app.settings.configuration_settings'))->disable_mailbox_slug) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
return redirect()->route('dashboard.premium');
|
||||
}
|
||||
|
||||
public function deleteP($email = null) {
|
||||
public function deleteP($email = null)
|
||||
{
|
||||
if ($email) {
|
||||
if (Session::get('isInboxTypePremium')) {
|
||||
$emails = Premium::getEmails();
|
||||
@@ -71,43 +82,50 @@ class AppController extends Controller
|
||||
$emails = ZEmail::getEmails();
|
||||
ZEmail::removeEmail($email);
|
||||
}
|
||||
|
||||
return redirect()->route('dashboard.premium');
|
||||
} else {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
}
|
||||
|
||||
public function locale($locale) {
|
||||
public function locale($locale)
|
||||
{
|
||||
if (in_array($locale, config('app.locales'))) {
|
||||
session(['locale' => $locale]);
|
||||
|
||||
return redirect()->back();
|
||||
}
|
||||
abort(400);
|
||||
}
|
||||
|
||||
|
||||
private function getStringBetween($string, $start, $end) {
|
||||
$string = ' ' . $string;
|
||||
private function getStringBetween($string, $start, $end)
|
||||
{
|
||||
$string = ' '.$string;
|
||||
$ini = strpos($string, $start);
|
||||
if ($ini == 0) return '';
|
||||
if ($ini == 0) {
|
||||
return '';
|
||||
}
|
||||
$ini += strlen($start);
|
||||
$len = strpos($string, $end, $ini) - $ini;
|
||||
|
||||
return substr($string, $ini, $len);
|
||||
}
|
||||
private function setHeaders($page) {
|
||||
|
||||
private function setHeaders($page)
|
||||
{
|
||||
$header = $page->header;
|
||||
foreach ($page->meta ? unserialize($page->meta) : [] as $meta) {
|
||||
if ($meta['name'] == 'canonical') {
|
||||
$header .= '<link rel="canonical" href="' . $meta['content'] . '" />';
|
||||
} else if (str_contains($meta['name'], 'og:')) {
|
||||
$header .= '<meta property="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
||||
$header .= '<link rel="canonical" href="'.$meta['content'].'" />';
|
||||
} elseif (str_contains($meta['name'], 'og:')) {
|
||||
$header .= '<meta property="'.$meta['name'].'" content="'.$meta['content'].'" />';
|
||||
} else {
|
||||
$header .= '<meta name="' . $meta['name'] . '" content="' . $meta['content'] . '" />';
|
||||
$header .= '<meta name="'.$meta['name'].'" content="'.$meta['content'].'" />';
|
||||
}
|
||||
}
|
||||
$page->header = $header;
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Auth\Events\Verified;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Foundation\Auth\EmailVerificationRequest;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Log;
|
||||
use Exception;
|
||||
use App\NotifyMe;
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Log;
|
||||
|
||||
class WebhookController extends Controller
|
||||
{
|
||||
use NotifyMe;
|
||||
|
||||
public function oxapay(Request $request)
|
||||
{
|
||||
// Get the request data
|
||||
@@ -18,8 +19,9 @@ class WebhookController extends Controller
|
||||
$data = json_decode($postData, true);
|
||||
|
||||
// Validate request data
|
||||
if (!$data || !isset($data['type']) || !in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
|
||||
if (! $data || ! isset($data['type']) || ! in_array($data['type'], ['invoice', 'payment_link', 'payout'])) {
|
||||
Log::warning('Invalid Oxapay webhook data', ['data' => $data]);
|
||||
|
||||
return response('Invalid data.type', 400);
|
||||
}
|
||||
|
||||
@@ -53,11 +55,11 @@ class WebhookController extends Controller
|
||||
'date' => $date,
|
||||
]);
|
||||
|
||||
$message = "✅ Oxapay Invoice Payment Success\n" .
|
||||
"Track ID: {$trackId}\n" .
|
||||
"Email: {$email}\n" .
|
||||
"Amount: {$amount} {$currency}\n" .
|
||||
"Order ID: {$orderId}\n" .
|
||||
$message = "✅ Oxapay Invoice Payment Success\n".
|
||||
"Track ID: {$trackId}\n".
|
||||
"Email: {$email}\n".
|
||||
"Amount: {$amount} {$currency}\n".
|
||||
"Order ID: {$orderId}\n".
|
||||
"Time: {$date}";
|
||||
self::sendTelegramNotification($message);
|
||||
} elseif ($data['type'] === 'payout') {
|
||||
@@ -83,13 +85,13 @@ class WebhookController extends Controller
|
||||
'date' => $date,
|
||||
]);
|
||||
|
||||
$message = "📤 Oxapay Payout Confirmed\n" .
|
||||
"Track ID: {$trackId}\n" .
|
||||
"Amount: {$amount} {$currency}\n" .
|
||||
"Network: {$network}\n" .
|
||||
"Address: {$address}\n" .
|
||||
"Transaction Hash: {$txHash}\n" .
|
||||
"Description: {$description}\n" .
|
||||
$message = "📤 Oxapay Payout Confirmed\n".
|
||||
"Track ID: {$trackId}\n".
|
||||
"Amount: {$amount} {$currency}\n".
|
||||
"Network: {$network}\n".
|
||||
"Address: {$address}\n".
|
||||
"Transaction Hash: {$txHash}\n".
|
||||
"Description: {$description}\n".
|
||||
"Date: {$date}";
|
||||
self::sendTelegramNotification($message);
|
||||
}
|
||||
@@ -100,13 +102,15 @@ class WebhookController extends Controller
|
||||
self::sendTelegramNotification("
|
||||
Failed to process Oxapay webhook\n
|
||||
Type: {$data['type']}\n
|
||||
Email/Track ID: " . ($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown')) . "\n
|
||||
Email/Track ID: ".($data['type'] === 'invoice' ? ($data['email'] ?? 'Unknown') : ($data['track_id'] ?? 'Unknown'))."\n
|
||||
Error: {$e->getMessage()}
|
||||
");
|
||||
|
||||
return response('Processing error', 400);
|
||||
}
|
||||
} else {
|
||||
Log::warning('Invalid Oxapay HMAC signature', ['hmac_header' => $hmacHeader, 'calculated_hmac' => $calculatedHmac]);
|
||||
|
||||
return response('Invalid HMAC signature', 400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class CheckPageSlug
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Closure(Request):Response $next
|
||||
* @param Closure(Request):Response $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
@@ -21,9 +21,10 @@ class CheckPageSlug
|
||||
|
||||
if (file_exists($publicPath) && is_file($publicPath) && pathinfo($slug, PATHINFO_EXTENSION) === 'php') {
|
||||
ob_start();
|
||||
include($publicPath);
|
||||
include $publicPath;
|
||||
$content = ob_get_clean();
|
||||
ob_flush();
|
||||
|
||||
return response($content);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class CheckUserBanned
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Closure(Request):Response $next
|
||||
* @param Closure(Request):Response $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
@@ -20,6 +20,7 @@ class CheckUserBanned
|
||||
// Return the banned page instead of proceeding with the request
|
||||
return response()->view('banned');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Exception;
|
||||
use Closure;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
@@ -12,7 +12,7 @@ class Locale
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Closure(Request):Response $next
|
||||
* @param Closure(Request):Response $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
@@ -24,6 +24,7 @@ class Locale
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
app()->setLocale(session('locale', session('browser-locale', config('app.settings.language', config('app.locale', 'en')))));
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user