Passed
Branch — code_review (3a90db)
by Nils
27:18 queued 02:44
created
api/Model/FolderModel.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         $ret = [];
35 35
 
36 36
         foreach ($rows as $row) {
37
-			$isVisible = in_array((int) $row['id'], $foldersId);
37
+            $isVisible = in_array((int) $row['id'], $foldersId);
38 38
             $childrens = $this->getFoldersChildren($row['id'], $foldersId);
39 39
 
40 40
             if ($isVisible || count($childrens) > 0) {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
                     [
44 44
                         'id' => (int) $row['id'],
45 45
                         'title' => $row['title'],
46
-						'isVisible' => $isVisible,
46
+                        'isVisible' => $isVisible,
47 47
                         'childrens' => $childrens
48 48
                     ]
49 49
                 );
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         if ( count($childrens) > 0) {
65 65
             foreach ($childrens as $children) {
66
-				$isVisible = in_array((int) $children['id'], $foldersId);
66
+                $isVisible = in_array((int) $children['id'], $foldersId);
67 67
                 $childs = $this->getFoldersChildren($children['id'], $foldersId);
68 68
 
69 69
                 if (in_array((int) $children['id'], $foldersId) || count($childs) > 0) {
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                         [
73 73
                             'id' => (int) $children['id'],
74 74
                             'title' => $children['title'],
75
-							'isVisible' => $isVisible,
75
+                            'isVisible' => $isVisible,
76 76
                             'childrens' => $childs
77 77
                         ]
78 78
                     );
Please login to merge, or discard this patch.
sources/main.functions.php 1 patch
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
  * <tt>exec("find ".$path." -type d -exec chmod 755 {} \;");</tt>
2226 2226
  *
2227 2227
  * @author Jeppe Toustrup (tenzer at tenzer dot dk)
2228
-  *
2228
+ *
2229 2229
  * @param string $path      An either relative or absolute path to a file or directory which should be processed.
2230 2230
  * @param int    $filePerm The permissions any found files should get.
2231 2231
  * @param int    $dirPerm  The permissions any found folder should get.
@@ -3848,7 +3848,6 @@  discard block
 block discarded – undo
3848 3848
  * @param integer $processId
3849 3849
  * @param integer $nbItemsToTreat
3850 3850
  * @return void
3851
- 
3852 3851
  */
3853 3852
 function createUserTasks($processId, $nbItemsToTreat): void
3854 3853
 {
Please login to merge, or discard this patch.
pages/search.js.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
  * Certain components of this file may be under different licenses. For
23 23
  * details, see the `licenses` directory or individual file headers.
24 24
  * ---
25
-  * @file      search.js.php
25
+ * @file      search.js.php
26 26
  * @author    Nils LaumaillĂ© ([email protected])
27 27
  * @copyright 2009-2024 Teampass.net
28 28
  * @license   GPL-3.0
Please login to merge, or discard this patch.
api/inc/jwt_utils.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -37,45 +37,45 @@  discard block
 block discarded – undo
37 37
  * @return boolean
38 38
  */
39 39
 function is_jwt_valid($jwt) {
40
-	try {
41
-		$decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'));
40
+    try {
41
+        $decoded = (array) JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'));
42 42
 
43
-		// Check if expiration is reached
44
-		if ($decoded['exp'] - time() < 0) {
45
-			return false;
46
-		}
43
+        // Check if expiration is reached
44
+        if ($decoded['exp'] - time() < 0) {
45
+            return false;
46
+        }
47 47
 /*
48 48
 		$decoded1 = JWT::decode($jwt, new Key(DB_PASSWD, 'HS256'), $headers = new stdClass());
49 49
 		print_r($headers);
50 50
 */
51 51
 
52
-		return true;
53
-	} catch (InvalidArgumentException $e) {
54
-		// provided key/key-array is empty or malformed.
55
-		return false;
56
-	} catch (DomainException $e) {
57
-		// provided algorithm is unsupported OR
58
-		// provided key is invalid OR
59
-		// unknown error thrown in openSSL or libsodium OR
60
-		// libsodium is required but not available.
61
-		return false;
62
-	} catch (SignatureInvalidException $e) {
63
-		// provided JWT signature verification failed.
64
-		return false;
65
-	} catch (BeforeValidException $e) {
66
-		// provided JWT is trying to be used before "nbf" claim OR
67
-		// provided JWT is trying to be used before "iat" claim.
68
-		return false;
69
-	} catch (ExpiredException $e) {
70
-		// provided JWT is trying to be used after "exp" claim.
71
-		return false;
72
-	} catch (UnexpectedValueException $e) {
73
-		// provided JWT is malformed OR
74
-		// provided JWT is missing an algorithm / using an unsupported algorithm OR
75
-		// provided JWT algorithm does not match provided key OR
76
-		// provided key ID in key/key-array is empty or invalid.
77
-		return false;
78
-	}
52
+        return true;
53
+    } catch (InvalidArgumentException $e) {
54
+        // provided key/key-array is empty or malformed.
55
+        return false;
56
+    } catch (DomainException $e) {
57
+        // provided algorithm is unsupported OR
58
+        // provided key is invalid OR
59
+        // unknown error thrown in openSSL or libsodium OR
60
+        // libsodium is required but not available.
61
+        return false;
62
+    } catch (SignatureInvalidException $e) {
63
+        // provided JWT signature verification failed.
64
+        return false;
65
+    } catch (BeforeValidException $e) {
66
+        // provided JWT is trying to be used before "nbf" claim OR
67
+        // provided JWT is trying to be used before "iat" claim.
68
+        return false;
69
+    } catch (ExpiredException $e) {
70
+        // provided JWT is trying to be used after "exp" claim.
71
+        return false;
72
+    } catch (UnexpectedValueException $e) {
73
+        // provided JWT is malformed OR
74
+        // provided JWT is missing an algorithm / using an unsupported algorithm OR
75
+        // provided JWT algorithm does not match provided key OR
76
+        // provided key ID in key/key-array is empty or invalid.
77
+        return false;
78
+    }
79 79
 }
80 80
 
81 81
 function base64url_encode($data) {
@@ -84,23 +84,23 @@  discard block
 block discarded – undo
84 84
 
85 85
 function get_authorization_header()
86 86
 {
87
-	$request = symfonyRequest::createFromGlobals();
88
-	$authorizationHeader = $request->headers->get('Authorization');
89
-	$headers = null;
87
+    $request = symfonyRequest::createFromGlobals();
88
+    $authorizationHeader = $request->headers->get('Authorization');
89
+    $headers = null;
90 90
 	
91
-	if (null !== $authorizationHeader) {
92
-		$headers = trim($authorizationHeader);
93
-	} else if (function_exists('apache_request_headers') === true) {
94
-		$requestHeaders = (array) apache_request_headers();
95
-		// Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
96
-		$requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
97
-		//print_r($requestHeaders);
98
-		if (isset($requestHeaders['Authorization']) === true) {
99
-			$headers = trim($requestHeaders['Authorization']);
100
-		}
101
-	}
91
+    if (null !== $authorizationHeader) {
92
+        $headers = trim($authorizationHeader);
93
+    } else if (function_exists('apache_request_headers') === true) {
94
+        $requestHeaders = (array) apache_request_headers();
95
+        // Server-side fix for bug in old Android versions (a nice side-effect of this fix means we don't care about capitalization for Authorization)
96
+        $requestHeaders = array_combine(array_map('ucwords', array_keys($requestHeaders)), array_values($requestHeaders));
97
+        //print_r($requestHeaders);
98
+        if (isset($requestHeaders['Authorization']) === true) {
99
+            $headers = trim($requestHeaders['Authorization']);
100
+        }
101
+    }
102 102
 	
103
-	return $headers;
103
+    return $headers;
104 104
 }
105 105
 
106 106
 function get_bearer_token() {
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 
118 118
 function get_bearer_data($jwt) {
119 119
     // split the jwt
120
-	$tokenParts = explode('.', $jwt);
121
-	$payload = base64_decode($tokenParts[1]);
120
+    $tokenParts = explode('.', $jwt);
121
+    $payload = base64_decode($tokenParts[1]);
122 122
 	
123 123
     // HEADER: Get the access token from the header
124 124
     if (empty($payload) === false) {
Please login to merge, or discard this patch.
api/Model/AuthModel.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@
 block discarded – undo
239 239
         $configManager = new ConfigManager();
240 240
         $SETTINGS = $configManager->getAllSettings();
241 241
         
242
-		$payload = [
242
+        $payload = [
243 243
             'username' => $login,
244 244
             'id' => $id, 
245 245
             'exp' => (time() + $SETTINGS['api_token_duration'] + 600),
Please login to merge, or discard this patch.