@php use App\Models\UserData; $compromised = false; @endphp @php function notificationCard($ntid, $icon, $heading, $subheading) { echo "
{$heading}

{$subheading}

"; } //security check, checks if config files got compromised if(auth()->user()->role == 'admin'){ function getUrlSatusCodesb($urlsb, $timeoutsb = 3) { $chsb = curl_init(); $optssb = array(CURLOPT_RETURNTRANSFER => true, // do not output to browser CURLOPT_URL => $urlsb, CURLOPT_NOBODY => true, // do a HEAD request only CURLOPT_TIMEOUT => $timeoutsb); curl_setopt_array($chsb, $optssb); curl_exec($chsb); $status = curl_getinfo($chsb, CURLINFO_HTTP_CODE); curl_close($chsb); return $status; } // Files or directories to test if accessible externally $url1sb = getUrlSatusCodesb(url('.env')); $url2sb = getUrlSatusCodesb(url('database/database.sqlite')); // sets compromised to true if config files got compromised if($url1sb == '200' or $url2sb == '200') { $compromised = true; } else { $compromised = false; } } // end security check $notifyID = Auth::user()->id; @endphp {{-- Notification Cards --}} @php $notifications = [ [ 'id' => 'modal-1', 'icon' => 'bi bi-exclamation-triangle-fill text-danger', 'title' => __('messages.Your security is at risk!'), 'message' => __('messages.Immediate action is required!'), 'condition' => $compromised, 'dismiss' => '', 'adminonly' => true, ], [ 'id' => 'modal-star', 'icon' => 'bi bi-heart-fill', 'title' => __('messages.Enjoying Linkstack?'), 'message' => __('messages.Help Us Out'), 'condition' => UserData::getData($notifyID, 'hide-star-notification') !== true, 'dismiss' => __('messages.Hide this notification'), 'adminonly' => true, ], ]; $shownNotifications = array_filter($notifications, function($notification) { return $notification['condition'] && (!$notification['adminonly'] || (auth()->user()->role == 'admin')); }); @endphp @if (count($shownNotifications) > 0) @endif