@@ -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(); |
@@ -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 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | // dynamiclly create params for predefined website to fill a select list with available buttons |
| 64 | 64 | if (!empty($linkType) && $linkType->typename === 'predefined') { |
| 65 | 65 | $buttons = Button::select('name')->orderBy('name', 'asc')->get(); |
| 66 | - $pdParams[] = ['tag' => 'select', 'name' => 'button', 'id'=> 'button']; |
|
| 66 | + $pdParams[] = ['tag' => 'select', 'name' => 'button', 'id'=> 'button']; |
|
| 67 | 67 | foreach ($buttons as $btn) { |
| 68 | 68 | $pdParams[0]['value'][] = [ |
| 69 | 69 | 'tag'=>'option', |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $typeParams = json_decode($link['type_params']); |
| 134 | 134 | |
| 135 | 135 | |
| 136 | - //echo "<pre>"; |
|
| 136 | + //echo "<pre>"; |
|
| 137 | 137 | // print_r($typeParams); |
| 138 | - //print_r($params[$idx]); |
|
| 139 | - //echo "</pre>"; |
|
| 138 | + //print_r($params[$idx]); |
|
| 139 | + //echo "</pre>"; |
|
| 140 | 140 | |
| 141 | 141 | if ($typeParams && property_exists($typeParams, $params[$idx]['name'])) { |
| 142 | 142 | if (key_exists('value', $params[$idx]) && is_array($params[$idx]['value'])) { |
@@ -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 | /** |