@@ -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 | |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | 'text', |
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | - $sorted = $linkTypes->sortBy(function ($item) use ($custom_order) { |
|
| 68 | + $sorted = $linkTypes->sortBy(function($item) use ($custom_order) { |
|
| 69 | 69 | $index = array_search($item->typename, $custom_order); |
| 70 | 70 | return $index !== false ? $index : count($custom_order); |
| 71 | 71 | }); |
@@ -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 { |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return abort(404); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | - return redirect(url('@'.$user)); |
|
| 163 | + return redirect(url('@' . $user)); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | //Show add/update form |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $LinkURL = $request->link; |
| 196 | 196 | |
| 197 | 197 | // Step 3: Load Link Type Logic |
| 198 | - if($request->typename == 'predefined') { |
|
| 198 | + if ($request->typename == 'predefined') { |
|
| 199 | 199 | $button = Button::where('name', $request->button)->first(); |
| 200 | 200 | $linkData = [ |
| 201 | 201 | 'link' => $LinkURL, |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | if ($OrigLink) { |
| 246 | 246 | $currentValues = $OrigLink->getAttributes(); |
| 247 | - $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value);}); |
|
| 247 | + $nonNullFilteredLinkData = array_filter($filteredLinkData, function($value) {return !is_null($value); }); |
|
| 248 | 248 | $updatedValues = array_merge($currentValues, $nonNullFilteredLinkData); |
| 249 | 249 | $OrigLink->update($updatedValues); |
| 250 | 250 | $message = "Link updated"; |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | if (substr($linkId, -1) == '+') { |
| 308 | 308 | $linkWithoutPlus = str_replace('+', '', $linkId); |
| 309 | - return redirect(url('info/'.$linkWithoutPlus)); |
|
| 309 | + return redirect(url('info/' . $linkWithoutPlus)); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $link = Link::find($linkId); |
@@ -397,11 +397,11 @@ discard block |
||
| 397 | 397 | |
| 398 | 398 | $directory = base_path("assets/favicon/icons"); |
| 399 | 399 | $files = scandir($directory); |
| 400 | - foreach($files as $file) { |
|
| 401 | - if (strpos($file, $linkId.".") !== false) { |
|
| 402 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 400 | + foreach ($files as $file) { |
|
| 401 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 402 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 403 | 403 | if (isset($pathinfo)) { |
| 404 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 404 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | return redirect('/studio/links'); |
@@ -414,11 +414,11 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | $directory = base_path("assets/favicon/icons"); |
| 416 | 416 | $files = scandir($directory); |
| 417 | - foreach($files as $file) { |
|
| 418 | - if (strpos($file, $linkId.".") !== false) { |
|
| 419 | - $pathinfo = pathinfo($file, PATHINFO_EXTENSION);}} |
|
| 417 | + foreach ($files as $file) { |
|
| 418 | + if (strpos($file, $linkId . ".") !== false) { |
|
| 419 | + $pathinfo = pathinfo($file, PATHINFO_EXTENSION); }} |
|
| 420 | 420 | if (isset($pathinfo)) { |
| 421 | - try{File::delete(base_path("assets/favicon/icons")."/".$linkId.".".$pathinfo);} catch (exception $e) {} |
|
| 421 | + try {File::delete(base_path("assets/favicon/icons") . "/" . $linkId . "." . $pathinfo); } catch (exception $e) {} |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | return redirect('/studio/links'); |
@@ -542,7 +542,7 @@ discard block |
||
| 542 | 542 | 'sometimes', |
| 543 | 543 | 'max:255', |
| 544 | 544 | 'string', |
| 545 | - 'isunique:users,id,'.$userId, |
|
| 545 | + 'isunique:users,id,' . $userId, |
|
| 546 | 546 | ], |
| 547 | 547 | 'name' => 'sometimes|max:255|string', |
| 548 | 548 | 'image' => 'sometimes|image|mimes:jpeg,jpg,png,webp|max:2048', // Max file size: 2MB |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | $sharebtn = $request->sharebtn; |
| 568 | 568 | $tablinks = $request->tablinks; |
| 569 | 569 | |
| 570 | - if(env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')){ |
|
| 570 | + if (env('HOME_URL') !== '' && $pageName != $littlelink_name && $littlelink_name == env('HOME_URL')) { |
|
| 571 | 571 | EnvEditor::editKey('HOME_URL', $pageName); |
| 572 | 572 | } |
| 573 | 573 | |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | // echo Auth::id(); |
| 802 | 802 | $id = $request->id; |
| 803 | 803 | |
| 804 | - if($id == Auth::id() and $id != "1") { |
|
| 804 | + if ($id == Auth::id() and $id != "1") { |
|
| 805 | 805 | |
| 806 | 806 | Link::where('user_id', $id)->delete(); |
| 807 | 807 | |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | $fileName = "links-$domain-$date.json"; |
| 849 | 849 | $headers = [ |
| 850 | 850 | 'Content-Type' => 'application/json', |
| 851 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 851 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 852 | 852 | ]; |
| 853 | 853 | return response()->json($userData, 200, $headers); |
| 854 | 854 | |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | $userData = $user->toArray(); |
| 871 | 871 | $userData['links'] = $links->toArray(); |
| 872 | 872 | |
| 873 | - if (file_exists(base_path(findAvatar($userId)))){ |
|
| 873 | + if (file_exists(base_path(findAvatar($userId)))) { |
|
| 874 | 874 | $imagePath = base_path(findAvatar($userId)); |
| 875 | 875 | $imageData = base64_encode(file_get_contents($imagePath)); |
| 876 | 876 | $userData['image_data'] = $imageData; |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | $fileName = "user_data-$domain-$date.json"; |
| 885 | 885 | $headers = [ |
| 886 | 886 | 'Content-Type' => 'application/json', |
| 887 | - 'Content-Disposition' => 'attachment; filename="'.$fileName.'"', |
|
| 887 | + 'Content-Disposition' => 'attachment; filename="' . $fileName . '"', |
|
| 888 | 888 | ]; |
| 889 | 889 | return response()->json($userData, 200, $headers); |
| 890 | 890 | |
@@ -221,7 +221,9 @@ discard block |
||
| 221 | 221 | // Step 5: User and Button Information |
| 222 | 222 | $userId = Auth::user()->id; |
| 223 | 223 | $button = Button::where('name', $request->button)->first(); |
| 224 | - if ($button && empty($LinkTitle)) $LinkTitle = $button->alt; |
|
| 224 | + if ($button && empty($LinkTitle)) { |
|
| 225 | + $LinkTitle = $button->alt; |
|
| 226 | + } |
|
| 225 | 227 | |
| 226 | 228 | // Step 6: Prepare Link Data |
| 227 | 229 | // (Handled by the included file) |
@@ -484,14 +486,16 @@ discard block |
||
| 484 | 486 | 'button' => 'required', |
| 485 | 487 | ]); |
| 486 | 488 | |
| 487 | - if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') |
|
| 488 | - $link1 = $request->link; |
|
| 489 | - else |
|
| 490 | - $link1 = 'https://' . $request->link; |
|
| 491 | - if (stringEndsWith($request->link, '/') == 'true') |
|
| 492 | - $link = rtrim($link1, "/ "); |
|
| 493 | - else |
|
| 494 | - $link = $link1; |
|
| 489 | + if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') { |
|
| 490 | + $link1 = $request->link; |
|
| 491 | + } else { |
|
| 492 | + $link1 = 'https://' . $request->link; |
|
| 493 | + } |
|
| 494 | + if (stringEndsWith($request->link, '/') == 'true') { |
|
| 495 | + $link = rtrim($link1, "/ "); |
|
| 496 | + } else { |
|
| 497 | + $link = $link1; |
|
| 498 | + } |
|
| 495 | 499 | $title = $request->title; |
| 496 | 500 | $order = $request->order; |
| 497 | 501 | $button = $request->button; |