Passed
Push — main ( 80491e...c1a475 )
by Julian
04:23
created
app/Http/Controllers/InstallerController.php 1 patch
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 
39 39
     public function db(request $request)
40 40
     {
41
-        if($request->database == 'MySQL'){
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
     }
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 
56 56
         $file = base_path('INSTALLERLOCK');
57 57
         if (!file_exists($file)) {
58
-            $handleFile = fopen($file, 'w') or die('Cannot create file:  '.$file);
58
+            $handleFile = fopen($file, 'w') or die('Cannot create file:  ' . $file);
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
-        if(DB::table('users')->count() == '0'){
64
+        if (DB::table('users')->count() == '0') {
65 65
         Schema::disableForeignKeyConstraints();
66 66
         DB::table('users')->delete();
67 67
         DB::table('users')->truncate();
@@ -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
 
@@ -105,22 +105,22 @@  discard block
 block discarded – undo
105 105
 
106 106
     public function mysqlTest(request $request)
107 107
     {
108
-        try {Artisan::call('migrate');} catch (exception $e) {$failed = "true";}
109
-        try {Artisan::call('db:seed --force');} catch (exception $e) {$failed = "true";}
110
-        try {Artisan::call('db:seed --class="PageSeeder" --force');} catch (exception $e) {$failed = "true";}
111
-        try {Artisan::call('db:seed --class="ButtonSeeder" --force');} catch (exception $e) {$failed = "true";}
112
-
113
-        try {$users = DB::table('buttons')->count(); $failed = false;} catch (exception $e) {$failed = true;}
114
-
115
-        if($failed == true){
116
-            if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');}else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');}
117
-            if(EnvEditor::keyExists('DB_HOST')){EnvEditor::deleteKey('DB_HOST');}
118
-            if(EnvEditor::keyExists('DB_PORT')){EnvEditor::deleteKey('DB_PORT');}
119
-            if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::deleteKey('DB_DATABASE');}
120
-            if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::deleteKey('DB_USERNAME');}
121
-            if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::deleteKey('DB_PASSWORD');}
108
+        try {Artisan::call('migrate'); } catch (exception $e) {$failed = "true"; }
109
+        try {Artisan::call('db:seed --force'); } catch (exception $e) {$failed = "true"; }
110
+        try {Artisan::call('db:seed --class="PageSeeder" --force'); } catch (exception $e) {$failed = "true"; }
111
+        try {Artisan::call('db:seed --class="ButtonSeeder" --force'); } catch (exception $e) {$failed = "true"; }
112
+
113
+        try {$users = DB::table('buttons')->count(); $failed = false; } catch (exception $e) {$failed = true; }
114
+
115
+        if ($failed == true) {
116
+            if (EnvEditor::keyExists('DB_CONNECTION')) {EnvEditor::editKey('DB_CONNECTION', 'sqlite'); } else {EnvEditor::addKey('DB_CONNECTION', 'sqlite'); }
117
+            if (EnvEditor::keyExists('DB_HOST')) {EnvEditor::deleteKey('DB_HOST'); }
118
+            if (EnvEditor::keyExists('DB_PORT')) {EnvEditor::deleteKey('DB_PORT'); }
119
+            if (EnvEditor::keyExists('DB_DATABASE')) {EnvEditor::deleteKey('DB_DATABASE'); }
120
+            if (EnvEditor::keyExists('DB_USERNAME')) {EnvEditor::deleteKey('DB_USERNAME'); }
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
     }
@@ -131,25 +131,25 @@  discard block
 block discarded – undo
131 131
         $user = User::find(1);
132 132
         $llName = $user->littlelink_name;
133 133
 
134
-        if($request->register == 'Yes'){ 
135
-            if(EnvEditor::keyExists('ALLOW_REGISTRATION')){EnvEditor::editKey('ALLOW_REGISTRATION', 'true');}else{EnvEditor::addKey('ALLOW_REGISTRATION', 'true');}
134
+        if ($request->register == 'Yes') { 
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";}
141
-        if(EnvEditor::keyExists('REGISTER_AUTH')){EnvEditor::editKey('REGISTER_AUTH', $value);}
140
+        if ($request->verify == 'Yes') {$value = "verified"; } else {$value = "auth"; }
141
+        if (EnvEditor::keyExists('REGISTER_AUTH')) {EnvEditor::editKey('REGISTER_AUTH', $value); }
142 142
 
143
-        if($request->page == 'No'){$value = "";}else{$value = '"' . $llName . '"';}
144
-        if(EnvEditor::keyExists('HOME_URL')){EnvEditor::editKey('HOME_URL', $value);}
143
+        if ($request->page == 'No') {$value = ""; } else {$value = '"' . $llName . '"'; }
144
+        if (EnvEditor::keyExists('HOME_URL')) {EnvEditor::editKey('HOME_URL', $value); }
145 145
 
146
-        if(EnvEditor::keyExists('APP_NAME')){EnvEditor::editKey('APP_NAME', '"' . $request->app . '"');}
146
+        if (EnvEditor::keyExists('APP_NAME')) {EnvEditor::editKey('APP_NAME', '"' . $request->app . '"'); }
147 147
 
148
-        if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));}
148
+        if (file_exists(base_path("INSTALLING"))) {unlink(base_path("INSTALLING")); }
149 149
 
150 150
         $file = base_path('INSTALLERLOCK');
151 151
         if (file_exists($file)) {
152
-            unlink($file) or die('Cannot delete file: '.$file);
152
+            unlink($file) or die('Cannot delete file: ' . $file);
153 153
             sleep(1);
154 154
         }
155 155
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $value = $request->value;
165 165
         $value = '"' . $request->value . '"';
166 166
         
167
-        if(EnvEditor::keyExists($entry)){EnvEditor::editKey($entry, $value);}
167
+        if (EnvEditor::keyExists($entry)) {EnvEditor::editKey($entry, $value); }
168 168
 
169 169
         return Redirect(url('dashboard'));
170 170
     }
Please login to merge, or discard this patch.
app/Http/Middleware/DisableCookies.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
app/Models/LinkType.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
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
         });
Please login to merge, or discard this patch.
app/Http/Controllers/UserController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     
Please login to merge, or discard this patch.