@@ -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 | /** |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - return view('components.pageitems.'.$this->link->typename.'-display', ['link' => $this->link, 'params' => $params]); |
|
| 36 | + return view('components.pageitems.' . $this->link->typename . '-display', ['link' => $this->link, 'params' => $params]); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function getModalIdString(): string |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | Column::make(__('messages.Page'), "littlelink_name") |
| 40 | 40 | ->sortable() |
| 41 | 41 | ->searchable() |
| 42 | - ->format(function ($value, $row, Column $column) { |
|
| 42 | + ->format(function($value, $row, Column $column) { |
|
| 43 | 43 | if (!$row->littlelink_name == NULL) { |
| 44 | 44 | return "<a href='" . url('') . "/@" . htmlspecialchars($row->littlelink_name) . "' target='_blank' class='text-info'><i class='bi bi-box-arrow-up-right'></i> " . htmlspecialchars($row->littlelink_name) . " </a>"; |
| 45 | 45 | } else { |
@@ -51,23 +51,23 @@ discard block |
||
| 51 | 51 | ->sortable() |
| 52 | 52 | ->searchable(), |
| 53 | 53 | Column::make(__('messages.Links'), "id") |
| 54 | - ->format(function ($value, $row) { |
|
| 54 | + ->format(function($value, $row) { |
|
| 55 | 55 | $linkCount = Link::where('user_id', $row->id)->count(); |
| 56 | 56 | return $linkCount; |
| 57 | 57 | }), |
| 58 | 58 | Column::make(__('messages.Clicks'), "id") |
| 59 | - ->format(function ($value, $row) { |
|
| 59 | + ->format(function($value, $row) { |
|
| 60 | 60 | $clicksSum = Link::where('user_id', $row->id)->sum('click_number'); |
| 61 | 61 | return $clicksSum; |
| 62 | 62 | }), |
| 63 | 63 | Column::make(__('messages.E-Mail'), "email_verified_at") |
| 64 | 64 | ->sortable() |
| 65 | - ->format(function ($value, $row, Column $column) { |
|
| 65 | + ->format(function($value, $row, Column $column) { |
|
| 66 | 66 | if (env('REGISTER_AUTH') !== 'auth') { |
| 67 | 67 | if ($row->role == 'admin' && $row->email_verified_at != '') { |
| 68 | 68 | return '<div class="text-center">-</div>'; |
| 69 | 69 | } else { |
| 70 | - if($row->email_verified_at == ''){ |
|
| 70 | + if ($row->email_verified_at == '') { |
|
| 71 | 71 | $verifyLinkBool = 'true'; |
| 72 | 72 | } else { |
| 73 | 73 | $verifyLinkBool = 'false'; |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | 'id' => $row->id |
| 78 | 78 | ]); |
| 79 | 79 | if ($row->email_verified_at == '') { |
| 80 | - return '<div class="text-center"><a style="cursor:pointer" data-id="'.$verifyLink.'" class="user-email text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 80 | + return '<div class="text-center"><a style="cursor:pointer" data-id="' . $verifyLink . '" class="user-email text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 81 | 81 | } else { |
| 82 | - return '<div class="text-center"><a style="cursor:pointer" data-id="'.$verifyLink.'" class="user-email text-danger"><span class="badge bg-success">' . __('messages.Verified') . '</span></a></div>'; |
|
| 82 | + return '<div class="text-center"><a style="cursor:pointer" data-id="' . $verifyLink . '" class="user-email text-danger"><span class="badge bg-success">' . __('messages.Verified') . '</span></a></div>'; |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } else { |
@@ -89,15 +89,15 @@ discard block |
||
| 89 | 89 | })->html(), |
| 90 | 90 | Column::make(__('messages.Status'), "block") |
| 91 | 91 | ->sortable() |
| 92 | - ->format(function ($value, $row, Column $column) { |
|
| 92 | + ->format(function($value, $row, Column $column) { |
|
| 93 | 93 | if ($row->role === 'admin' && $row->id === 1) { |
| 94 | 94 | return '<div class="text-center">-</div>'; |
| 95 | 95 | } else { |
| 96 | 96 | $route = route('blockUser', ['block' => $row->block, 'id' => $row->id]); |
| 97 | 97 | if ($row->block === 'yes') { |
| 98 | - $badge = '<div class="text-center"><a style="cursor:pointer" data-id="'.$route.'" class="user-block text-danger"><span class="badge bg-danger">'.__('messages.Pending').'</span></a></div>'; |
|
| 98 | + $badge = '<div class="text-center"><a style="cursor:pointer" data-id="' . $route . '" class="user-block text-danger"><span class="badge bg-danger">' . __('messages.Pending') . '</span></a></div>'; |
|
| 99 | 99 | } elseif ($row->block === 'no') { |
| 100 | - $badge = '<div class="text-center"><a style="cursor:pointer" data-id="'.$route.'" class="user-block text-danger"><span class="badge bg-success">'.__('messages.Approved').'</span></a></div>'; |
|
| 100 | + $badge = '<div class="text-center"><a style="cursor:pointer" data-id="' . $route . '" class="user-block text-danger"><span class="badge bg-success">' . __('messages.Approved') . '</span></a></div>'; |
|
| 101 | 101 | } |
| 102 | 102 | return "<a href=\"$route\">$badge</a>"; |
| 103 | 103 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ->html(), |
| 106 | 106 | Column::make(__('messages.Created at'), "created_at") |
| 107 | 107 | ->sortable() |
| 108 | - ->format(function ($value) { |
|
| 108 | + ->format(function($value) { |
|
| 109 | 109 | if ($value) { |
| 110 | 110 | return $value->format('d/m/y'); |
| 111 | 111 | } else { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | }), |
| 115 | 115 | Column::make(__('messages.Last seen'), "updated_at") |
| 116 | 116 | ->sortable() |
| 117 | - ->format(function ($value) { |
|
| 117 | + ->format(function($value) { |
|
| 118 | 118 | $now = now(); |
| 119 | 119 | $diff = $now->diff($value); |
| 120 | 120 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | }), |
| 131 | 131 | Column::make(__('messages.Action'), "id") |
| 132 | - ->format(function ($value, $row, Column $column) { |
|
| 132 | + ->format(function($value, $row, Column $column) { |
|
| 133 | 133 | return view('components.table-components.action', ['user' => $row]); |
| 134 | 134 | }), |
| 135 | 135 | ]; |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function boot() |
| 28 | 28 | { |
| 29 | 29 | Paginator::useBootstrap(); |
| 30 | - Validator::extend('isunique', function ($attribute, $value, $parameters, $validator) { |
|
| 30 | + Validator::extend('isunique', function($attribute, $value, $parameters, $validator) { |
|
| 31 | 31 | $value = strtolower($value); |
| 32 | 32 | $query = DB::table($parameters[0])->whereRaw("LOWER({$attribute}) = ?", [$value]); |
| 33 | 33 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | return $query->count() === 0; |
| 39 | 39 | }); |
| 40 | - Validator::extend('exturl', function ($attribute, $value, $parameters, $validator) { |
|
| 40 | + Validator::extend('exturl', function($attribute, $value, $parameters, $validator) { |
|
| 41 | 41 | $allowed_schemes = ['http', 'https', 'mailto', 'tel']; |
| 42 | 42 | return in_array(parse_url($value, PHP_URL_SCHEME), $allowed_schemes, true); |
| 43 | 43 | }); |
@@ -11,13 +11,13 @@ |
||
| 11 | 11 | |
| 12 | 12 | public function handle(Request $request, Closure $next) |
| 13 | 13 | { |
| 14 | - $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')).'_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 14 | + $cookiesAlreadySet = $request->hasCookie(strtolower(config('app.name')) . '_session') || $request->hasCookie('XSRF-TOKEN'); |
|
| 15 | 15 | |
| 16 | 16 | if ($cookiesAlreadySet) { |
| 17 | 17 | return $next($request); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')).'_session'))); |
|
| 20 | + Cookie::queue(Cookie::forget(str_replace(' ', '_', strtolower(config('app.name')) . '_session'))); |
|
| 21 | 21 | Cookie::queue(Cookie::forget('XSRF-TOKEN')); |
| 22 | 22 | config(['session.driver' => 'array']); |
| 23 | 23 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | //Show littlelink page. example => http://127.0.0.1:8000/+admin |
| 85 | 85 | public function littlelink(request $request) |
| 86 | 86 | { |
| 87 | - if(isset($request->useif)){ |
|
| 87 | + if (isset($request->useif)) { |
|
| 88 | 88 | $littlelink_name = User::select('littlelink_name')->where('id', $request->littlelink)->value('littlelink_name'); |
| 89 | 89 | $id = $request->littlelink; |
| 90 | 90 | } else { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | return abort(404); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - return redirect(url('@'.$user)); |
|
| 143 | + return redirect(url('@' . $user)); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | //Show add/update form |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | if (substr($linkId, -1) == '+') { |
| 301 | 301 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 302 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 302 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $link = Link::find($linkId); |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | $directory = base_path("assets/favicon/icons"); |
| 392 | 392 | $files = scandir($directory); |
| 393 | - foreach($files as $file) { |
|
| 394 | - if (strpos($file, $linkId.".") !== false) { |
|
| 395 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 393 | + foreach ($files as $file) { |
|
| 394 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 395 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 396 | 396 | if (isset($pathinfo)) { |
| 397 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 397 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | return redirect('/studio/links'); |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | |
| 408 | 408 | $directory = base_path("assets/favicon/icons"); |
| 409 | 409 | $files = scandir($directory); |
| 410 | - foreach($files as $file) { |
|
| 411 | - if (strpos($file, $linkId.".") !== false) { |
|
| 412 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 410 | + foreach ($files as $file) { |
|
| 411 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 412 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 413 | 413 | if (isset($pathinfo)) { |
| 414 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 414 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return redirect('/studio/links'); |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | 'sometimes', |
| 536 | 536 | 'max:255', |
| 537 | 537 | 'string', |
| 538 | - 'isunique:users,id,'.$userId, |
|
| 538 | + 'isunique:users,id,' . $userId, |
|
| 539 | 539 | ], |
| 540 | 540 | 'name' => 'sometimes|max:255|string', |
| 541 | 541 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -560,7 +560,7 @@ discard block |
||
| 560 | 560 | $sharebtn = $request->sharebtn; |
| 561 | 561 | $tablinks = $request->tablinks; |
| 562 | 562 | |
| 563 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 563 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 564 | 564 | EnvEditor::editKey('HOME_URL', $pageName); |
| 565 | 565 | } |
| 566 | 566 | |
@@ -794,7 +794,7 @@ discard block |
||
| 794 | 794 | // echo Auth::id(); |
| 795 | 795 | $id = $request->id; |
| 796 | 796 | |
| 797 | - if($id == Auth::id() and $id != "1") { |
|
| 797 | + if ($id == Auth::id() and $id != "1") { |
|
| 798 | 798 | |
| 799 | 799 | Link::where('user_id', $id)->delete(); |
| 800 | 800 | |
@@ -841,7 +841,7 @@ discard block |
||
| 841 | 841 | $fileName = "links-$domain-$date.json"; |
| 842 | 842 | $headers = [ |
| 843 | 843 | 'Content-Type' => 'application/json', |
| 844 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 844 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 845 | 845 | ]; |
| 846 | 846 | return response()->json($userData, 200, $headers); |
| 847 | 847 | |
@@ -863,7 +863,7 @@ discard block |
||
| 863 | 863 | $userData = $user->toArray(); |
| 864 | 864 | $userData['links'] = $links->toArray(); |
| 865 | 865 | |
| 866 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 866 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 867 | 867 | $imagePath = base_path(findAvatar($userId)); |
| 868 | 868 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 869 | 869 | $userData['image_data'] = $imageData; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $fileName = "user_data-$domain-$date.json"; |
| 878 | 878 | $headers = [ |
| 879 | 879 | 'Content-Type' => 'application/json', |
| 880 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 880 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 881 | 881 | ]; |
| 882 | 882 | return response()->json($userData, 200, $headers); |
| 883 | 883 | |
@@ -184,17 +184,23 @@ discard block |
||
| 184 | 184 | |
| 185 | 185 | $customParams = []; |
| 186 | 186 | foreach ($request->all() as $key => $param) { |
| 187 | - if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) continue; |
|
| 187 | + if (str_starts_with($key, "_") || in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) { |
|
| 188 | + continue; |
|
| 189 | + } |
|
| 188 | 190 | $customParams[$key] = $param; |
| 189 | 191 | } |
| 190 | 192 | |
| 191 | 193 | $userId = Auth::user()->id; |
| 192 | 194 | $button = Button::where('name', $request->button)->first(); |
| 193 | - if ($button && empty($LinkTitle)) $LinkTitle = $button->alt; |
|
| 195 | + if ($button && empty($LinkTitle)) { |
|
| 196 | + $LinkTitle = $button->alt; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | if ($linkType->typename == 'video' && empty($LinkTitle)) { |
| 196 | 200 | $embed = OEmbed::get($LinkURL); |
| 197 | - if ($embed) $LinkTitle = $embed->data()['title']; |
|
| 201 | + if ($embed) { |
|
| 202 | + $LinkTitle = $embed->data()['title']; |
|
| 203 | + } |
|
| 198 | 204 | } |
| 199 | 205 | |
| 200 | 206 | $message = (ucwords($button?->name) ?? ucwords($linkType->typename)) . " has been "; |
@@ -477,14 +483,16 @@ discard block |
||
| 477 | 483 | 'button' => 'required', |
| 478 | 484 | ]); |
| 479 | 485 | |
| 480 | - if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') |
|
| 481 | - $link1 = $request->link; |
|
| 482 | - else |
|
| 483 | - $link1 = 'https://' . $request->link; |
|
| 484 | - if (stringEndsWith($request->link, '/') == 'true') |
|
| 485 | - $link = rtrim($link1, "/ "); |
|
| 486 | - else |
|
| 487 | - $link = $link1; |
|
| 486 | + if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') { |
|
| 487 | + $link1 = $request->link; |
|
| 488 | + } else { |
|
| 489 | + $link1 = 'https://' . $request->link; |
|
| 490 | + } |
|
| 491 | + if (stringEndsWith($request->link, '/') == 'true') { |
|
| 492 | + $link = rtrim($link1, "/ "); |
|
| 493 | + } else { |
|
| 494 | + $link = $link1; |
|
| 495 | + } |
|
| 488 | 496 | $title = $request->title; |
| 489 | 497 | $order = $request->order; |
| 490 | 498 | $button = $request->button; |