Passed
Push — main ( 33bcf2...99b926 )
by Julian
04:01
created
app/Http/Controllers/AdminController.php 1 patch
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -527,7 +527,9 @@  discard block
 block discarded – undo
527 527
                     $text = file_get_contents(base_path('themes') . '/' . $entry . '/readme.md');
528 528
                     $pattern = '/Theme Version:.*/';
529 529
                     preg_match($pattern, $text, $matches, PREG_OFFSET_CAPTURE);
530
-                    if (!count($matches)) continue;
530
+                    if (!count($matches)) {
531
+                        continue;
532
+                    }
531 533
                     $verNr = substr($matches[0][0], 15);
532 534
 
533 535
                 }
@@ -625,10 +627,10 @@  discard block
 block discarded – undo
625 627
         $value = $request->value;
626 628
 
627 629
         if($type === "toggle"){
628
-            if($request->toggle != ''){$value = "true";}else{$value = "false";}
630
+            if($request->toggle != ''){$value = "true";} else{$value = "false";}
629 631
             if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
630 632
         } elseif($type === "toggle2") {
631
-            if($request->toggle != ''){$value = "verified";}else{$value = "auth";}
633
+            if($request->toggle != ''){$value = "verified";} else{$value = "auth";}
632 634
             if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
633 635
         } elseif($type === "text") {
634 636
             if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, '"' . $value . '"');}
@@ -643,10 +645,10 @@  discard block
 block discarded – undo
643 645
                 if(EnvEditor::keyExists('LOG_LEVEL')){EnvEditor::editKey('LOG_LEVEL', 'error');}
644 646
             }
645 647
         } elseif($type === "register") {
646
-            if($request->toggle != ''){$register = "true";}else{$register = "false";}
648
+            if($request->toggle != ''){$register = "true";} else{$register = "false";}
647 649
             Page::first()->update(['register' => $register]);
648 650
         } elseif($type === "smtp") {
649
-            if($request->toggle != ''){$value = "built-in";}else{$value = "smtp";}
651
+            if($request->toggle != ''){$value = "built-in";} else{$value = "smtp";}
650 652
             if(EnvEditor::keyExists('MAIL_MAILER')){EnvEditor::editKey('MAIL_MAILER', $value);}
651 653
 
652 654
             if(EnvEditor::keyExists('MAIL_HOST')){EnvEditor::editKey('MAIL_HOST', $request->MAIL_HOST);}
@@ -656,10 +658,10 @@  discard block
 block discarded – undo
656 658
             if(EnvEditor::keyExists('MAIL_ENCRYPTION')){EnvEditor::editKey('MAIL_ENCRYPTION', $request->MAIL_ENCRYPTION);}
657 659
             if(EnvEditor::keyExists('MAIL_FROM_ADDRESS')){EnvEditor::editKey('MAIL_FROM_ADDRESS', $request->MAIL_FROM_ADDRESS);}
658 660
         } elseif($type === "homeurl") {
659
-            if($request->value == 'default'){$value = "";}else{$value = '"' . $request->value . '"';}
661
+            if($request->value == 'default'){$value = "";} else{$value = '"' . $request->value . '"';}
660 662
             if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
661 663
         } elseif($type === "maintenance") {
662
-            if($request->toggle != ''){$value = "true";}else{$value = "false";}
664
+            if($request->toggle != ''){$value = "true";} else{$value = "false";}
663 665
             if(file_exists(base_path("storage/MAINTENANCE"))){unlink(base_path("storage/MAINTENANCE"));}
664 666
             if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
665 667
         } else {
Please login to merge, or discard this patch.
app/Http/Controllers/InstallerController.php 1 patch
Braces   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         if($request->database == 'MySQL'){
42 42
             return redirect(url('?mysql'));
43
-        }else{
43
+        } else{
44 44
             return redirect(url('?4'));
45 45
         }
46 46
     }
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
             fclose($handleFile);
60 60
         }
61 61
 
62
-        try{EnvEditor::addKey('ADMIN_EMAIL', $email);}catch(Exception $e){}
62
+        try{EnvEditor::addKey('ADMIN_EMAIL', $email);} catch(Exception $e){}
63 63
 
64 64
         if(DB::table('users')->count() == '0'){
65 65
         Schema::disableForeignKeyConstraints();
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
         $DB_USERNAME = $request->username;
93 93
         $DB_PASSWORD = $request->password;
94 94
 
95
-        if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', $DB_CONNECTION);}else{EnvEditor::addKey('DB_CONNECTION', $DB_CONNECTION);}
96
-        if(EnvEditor::keyExists('DB_HOST')){EnvEditor::editKey('DB_HOST', $DB_HOST);}else{EnvEditor::addKey('DB_HOST', $DB_HOST);}
97
-        if(EnvEditor::keyExists('DB_PORT')){EnvEditor::editKey('DB_PORT', $DB_PORT);}else{EnvEditor::addKey('DB_PORT', $DB_PORT);}
98
-        if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::editKey('DB_DATABASE', $DB_DATABASE);}else{EnvEditor::addKey('DB_DATABASE', $DB_DATABASE);}
99
-        if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::editKey('DB_USERNAME', $DB_USERNAME);}else{EnvEditor::addKey('DB_USERNAME', $DB_USERNAME);}
100
-        if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::editKey('DB_PASSWORD', $DB_PASSWORD);}else{EnvEditor::addKey('DB_PASSWORD', $DB_PASSWORD);}
95
+        if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', $DB_CONNECTION);} else{EnvEditor::addKey('DB_CONNECTION', $DB_CONNECTION);}
96
+        if(EnvEditor::keyExists('DB_HOST')){EnvEditor::editKey('DB_HOST', $DB_HOST);} else{EnvEditor::addKey('DB_HOST', $DB_HOST);}
97
+        if(EnvEditor::keyExists('DB_PORT')){EnvEditor::editKey('DB_PORT', $DB_PORT);} else{EnvEditor::addKey('DB_PORT', $DB_PORT);}
98
+        if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::editKey('DB_DATABASE', $DB_DATABASE);} else{EnvEditor::addKey('DB_DATABASE', $DB_DATABASE);}
99
+        if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::editKey('DB_USERNAME', $DB_USERNAME);} else{EnvEditor::addKey('DB_USERNAME', $DB_USERNAME);}
100
+        if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::editKey('DB_PASSWORD', $DB_PASSWORD);} else{EnvEditor::addKey('DB_PASSWORD', $DB_PASSWORD);}
101 101
 
102 102
         return redirect(url('mysql-test'));
103 103
 
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
         try {$users = DB::table('buttons')->count(); $failed = false;} catch (exception $e) {$failed = true;}
114 114
 
115 115
         if($failed == true){
116
-            if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');}else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');}
116
+            if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');} else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');}
117 117
             if(EnvEditor::keyExists('DB_HOST')){EnvEditor::deleteKey('DB_HOST');}
118 118
             if(EnvEditor::keyExists('DB_PORT')){EnvEditor::deleteKey('DB_PORT');}
119 119
             if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::deleteKey('DB_DATABASE');}
120 120
             if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::deleteKey('DB_USERNAME');}
121 121
             if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::deleteKey('DB_PASSWORD');}
122 122
             return redirect(url('?error'));
123
-        }else{
123
+        } else{
124 124
             return redirect(url('?4'));
125 125
         }
126 126
     }
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
         $llName = $user->littlelink_name;
133 133
 
134 134
         if($request->register == 'Yes'){ 
135
-            if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'true');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'true');}
135
+            if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'true');} else{EnvEditor::addKey('ALLOW_REGISTRATION', 'true');}
136 136
         } else {
137
-            if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'false');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'false');}
137
+            if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'false');} else{EnvEditor::addKey('ALLOW_REGISTRATION', 'false');}
138 138
         }
139 139
 
140
-        if($request->verify == 'Yes'){$value = "verified";}else{$value = "auth";}
140
+        if($request->verify == 'Yes'){$value = "verified";} else{$value = "auth";}
141 141
         if(EnvEditor::keyExists('REGISTER_AUTH')){EnvEditor::editKey('REGISTER_AUTH', $value);}
142 142
 
143
-        if($request->page == 'No'){$value = "";}else{$value = '"' . $llName . '"';}
143
+        if($request->page == 'No'){$value = "";} else{$value = '"' . $llName . '"';}
144 144
         if(EnvEditor::keyExists('HOME_URL')){EnvEditor::editKey('HOME_URL', $value);}
145 145
 
146 146
         if(EnvEditor::keyExists('APP_NAME')){EnvEditor::editKey('APP_NAME', '"' . $request->app . '"');}
Please login to merge, or discard this patch.
app/Http/Controllers/LinkTypeViewController.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -118,11 +118,13 @@
 block discarded – undo
118 118
         $params = json_decode($json, true);
119 119
         $idx = 0;
120 120
         foreach ($params as $p) {
121
-            if (!array_key_exists('for', $p))
122
-                $params[$idx]['for'] = $p['name'];
121
+            if (!array_key_exists('for', $p)) {
122
+                            $params[$idx]['for'] = $p['name'];
123
+            }
123 124
 
124
-            if (!array_key_exists('label', $p))
125
-                $params[$idx]['label'] = ucwords(preg_replace('/[^a-zA-Z0-9-]/', ' ', $p['name']));
125
+            if (!array_key_exists('label', $p)) {
126
+                            $params[$idx]['label'] = ucwords(preg_replace('/[^a-zA-Z0-9-]/', ' ', $p['name']));
127
+            }
126 128
 
127 129
             if (!array_key_exists('label', $p) || !str_contains($p['class'], 'form-control')) {
128 130
                 $params[$idx]['class'] = " form-control";
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 1 patch
Braces   +33 added lines, -29 removed lines patch added patch discarded remove patch
@@ -212,8 +212,9 @@  discard block
 block discarded – undo
212 212
         $customParams = [];
213 213
         foreach ($request->all() as $key => $param) {
214 214
             //echo $key . " = " . $param . "<br />";
215
-            if (str_starts_with($key, "_") ||  in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url']))
216
-                continue;
215
+            if (str_starts_with($key, "_") ||  in_array($key, ['linktype_id', 'linktype_title', 'link_text', 'link_url'])) {
216
+                            continue;
217
+            }
217 218
 
218 219
             $customParams[$key] = $param;
219 220
         }
@@ -221,8 +222,9 @@  discard block
 block discarded – undo
221 222
         $userId = Auth::user()->id;
222 223
         $button = Button::where('name', $request->button)->first();
223 224
 
224
-        if ($button && empty($LinkTitle))
225
-            $LinkTitle = $button->alt;
225
+        if ($button && empty($LinkTitle)) {
226
+                    $LinkTitle = $button->alt;
227
+        }
226 228
 
227 229
         if ($linkType->typename == 'video' && empty($LinkTitle)) {
228 230
             $embed = OEmbed::get($LinkURL);
@@ -245,25 +247,25 @@  discard block
 block discarded – undo
245 247
                         'title' => $LinkTitle,
246 248
                         'button_id' => "2",
247 249
                     ]);
248
-                }elseif($linkType->typename == "link"){
250
+                } elseif($linkType->typename == "link"){
249 251
                     $OrigLink->update([
250 252
                         'link' => $LinkURL,
251 253
                         'title' => $LinkTitle,
252 254
                         'button_id' => "1",
253 255
                     ]);
254
-                }elseif($linkType->typename == "spacer"){
256
+                } elseif($linkType->typename == "spacer"){
255 257
                     $OrigLink->update([
256 258
                         'link' => $LinkURL,
257 259
                         'title' => $customParams['height'] ?? null,
258 260
                         'button_id' => "43",
259 261
                     ]);
260
-                }elseif($linkType->typename == "heading"){
262
+                } elseif($linkType->typename == "heading"){
261 263
                     $OrigLink->update([
262 264
                         'link' => $LinkURL,
263 265
                         'title' => $LinkTitle,
264 266
                         'button_id' => "42",
265 267
                     ]);
266
-                }elseif($linkType->typename == "text"){
268
+                } elseif($linkType->typename == "text"){
267 269
                     $sanitizedText = $request->text;
268 270
                     $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>');
269 271
                     $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText);
@@ -272,19 +274,19 @@  discard block
 block discarded – undo
272 274
                         'button_id' => "93",
273 275
                         'title' => $sanitizedText,
274 276
                     ]);
275
-                }elseif($linkType->typename == "email"){
277
+                } elseif($linkType->typename == "email"){
276 278
                     $OrigLink->update([
277 279
                         'link' => $LinkURL,
278 280
                         'button_id' => $button?->id,
279 281
                         'title' => $LinkTitle,
280 282
                     ]);
281
-                }elseif($linkType->typename == "telephone"){
283
+                } elseif($linkType->typename == "telephone"){
282 284
                     $OrigLink->update([
283 285
                         'link' => $LinkURL,
284 286
                         'button_id' => $button?->id,
285 287
                         'title' => $LinkTitle,
286 288
                     ]);
287
-                }elseif($linkType->typename == "vcard"){
289
+                } elseif($linkType->typename == "vcard"){
288 290
 
289 291
                     $prefix = $request->input('prefix');
290 292
                     $firstName = $request->input('first_name');
@@ -356,7 +358,7 @@  discard block
 block discarded – undo
356 358
                         'button_id' => 96,
357 359
                         'title' => $LinkTitle,
358 360
                     ]);
359
-                }else{
361
+                } else{
360 362
                     $OrigLink->update([
361 363
                         'link' => $LinkURL,
362 364
                         'title' => $LinkTitle,
@@ -377,29 +379,29 @@  discard block
 block discarded – undo
377 379
             $links->user_id = $userId;
378 380
             if($linkType->typename == "spacer"){
379 381
             $links->title = $SpacerHeight;
380
-            }else{
382
+            } else{
381 383
             $links->title = $LinkTitle;
382 384
             }
383 385
             if($linkType->typename == "link" and $isCustomWebsite == "1"){
384 386
                 $links->button_id = "2";
385
-            }elseif($linkType->typename == "link"){
387
+            } elseif($linkType->typename == "link"){
386 388
                 $links->button_id = "1";
387
-            }elseif($linkType->typename == "spacer"){
389
+            } elseif($linkType->typename == "spacer"){
388 390
                 $links->button_id = "43";
389
-            }elseif($linkType->typename == "heading"){
391
+            } elseif($linkType->typename == "heading"){
390 392
                 $links->button_id = "42";
391
-            }elseif($linkType->typename == "text"){
393
+            } elseif($linkType->typename == "text"){
392 394
                 $sanitizedText = $request->text;
393 395
                 $sanitizedText = strip_tags($sanitizedText, '<a><p><strong><i><ul><ol><li><blockquote><h2><h3><h4>');
394 396
                 $sanitizedText = preg_replace("/<a([^>]*)>/i", "<a $1 rel=\"noopener noreferrer nofollow\">", $sanitizedText);
395 397
                 $sanitizedText = strip_tags_except_allowed_protocols($sanitizedText);
396 398
                 $links->button_id = "93";
397 399
                 $links->title = $sanitizedText;
398
-            }elseif($linkType->typename == "email"){
400
+            } elseif($linkType->typename == "email"){
399 401
                 $links->button_id = $button?->id;
400
-            }elseif($linkType->typename == "telephone"){
402
+            } elseif($linkType->typename == "telephone"){
401 403
                 $links->button_id = $button?->id;
402
-            }elseif($linkType->typename == "vcard"){
404
+            } elseif($linkType->typename == "vcard"){
403 405
 
404 406
                 $prefix = $request->input('prefix');
405 407
                 $firstName = $request->input('first_name');
@@ -467,7 +469,7 @@  discard block
 block discarded – undo
467 469
                 $links->link = $json ? $json : null;               
468 470
 
469 471
                 $links->button_id = 96;
470
-            }else{
472
+            } else{
471 473
                 $links->button_id = $button?->id;
472 474
             }
473 475
 
@@ -716,14 +718,16 @@  discard block
 block discarded – undo
716 718
             'button' => 'required',
717 719
         ]);
718 720
 
719
-        if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true')
720
-            $link1 = $request->link;
721
-        else
722
-            $link1 = 'https://' . $request->link;
723
-        if (stringEndsWith($request->link, '/') == 'true')
724
-            $link = rtrim($link1, "/ ");
725
-        else
726
-        $link = $link1;
721
+        if (stringStartsWith($request->link, 'http://') == 'true' or stringStartsWith($request->link, 'https://') == 'true' or stringStartsWith($request->link, 'mailto:') == 'true') {
722
+                    $link1 = $request->link;
723
+        } else {
724
+                    $link1 = 'https://' . $request->link;
725
+        }
726
+        if (stringEndsWith($request->link, '/') == 'true') {
727
+                    $link = rtrim($link1, "/ ");
728
+        } else {
729
+                $link = $link1;
730
+        }
727 731
         $title = $request->title;
728 732
         $order = $request->order;
729 733
         $button = $request->button;
Please login to merge, or discard this patch.