| @@ -352,7 +352,7 @@ | ||
| 352 | 352 | */ | 
| 353 | 353 | public function setIp(?string $ip, ?int $mask): void | 
| 354 | 354 |      { | 
| 355 | -        if($ip === null) { | |
| 355 | +        if ($ip === null) { | |
| 356 | 356 | $this->ip = null; | 
| 357 | 357 |          } else { | 
| 358 | 358 | $this->ip = inet_pton($ip); | 
| @@ -354,7 +354,8 @@ | ||
| 354 | 354 |      { | 
| 355 | 355 |          if($ip === null) { | 
| 356 | 356 | $this->ip = null; | 
| 357 | -        } else { | |
| 357 | + } | |
| 358 | +        else { | |
| 358 | 359 | $this->ip = inet_pton($ip); | 
| 359 | 360 | } | 
| 360 | 361 | |
| @@ -50,7 +50,7 @@ discard block | ||
| 50 | 50 | return; | 
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | -        $idList = explode(',',$rawIdList); | |
| 53 | +        $idList = explode(',', $rawIdList); | |
| 54 | 54 | |
| 55 | 55 | $bans = Ban::getByIdList($idList, $this->getDatabase()); | 
| 56 | 56 | |
| @@ -188,16 +188,16 @@ discard block | ||
| 188 | 188 | $targetMask = null; | 
| 189 | 189 | |
| 190 | 190 | // check the user is allowed to use provided targets | 
| 191 | -        if(!$this->barrierTest('name', $user, 'BanType')) { | |
| 191 | +        if (!$this->barrierTest('name', $user, 'BanType')) { | |
| 192 | 192 | $targetName = null; | 
| 193 | 193 | } | 
| 194 | -        if(!$this->barrierTest('ip', $user, 'BanType')) { | |
| 194 | +        if (!$this->barrierTest('ip', $user, 'BanType')) { | |
| 195 | 195 | $targetIp = null; | 
| 196 | 196 | } | 
| 197 | -        if(!$this->barrierTest('email', $user, 'BanType')) { | |
| 197 | +        if (!$this->barrierTest('email', $user, 'BanType')) { | |
| 198 | 198 | $targetEmail = null; | 
| 199 | 199 | } | 
| 200 | -        if(!$this->barrierTest('useragent', $user, 'BanType')) { | |
| 200 | +        if (!$this->barrierTest('useragent', $user, 'BanType')) { | |
| 201 | 201 | $targetUseragent = null; | 
| 202 | 202 | } | 
| 203 | 203 | |
| @@ -215,7 +215,8 @@ | ||
| 215 | 215 |                  $ipParts = explode('/', $targetIp, 2); | 
| 216 | 216 | $targetIp = $ipParts[0]; | 
| 217 | 217 | $targetMask = $ipParts[1]; | 
| 218 | -            } else { | |
| 218 | + } | |
| 219 | +            else { | |
| 219 | 220 | $targetMask = filter_var($targetIp, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) ? 128 : 32; | 
| 220 | 221 | } | 
| 221 | 222 | |
| @@ -208,7 +208,7 @@ | ||
| 208 | 208 |      { | 
| 209 | 209 | $banHelper = new BanHelper($this->getDatabase(), $this->getXffTrustProvider(), null); | 
| 210 | 210 | |
| 211 | -        if($this->validationHelper === null) { | |
| 211 | +        if ($this->validationHelper === null) { | |
| 212 | 212 | $this->validationHelper = new RequestValidationHelper( | 
| 213 | 213 | $banHelper, | 
| 214 | 214 | $this->getDatabase(), | 
| @@ -46,8 +46,8 @@ | ||
| 46 | 46 | $this->banCache[$request->getId()] = $this->getBansForRequestFromDatabase($request); | 
| 47 | 47 | } | 
| 48 | 48 | |
| 49 | -        foreach($this->banCache[$request->getId()] as $ban) { | |
| 50 | -            if($ban->getAction() === Ban::ACTION_BLOCK) { | |
| 49 | +        foreach ($this->banCache[$request->getId()] as $ban) { | |
| 50 | +            if ($ban->getAction() === Ban::ACTION_BLOCK) { | |
| 51 | 51 | return true; | 
| 52 | 52 | } | 
| 53 | 53 | } | 
| @@ -44,17 +44,17 @@ | ||
| 44 | 44 | $currentUser = User::getCurrent($database); | 
| 45 | 45 | |
| 46 | 46 |          if ($comment->getUser() !== $currentUser->getId()) { | 
| 47 | -            if(!$this->barrierTest('editOthers', $currentUser)) { | |
| 47 | +            if (!$this->barrierTest('editOthers', $currentUser)) { | |
| 48 | 48 | throw new AccessDeniedException($this->getSecurityManager()); | 
| 49 | 49 | } | 
| 50 | 50 | |
| 51 | - if($comment->getVisibility() === 'checkuser' | |
| 51 | + if ($comment->getVisibility() === 'checkuser' | |
| 52 | 52 |                  && !$this->barrierTest('seeCheckuserComments', $currentUser, 'RequestData')) { | 
| 53 | 53 | |
| 54 | 54 | throw new AccessDeniedException($this->getSecurityManager()); | 
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | - if($comment->getVisibility() === 'admin' | |
| 57 | + if ($comment->getVisibility() === 'admin' | |
| 58 | 58 |                  && !$this->barrierTest('seeRestrictedComments', $currentUser, 'RequestData')) { | 
| 59 | 59 | |
| 60 | 60 | throw new AccessDeniedException($this->getSecurityManager()); |