Test Setup Failed
Push — irc-comment-visibility-fix ( 1f25c9...574aa6 )
by Michael
10:52
created
includes/Pages/PageViewRequest.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -136,8 +136,7 @@  discard block
 block discarded – undo
136 136
                 $this->setTemplate('view-request/main-with-checkuser-data.tpl');
137 137
                 $this->setupCheckUserData($request);
138 138
             }
139
-        }
140
-        else {
139
+        } else {
141 140
             $this->setTemplate('view-request/main.tpl');
142 141
         }
143 142
     }
@@ -151,8 +150,7 @@  discard block
 block discarded – undo
151 150
         if ($request->getStatus() === RequestStatus::CLOSED) {
152 151
             if ($request->getWasCreated()) {
153 152
                 $statusSymbol = self::STATUS_SYMBOL_ACCEPTED;
154
-            }
155
-            else {
153
+            } else {
156 154
                 $statusSymbol = self::STATUS_SYMBOL_REJECTED;
157 155
             }
158 156
         }
@@ -304,8 +302,7 @@  discard block
 block discarded – undo
304 302
                         'jobId'    => $job->getId(),
305 303
                         'jobDesc'  => JobQueue::getTaskDescriptions()[$job->getTask()],
306 304
                     );
307
-                }
308
-                else {
305
+                } else {
309 306
                     $requestLogs[] = array(
310 307
                         'type'     => 'log',
311 308
                         'security' => 'user',
Please login to merge, or discard this patch.
includes/Pages/PageFlagComment.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -70,15 +70,13 @@
 block discarded – undo
70 70
 
71 71
         if ($flagState === 1) {
72 72
             Logger::flaggedComment($database, $comment, $request->getDomain());
73
-        }
74
-        else {
73
+        } else {
75 74
             Logger::unflaggedComment($database, $comment, $request->getDomain());
76 75
         }
77 76
 
78 77
         if (WebRequest::postString('return') == 'list') {
79 78
             $this->redirect('flaggedComments');
80
-        }
81
-        else {
79
+        } else {
82 80
             $this->redirect('viewRequest', null, ['id' => $comment->getRequest()]);
83 81
         }
84 82
     }
Please login to merge, or discard this patch.
includes/Pages/PageLog.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@
 block discarded – undo
44 44
             $userObj = User::getByUsername($filterUser, $database);
45 45
             if ($userObj !== false) {
46 46
                 $logSearch->byUser($userObj->getId());
47
-            }
48
-            else {
47
+            } else {
49 48
                 $logSearch->byUser(-1);
50 49
             }
51 50
         }
Please login to merge, or discard this patch.
includes/Pages/PageListFlaggedComments.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -61,28 +61,23 @@
 block discarded – undo
61 61
 
62 62
                 if ($request->getReserved() === $currentUser->getId()) {
63 63
                     $data['hiddenText'] = false;
64
-                }
65
-                else {
64
+                } else {
66 65
                     $data['hiddenText'] = true;
67 66
                 }
68 67
             }
69 68
 
70 69
             if ($object->getVisibility() == 'requester' || $object->getVisibility() == 'user') {
71 70
                 $data['hidden'] = false;
72
-            }
73
-            elseif ($object->getVisibility() == 'admin') {
71
+            } elseif ($object->getVisibility() == 'admin') {
74 72
                 if ($seeRestrictedComments) {
75 73
                     $data['hidden'] = false;
76
-                }
77
-                else {
74
+                } else {
78 75
                     $data['hidden'] = true;
79 76
                 }
80
-            }
81
-            elseif ($object->getVisibility() == 'checkuser') {
77
+            } elseif ($object->getVisibility() == 'checkuser') {
82 78
                 if ($seeCheckuserComments) {
83 79
                     $data['hidden'] = false;
84
-                }
85
-                else {
80
+                } else {
86 81
                     $data['hidden'] = true;
87 82
                 }
88 83
             }
Please login to merge, or discard this patch.
includes/Pages/PageRequestFormManagement.php 1 patch
Braces   +6 added lines, -9 removed lines patch added patch discarded remove patch
@@ -56,7 +56,8 @@  discard block
 block discarded – undo
56 56
         $this->setTemplate('form-management/main.tpl');
57 57
     }
58 58
 
59
-    protected function preview() {
59
+    protected function preview()
60
+    {
60 61
         $previewContent = WebRequest::getSessionContext('preview');
61 62
 
62 63
         $renderer = new MarkdownRenderingHelper();
@@ -129,8 +130,7 @@  discard block
 block discarded – undo
129 130
                 $form->save();
130 131
                 Logger::requestFormCreated($database, $form);
131 132
                 $this->redirect('requestFormManagement');
132
-            }
133
-            else {
133
+            } else {
134 134
                 $this->populateFromObject($form);
135 135
                 WebRequest::setSessionContext('preview', [
136 136
                     'main' => $form->getFormContent(),
@@ -142,8 +142,7 @@  discard block
 block discarded – undo
142 142
                 $this->assign('createMode', true);
143 143
                 $this->setTemplate('form-management/edit.tpl');
144 144
             }
145
-        }
146
-        else {
145
+        } else {
147 146
             $this->populateFromObject(new RequestForm());
148 147
             WebRequest::setSessionContext('preview', null);
149 148
             $this->assign('hidePreview', true);
@@ -237,8 +236,7 @@  discard block
 block discarded – undo
237 236
                 Logger::requestFormEdited($database, $form);
238 237
                 $form->save();
239 238
                 $this->redirect('requestFormManagement');
240
-            }
241
-            else {
239
+            } else {
242 240
                 $this->populateFromObject($form);
243 241
                 WebRequest::setSessionContext('preview', [
244 242
                     'main' => $form->getFormContent(),
@@ -250,8 +248,7 @@  discard block
 block discarded – undo
250 248
                 $this->assign('createMode', false);
251 249
                 $this->setTemplate('form-management/edit.tpl');
252 250
             }
253
-        }
254
-        else {
251
+        } else {
255 252
             $this->populateFromObject($form);
256 253
             WebRequest::setSessionContext('preview', [
257 254
                 'main' => $form->getFormContent(),
Please login to merge, or discard this patch.
includes/Pages/UserAuth/PagePreferences.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -54,12 +54,10 @@  discard block
 block discarded – undo
54 54
 
55 55
             if ($this->barrierTest(RoleConfiguration::MAIN, $user, PageMain::class)) {
56 56
                 $this->redirect('');
57
-            }
58
-            else {
57
+            } else {
59 58
                 $this->redirect('preferences');
60 59
             }
61
-        }
62
-        else {
60
+        } else {
63 61
             $this->assignCSRFToken();
64 62
             $this->setTemplate('preferences/prefs.tpl');
65 63
 
@@ -118,8 +116,7 @@  discard block
 block discarded – undo
118 116
         $globalDefinition = WebRequest::postBoolean($fieldName . 'Global');
119 117
         if ($globalDefinition) {
120 118
             $preferencesManager->setGlobalPreference($preferenceName, $value);
121
-        }
122
-        else {
119
+        } else {
123 120
             $preferencesManager->setLocalPreference($preferenceName, $value);
124 121
         }
125 122
     }
Please login to merge, or discard this patch.
includes/Pages/UserAuth/MultiFactor/PageMultiFactor.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -91,13 +91,11 @@  discard block
 block discarded – undo
91 91
                 }
92 92
 
93 93
                 $this->redirect('multiFactor');
94
-            }
95
-            else {
94
+            } else {
96 95
                 SessionAlert::error('Error enabling YubiKey OTP - invalid credentials.');
97 96
                 $this->redirect('multiFactor');
98 97
             }
99
-        }
100
-        else {
98
+        } else {
101 99
             if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) {
102 100
                 // user is not enrolled, we shouldn't have got here.
103 101
                 throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism');
@@ -161,8 +159,7 @@  discard block
 block discarded – undo
161 159
                     $this->setTemplate('mfa/enableTotpEnroll.tpl');
162 160
 
163 161
                     return;
164
-                }
165
-                else {
162
+                } else {
166 163
                     SessionAlert::error('Error enabling TOTP - invalid credentials.');
167 164
                     $this->redirect('multiFactor');
168 165
 
@@ -187,8 +184,7 @@  discard block
 block discarded – undo
187 184
                             $this->setTemplate('mfa/regenScratchTokens.tpl');
188 185
                             return;
189 186
                         }
190
-                    }
191
-                    else {
187
+                    } else {
192 188
                         $otpCredentialProvider->deleteCredential($currentUser);
193 189
                         SessionAlert::error('Error enabling TOTP: invalid token provided');
194 190
                     }
@@ -196,8 +192,7 @@  discard block
 block discarded – undo
196 192
 
197 193
                     $this->redirect('multiFactor');
198 194
                     return;
199
-                }
200
-                else {
195
+                } else {
201 196
                     SessionAlert::error('Error enabling TOTP - no enrollment found or enrollment expired.');
202 197
                     $this->redirect('multiFactor');
203 198
 
@@ -207,8 +202,7 @@  discard block
 block discarded – undo
207 202
 
208 203
             // urgh, dunno what happened, but it's not something expected.
209 204
             throw new ApplicationLogicException();
210
-        }
211
-        else {
205
+        } else {
212 206
             if ($otpCredentialProvider->userIsEnrolled($currentUser->getId())) {
213 207
                 // user is not enrolled, we shouldn't have got here.
214 208
                 throw new ApplicationLogicException('User is already enrolled in the selected MFA mechanism');
@@ -258,13 +252,11 @@  discard block
 block discarded – undo
258 252
                 $tokens = $otpCredentialProvider->getTokens();
259 253
                 $this->assign('tokens', $tokens);
260 254
                 $this->setTemplate('mfa/regenScratchTokens.tpl');
261
-            }
262
-            else {
255
+            } else {
263 256
                 SessionAlert::error('Error refreshing scratch tokens - invalid credentials.');
264 257
                 $this->redirect('multiFactor');
265 258
             }
266
-        }
267
-        else {
259
+        } else {
268 260
             $this->assignCSRFToken();
269 261
 
270 262
             $this->assign('alertmessage', 'To regenerate your emergency scratch tokens, please prove you are who you say you are by providing your tool password below. Note that continuing will invalidate all remaining scratch tokens, and provide a set of new ones.');
@@ -302,13 +294,11 @@  discard block
 block discarded – undo
302 294
                 $otpCredentialProvider->deleteCredential($currentUser);
303 295
                 SessionAlert::success('Disabled ' . $factorType . '.');
304 296
                 $this->redirect('multiFactor');
305
-            }
306
-            else {
297
+            } else {
307 298
                 SessionAlert::error('Error disabling ' . $factorType . ' - invalid credentials.');
308 299
                 $this->redirect('multiFactor');
309 300
             }
310
-        }
311
-        else {
301
+        } else {
312 302
             if (!$otpCredentialProvider->userIsEnrolled($currentUser->getId())) {
313 303
                 // user is not enrolled, we shouldn't have got here.
314 304
                 throw new ApplicationLogicException('User is not enrolled in the selected MFA mechanism');
Please login to merge, or discard this patch.
includes/Pages/PageBan.php 1 patch
Braces   +8 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
                 SessionAlert::error($ex->getMessage());
81 81
                 $this->redirect("bans", "set");
82 82
             }
83
-        }
84
-        else {
83
+        } else {
85 84
             $this->handleGetMethodForSetBan();
86 85
         }
87 86
     }
@@ -130,8 +129,7 @@  discard block
 block discarded – undo
130 129
             $this->getNotificationHelper()->unbanned($ban, $unbanReason);
131 130
 
132 131
             $this->redirect('bans');
133
-        }
134
-        else {
132
+        } else {
135 133
             $this->assignCSRFToken();
136 134
             $this->assign('ban', $ban);
137 135
             $this->setTemplate('bans/unban.tpl');
@@ -149,17 +147,14 @@  discard block
 block discarded – undo
149 147
 
150 148
             if (!$duration) {
151 149
                 throw new ApplicationLogicException('Invalid ban time');
152
-            }
153
-            elseif (time() > $duration) {
150
+            } elseif (time() > $duration) {
154 151
                 throw new ApplicationLogicException('Ban time has already expired!');
155 152
             }
156 153
 
157 154
             return $duration;
158
-        }
159
-        elseif ($duration === "-1") {
155
+        } elseif ($duration === "-1") {
160 156
             return null;
161
-        }
162
-        else {
157
+        } else {
163 158
             $duration = WebRequest::postInt('duration') + time();
164 159
 
165 160
             return $duration;
@@ -409,7 +404,8 @@  discard block
 block discarded – undo
409 404
     protected function setupBanList(array $bans): void
410 405
     {
411 406
         $userIds = array_map(
412
-            function(Ban $entry) {
407
+            function(Ban $entry)
408
+            {
413 409
                 return $entry->getUser();
414 410
             },
415 411
             $bans);
@@ -439,8 +435,7 @@  discard block
 block discarded – undo
439 435
             $ipParts = explode('/', $targetIp, 2);
440 436
             $targetIp = $ipParts[0];
441 437
             $targetMask = (int)$ipParts[1];
442
-        }
443
-        else {
438
+        } else {
444 439
             $targetMask = filter_var($targetIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ? 128 : 32;
445 440
         }
446 441
 
Please login to merge, or discard this patch.
includes/Pages/RequestAction/PageBreakReservation.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,13 +33,11 @@  discard block
 block discarded – undo
33 33
 
34 34
         if ($currentUser->getId() === $request->getReserved()) {
35 35
             $this->doUnreserve($request, $database);
36
-        }
37
-        else {
36
+        } else {
38 37
             // not the same user!
39 38
             if ($this->barrierTest('force', $currentUser)) {
40 39
                 $this->doBreakReserve($request, $database);
41
-            }
42
-            else {
40
+            } else {
43 41
                 throw new AccessDeniedException($this->getSecurityManager(), $this->getDomainAccessManager());
44 42
             }
45 43
         }
@@ -83,8 +81,7 @@  discard block
 block discarded – undo
83 81
             $this->skipAlerts();
84 82
 
85 83
             $this->setTemplate("confirmations/breakreserve.tpl");
86
-        }
87
-        else {
84
+        } else {
88 85
             $request->setReserved(null);
89 86
             $request->setUpdateVersion(WebRequest::postInt('updateversion'));
90 87
             $request->save();
Please login to merge, or discard this patch.