@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | parent::boot(); |
| 17 | 17 | |
| 18 | 18 | static::creating(function ($link) { |
| 19 | - if (config('linkstack.disable_random_link_ids') != 'true') { |
|
| 19 | + if (config('linkstack.disable_random_link_ids') != 'true') { |
|
| 20 | 20 | $numberOfDigits = config('linkstack.link_id_length') ?? 9; |
| 21 | 21 | |
| 22 | 22 | $minIdValue = 10**($numberOfDigits - 1); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | } while (Link::find($randomId)); |
| 28 | 28 | |
| 29 | 29 | $link->id = $randomId; |
| 30 | - } |
|
| 30 | + } |
|
| 31 | 31 | }); |
| 32 | 32 | } |
| 33 | 33 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, |
| 66 | 66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, |
| 67 | 67 | 'link-id' => \App\Http\Middleware\LinkId::class, |
| 68 | - 'admin' => \App\Http\Middleware\admin::class, |
|
| 68 | + 'admin' => \App\Http\Middleware\admin::class, |
|
| 69 | 69 | 'blocked' => \App\Http\Middleware\CheckBlockedUser::class, |
| 70 | 70 | 'max.users' => \App\Http\Middleware\MaxUsers::class, |
| 71 | 71 | 'impersonate' => \App\Http\Middleware\Impersonate::class, |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | { |
| 13 | 13 | public function handle($request, Closure $next) |
| 14 | 14 | { |
| 15 | - if(Schema::hasColumn('users', 'auth_as')) { |
|
| 15 | + if(Schema::hasColumn('users', 'auth_as')) { |
|
| 16 | 16 | $adminUser = User::where('role', 'admin')->where(function ($query) { |
| 17 | 17 | $query->where('auth_as', '!=', null) |
| 18 | 18 | ->where('auth_as', '!=', ''); |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | return $next($request); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - } else { |
|
| 162 | + } else { |
|
| 163 | 163 | return $next($request); |
| 164 | - } |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -18,10 +18,10 @@ |
||
| 18 | 18 | public function handle(Request $request, Closure $next) |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - //check is admin |
|
| 22 | - if (Auth::user() && Auth::user()->role == 'admin') { |
|
| 21 | + //check is admin |
|
| 22 | + if (Auth::user() && Auth::user()->role == 'admin') { |
|
| 23 | 23 | return $next($request); |
| 24 | - } |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | return redirect(url('dashboard')); |
| 27 | 27 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | public function __construct($link) |
| 19 | 19 | { |
| 20 | 20 | // $this->title = $title; |
| 21 | - $this->link = $link; |
|
| 21 | + $this->link = $link; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | // Get image information using getimagesize |
| 53 | 53 | $imageInfo = getimagesize($file); |
| 54 | 54 | if (!$imageInfo) { |
| 55 | - return 'dark'; |
|
| 55 | + return 'dark'; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // Get the image type |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | // Load the image based on its type |
| 62 | 62 | switch ($type) { |
| 63 | - case IMAGETYPE_JPEG: |
|
| 63 | + case IMAGETYPE_JPEG: |
|
| 64 | 64 | case IMAGETYPE_JPEG2000: |
| 65 | 65 | $img = imagecreatefromjpeg($file); |
| 66 | 66 | break; |
| 67 | - case IMAGETYPE_PNG: |
|
| 67 | + case IMAGETYPE_PNG: |
|
| 68 | 68 | $img = imagecreatefrompng($file); |
| 69 | 69 | break; |
| 70 | - default: |
|
| 70 | + default: |
|
| 71 | 71 | return 'dark'; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -78,29 +78,29 @@ discard block |
||
| 78 | 78 | // Calculate the average brightness of the image |
| 79 | 79 | $total_brightness = 0; |
| 80 | 80 | for ($x=0; $x<$width; $x++) { |
| 81 | - for ($y=0; $y<$height; $y++) { |
|
| 81 | + for ($y=0; $y<$height; $y++) { |
|
| 82 | 82 | $rgb = imagecolorat($img, $x, $y); |
| 83 | 83 | $r = ($rgb >> 16) & 0xFF; |
| 84 | 84 | $g = ($rgb >> 8) & 0xFF; |
| 85 | 85 | $b = $rgb & 0xFF; |
| 86 | 86 | $brightness = (int)(($r + $g + $b) / 3); |
| 87 | 87 | $total_brightness += $brightness; |
| 88 | - } |
|
| 88 | + } |
|
| 89 | 89 | } |
| 90 | 90 | $avg_brightness = $total_brightness / ($width * $height); |
| 91 | 91 | |
| 92 | 92 | // Determine if the image is more dark or light |
| 93 | 93 | if ($avg_brightness < 128) { |
| 94 | - return 'dark'; |
|
| 94 | + return 'dark'; |
|
| 95 | 95 | } else { |
| 96 | - return 'light'; |
|
| 96 | + return 'light'; |
|
| 97 | + } |
|
| 98 | + } catch (\Throwable $th) { |
|
| 99 | + return null; |
|
| 100 | + } |
|
| 97 | 101 | } |
| 98 | - } catch (\Throwable $th) { |
|
| 99 | - return null; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | 102 | |
| 103 | - function infoIcon($tip) { |
|
| 103 | + function infoIcon($tip) { |
|
| 104 | 104 | echo ' |
| 105 | 105 | <div class="d-flex justify-content-center align-items-center"> |
| 106 | 106 | <a data-bs-toggle="tooltip" data-bs-placement="bottom" title="' . $tip . '"> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | </a> |
| 111 | 111 | </div> |
| 112 | 112 | '; |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | 115 | function external_file_get_contents($url) { |
| 116 | 116 | $ch = curl_init(); |
@@ -153,43 +153,43 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | if(!function_exists('setBlockAssetContext')) { |
| 156 | - function setBlockAssetContext($type = null) { |
|
| 157 | - static $currentType = null; |
|
| 158 | - if ($type !== null) { |
|
| 159 | - $currentType = $type; |
|
| 160 | - } |
|
| 161 | - return $currentType; |
|
| 162 | - } |
|
| 156 | + function setBlockAssetContext($type = null) { |
|
| 157 | + static $currentType = null; |
|
| 158 | + if ($type !== null) { |
|
| 159 | + $currentType = $type; |
|
| 160 | + } |
|
| 161 | + return $currentType; |
|
| 162 | + } |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Get custom block assets |
| 166 | 166 | if(!function_exists('block_asset')) { |
| 167 | - function block_asset($file) { |
|
| 168 | - $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 169 | - return url("block-asset/$type?asset=$file"); |
|
| 170 | - } |
|
| 167 | + function block_asset($file) { |
|
| 168 | + $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 169 | + return url("block-asset/$type?asset=$file"); |
|
| 170 | + } |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | if(!function_exists('get_block_file_contents')) { |
| 174 | - function get_block_file_contents($file) { |
|
| 175 | - $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 176 | - return file_get_contents(base_path("blocks/$type/$file")); |
|
| 177 | - } |
|
| 174 | + function get_block_file_contents($file) { |
|
| 175 | + $type = setBlockAssetContext(); // Retrieve the current type context |
|
| 176 | + return file_get_contents(base_path("blocks/$type/$file")); |
|
| 177 | + } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | function block_text_translation_check($text) { |
| 181 | - if (empty($text)) { |
|
| 181 | + if (empty($text)) { |
|
| 182 | 182 | return false; |
| 183 | - } |
|
| 184 | - $translate = __("messages.$text"); |
|
| 185 | - return $translate === "messages.$text" ? true : false; |
|
| 183 | + } |
|
| 184 | + $translate = __("messages.$text"); |
|
| 185 | + return $translate === "messages.$text" ? true : false; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | function block_text($text) { |
| 189 | - $translate = __("messages.$text"); |
|
| 190 | - return $translate === "messages.$text" ? $text : $translate; |
|
| 189 | + $translate = __("messages.$text"); |
|
| 190 | + return $translate === "messages.$text" ? $text : $translate; |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | function bt($text) { |
| 194 | - return block_text($text); |
|
| 194 | + return block_text($text); |
|
| 195 | 195 | } |
| 196 | 196 | \ No newline at end of file |