Passed
Branch — remove-tp-config (101a80)
by Nils
11:52
created
api/Model/UserModel.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
  *
22 22
  * @see       https://www.teampass.net
23 23
  */
24
-require_once API_ROOT_PATH . "/Model/Database.php";
24
+require_once API_ROOT_PATH."/Model/Database.php";
25 25
 
26 26
 class UserModel extends Database
27 27
 {
Please login to merge, or discard this patch.
api/Model/FolderModel.php 2 patches
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.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,12 +25,12 @@  discard block
 block discarded – undo
25 25
 
26 26
 use TeampassClasses\Language\Language;
27 27
 
28
-require_once API_ROOT_PATH . "/Model/Database.php";
28
+require_once API_ROOT_PATH."/Model/Database.php";
29 29
 class FolderModel extends Database
30 30
 {
31 31
     public function getFoldersInfo(array $foldersId): array
32 32
     {
33
-        $rows = $this->select( "SELECT id, title FROM " . prefixTable('nested_tree') . " WHERE nlevel=1" );
33
+        $rows = $this->select("SELECT id, title FROM ".prefixTable('nested_tree')." WHERE nlevel=1");
34 34
 
35 35
         $ret = [];
36 36
 
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     private function getFoldersChildren(int $parentId, array $foldersId): array
58 58
     {
59 59
         $ret = [];
60
-        $childrens = $this->select('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE parent_id=' . $parentId);
60
+        $childrens = $this->select('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE parent_id='.$parentId);
61 61
 
62
-        if ( count($childrens) > 0) {
62
+        if (count($childrens) > 0) {
63 63
             foreach ($childrens as $children) {
64 64
 				$isVisible = in_array((int) $children['id'], $foldersId);
65 65
                 $childs = $this->getFoldersChildren($children['id'], $foldersId);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     ): array
102 102
     {
103 103
         // Validate inputs
104
-        include_once API_ROOT_PATH . '/../sources/main.functions.php';
104
+        include_once API_ROOT_PATH.'/../sources/main.functions.php';
105 105
         $data = [
106 106
             'title' => $title,
107 107
             'parent_id' => $parent_id,
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                 'error' => true,
167 167
                 'error_header' => 'HTTP/1.1 422 Unprocessable Entity',
168 168
                 'error_message' => 'Invalid parameters'
169
-            ];}
169
+            ]; }
170 170
 
171 171
         // Create folder
172 172
         /*
Please login to merge, or discard this patch.
api/Controller/Api/ItemController.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             // SQL where clause with folders list
53 53
             if (isset($arrQueryStringParams['folders']) === true) {
54 54
                 // convert the folders to an array
55
-                $arrQueryStringParams['folders'] = explode(',', str_replace( array('[',']') , ''  , $arrQueryStringParams['folders']));
55
+                $arrQueryStringParams['folders'] = explode(',', str_replace(array('[', ']'), '', $arrQueryStringParams['folders']));
56 56
 
57 57
                 // ensure to only use the intersection
58 58
                 $foldersList = implode(',', array_intersect($arrQueryStringParams['folders'], $userData['folders_list']));
@@ -126,10 +126,10 @@  discard block
 block discarded – undo
126 126
             // SQL where clause with item id
127 127
             if (isset($arrQueryStringParams['id']) === true) {
128 128
                 // build sql where clause by ID
129
-                $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'] . $sql_constraint;
129
+                $sqlExtra = ' WHERE i.id = '.$arrQueryStringParams['id'].$sql_constraint;
130 130
             } else if (isset($arrQueryStringParams['label']) === true) {
131 131
                 // build sql where clause by LABEL
132
-                $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']) . $sql_constraint;
132
+                $sqlExtra = ' WHERE i.label '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['label'] : ' = '.$arrQueryStringParams['label']).$sql_constraint;
133 133
             } else if (isset($arrQueryStringParams['description']) === true) {
134 134
                 // build sql where clause by LABEL
135 135
                 $sqlExtra = ' WHERE i.description '.(isset($arrQueryStringParams['like']) === true && (int) $arrQueryStringParams['like'] === 1 ? ' LIKE '.$arrQueryStringParams['description'] : ' = '.$arrQueryStringParams['description']).$sql_constraint;
Please login to merge, or discard this patch.
scripts/task_maintenance_rebuild_config_file.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,8 +72,8 @@
 block discarded – undo
72 72
 function rebuildConfigFile(): void
73 73
 {
74 74
     // Load expected files
75
-    require_once __DIR__. '/../sources/main.functions.php';
76
-    include __DIR__. '/../includes/config/tp.config.php';
75
+    require_once __DIR__.'/../sources/main.functions.php';
76
+    include __DIR__.'/../includes/config/tp.config.php';
77 77
 
78 78
     if (isset($SETTINGS) === true) {
79 79
         handleConfigFile('rebuild', $SETTINGS);
Please login to merge, or discard this patch.
api/Controller/Api/AuthController.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $arrQueryStringParams = $this->getQueryStringParams();
40 40
 
41 41
         if (strtoupper($requestMethod) === 'POST') {
42
-            require API_ROOT_PATH . "/Model/AuthModel.php";
42
+            require API_ROOT_PATH."/Model/AuthModel.php";
43 43
             try {
44 44
                 $authModel = new AuthModel();
45 45
                 $arrUser = $authModel->getUserAuth(
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
                 if (array_key_exists("token", $arrUser)) {
51 51
                     $responseData = json_encode($arrUser);
52 52
                 } else {
53
-                    $strErrorDesc = $arrUser['error'] . " (" . $arrUser['info'] . ")";
53
+                    $strErrorDesc = $arrUser['error']." (".$arrUser['info'].")";
54 54
                     $strErrorHeader = 'HTTP/1.1 401 Unauthorized';
55 55
                 }
56 56
             } catch (Error $e) {
Please login to merge, or discard this patch.
api/Model/Operation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
                 "error" => '',
41 41
             );
42 42
     
43
-        }catch (Exception $e) {    
43
+        } catch (Exception $e) {    
44 44
             return false;
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
api/Model/AuthModel.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@
 block discarded – undo
133 133
     {
134 134
         include API_ROOT_PATH . '/../includes/config/tp.config.php';
135 135
         
136
-		$payload = [
136
+        $payload = [
137 137
             'username' => $login,
138 138
             'id' => $id, 
139 139
             'exp' => (time() + $SETTINGS['api_token_duration'] + 600),
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 use Firebase\JWT\JWT;
28 28
 use Firebase\JWT\Key;
29 29
 
30
-require_once API_ROOT_PATH . "/Model/Database.php";
30
+require_once API_ROOT_PATH."/Model/Database.php";
31 31
 
32 32
 
33 33
 class AuthModel extends Database
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     public function getUserAuth(string $login, string $password, string $apikey): array
46 46
     {
47 47
         // Sanitize
48
-        include_once API_ROOT_PATH . '/../sources/main.functions.php';
48
+        include_once API_ROOT_PATH.'/../sources/main.functions.php';
49 49
         $inputData = dataSanitizer(
50 50
             [
51 51
                 'login' => isset($login) === true ? $login : '',
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         // Check apikey
66 66
         if (empty($inputData['password']) === true) {
67 67
             // case where it is a generic key
68
-            $apiInfo = $this->select("SELECT * FROM " . prefixTable('api') . " WHERE value='".$inputData['apikey']."' AND label='".$inputData['login']."'");
68
+            $apiInfo = $this->select("SELECT * FROM ".prefixTable('api')." WHERE value='".$inputData['apikey']."' AND label='".$inputData['login']."'");
69 69
             $apiInfo = $apiInfo[0];
70 70
             if (WIP === true) {
71 71
                 if (isset($apiInfo['increment_id']) === false) {
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 }
79 79
 
80 80
                 // Log user
81
-                include API_ROOT_PATH . '/../includes/config/tp.config.php';
81
+                include API_ROOT_PATH.'/../includes/config/tp.config.php';
82 82
                 logEvents($SETTINGS, 'api', 'user_connection', (string) $apiInfo['increment_id'], stripslashes($inputData['login']));
83 83
 
84 84
                 // create JWT
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
             // Check if user exists
111 111
             $userInfoRes = $this->select(
112 112
                 "SELECT u.id, u.pw, u.login, u.admin, u.gestionnaire, u.can_manage_all_users, u.fonction_id, u.can_create_root_folder, u.public_key, u.private_key, u.personal_folder, u.fonction_id, u.groupes_visibles, u.groupes_interdits, a.value AS user_api_key, a.allowed_folders as user_api_allowed_folders, a.enabled, a.allowed_to_create, a.allowed_to_read, a.allowed_to_update, a.allowed_to_delete
113
-                FROM " . prefixTable('users') . " AS u
114
-                INNER JOIN " . prefixTable('api') . " AS a ON (a.user_id=u.id)
113
+                FROM " . prefixTable('users')." AS u
114
+                INNER JOIN " . prefixTable('api')." AS a ON (a.user_id=u.id)
115 115
                 WHERE login='".$inputData['login']."'");
116 116
             if (count($userInfoRes) === 0) {
117 117
                 return ["error" => "Login failed.", "info" => "apikey : Not valid"];
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 // Update user's key_tempo
140 140
                 $keyTempo = bin2hex(random_bytes(16));
141 141
                 $this->update(
142
-                    "UPDATE " . prefixTable('users') . "
142
+                    "UPDATE ".prefixTable('users')."
143 143
                     SET key_tempo='".$keyTempo."'
144 144
                     WHERE id=".$userInfo['id']
145 145
                 );
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                 $ret = $this->buildUserFoldersList($userInfo);
149 149
 
150 150
                 // Log user
151
-                include API_ROOT_PATH . '/../includes/config/tp.config.php';
151
+                include API_ROOT_PATH.'/../includes/config/tp.config.php';
152 152
                 logEvents($SETTINGS, 'api', 'user_connection', (string) $userInfo['id'], stripslashes($userInfo['login']));
153 153
 
154 154
                 // create JWT
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
         int $allowed_to_delete,
223 223
     ): array
224 224
     {
225
-        include API_ROOT_PATH . '/../includes/config/tp.config.php';
225
+        include API_ROOT_PATH.'/../includes/config/tp.config.php';
226 226
         
227 227
 		$payload = [
228 228
             'username' => $login,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
         // Get folders from the roles
279 279
         if (empty($userFunctionId) === false) {
280
-            $rows = $this->select("SELECT * FROM " . prefixTable('roles_values') . " WHERE role_id IN (".$userFunctionId.") AND type IN ('W', 'ND', 'NE', 'NDNE', 'R')");
280
+            $rows = $this->select("SELECT * FROM ".prefixTable('roles_values')." WHERE role_id IN (".$userFunctionId.") AND type IN ('W', 'ND', 'NE', 'NDNE', 'R')");
281 281
             foreach ($rows as $record) {
282 282
                 if ($record['type'] === 'R') {
283 283
                     array_push($readOnlyFolders, $record['folder_id']);
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
         
299 299
         // Does this user is allowed to see other items
300 300
         $inc = 0;
301
-        $rows = $this->select("SELECT id, id_tree FROM " . prefixTable('items') . " WHERE restricted_to LIKE '".$userInfo['id']."'".
301
+        $rows = $this->select("SELECT id, id_tree FROM ".prefixTable('items')." WHERE restricted_to LIKE '".$userInfo['id']."'".
302 302
             (empty($userFunctionId) === false ? ' AND id_tree NOT IN ('.$userFunctionId.')' : ''));
303 303
         foreach ($rows as $record) {
304 304
             // Exclude restriction on item if folder is fully accessible
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 
309 309
         // Check for the users roles if some specific rights exist on items
310 310
         $rows = $this->select("SELECT i.id_tree, r.item_id
311
-            FROM " . prefixTable('items') . " as i
312
-            INNER JOIN " . prefixTable('restriction_to_roles') . " as r ON (r.item_id=i.id)
311
+            FROM " . prefixTable('items')." as i
312
+            INNER JOIN " . prefixTable('restriction_to_roles')." as r ON (r.item_id=i.id)
313 313
             WHERE ".(empty($userFunctionId) === false ? ' id_tree NOT IN ('.$userFunctionId.') AND ' : '')." i.id_tree != ''
314 314
             ORDER BY i.id_tree ASC");
315 315
         foreach ($rows as $record) {
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
         // Add all personal folders
324 324
         $rows = $this->select(
325 325
             'SELECT id
326
-            FROM ' . prefixTable('nested_tree') . '
326
+            FROM ' . prefixTable('nested_tree').'
327 327
             WHERE title = '.$userInfo['id'].' AND personal_folder = 1'.
328 328
             (empty($userFunctionId) === false ? ' AND id NOT IN ('.$userFunctionId.')' : '').
329 329
             ' LIMIT 0,1'
Please login to merge, or discard this patch.
pages/statistics.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
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('statistics') === false) {
66 66
     // Not allowed page
67 67
     $session->set('system-error_code', ERR_NOT_ALLOWED);
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit;
70 70
 }
71 71
 
Please login to merge, or discard this patch.
pages/folders.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('folders') === false) {
67 67
     // Not allowed page
68 68
     $session->set('system-error_code', ERR_NOT_ALLOWED);
69
-    include $SETTINGS['cpassman_dir'] . '/error.php';
69
+    include $SETTINGS['cpassman_dir'].'/error.php';
70 70
     exit;
71 71
 }
72 72
 
@@ -99,28 +99,28 @@  discard block
 block discarded – undo
99 99
 $complexityHtml = '<div id="hidden-select-complexity" class="hidden"><select id="select-complexity" class="form-control form-item-control save-me">';
100 100
 $complexitySelect = '';
101 101
 foreach (TP_PW_COMPLEXITY as $level) {
102
-    $complexitySelect .= '<option value="' . $level[0] . '">' . $level[1] . '</option>';
102
+    $complexitySelect .= '<option value="'.$level[0].'">'.$level[1].'</option>';
103 103
 }
104
-$complexityHtml .= $complexitySelect . '</select></div>';
104
+$complexityHtml .= $complexitySelect.'</select></div>';
105 105
 
106 106
 /* Get full tree structure */
107 107
 $tst = $tree->getDescendants();
108 108
 // prepare options list
109
-$droplist = '<option value="na">---' . $lang->get('select') . '---</option>';
109
+$droplist = '<option value="na">---'.$lang->get('select').'---</option>';
110 110
 if ((int) $session->get('user-admin') === 1 || (int) $session->get('user-manager') === 1 || (int) $session->get('user-can_create_root_folder') === 1) {
111
-    $droplist .= '<option value="0">' . $lang->get('root') . '</option>';
111
+    $droplist .= '<option value="0">'.$lang->get('root').'</option>';
112 112
 }
113 113
 foreach ($tst as $t) {
114 114
     if (
115 115
         in_array($t->id, $session->get('user-accessible_folders')) === true
116 116
         && in_array($t->id, $session->get('user-personal_visible_folders')) === false
117 117
     ) {
118
-        $droplist .= '<option value="' . $t->id . '">' . addslashes($t->title);
118
+        $droplist .= '<option value="'.$t->id.'">'.addslashes($t->title);
119 119
         $text = '';
120 120
         foreach ($tree->getPath($t->id, false) as $fld) {
121
-            $text .= empty($text) === true ? '     [' . $fld->title : ' > ' . $fld->title;
121
+            $text .= empty($text) === true ? '     ['.$fld->title : ' > '.$fld->title;
122 122
         }
123
-        $droplist .= (empty($text) === true ? '' : $text . '</i>]') . '</option>';
123
+        $droplist .= (empty($text) === true ? '' : $text.'</i>]').'</option>';
124 124
     }
125 125
 }
126 126
 
@@ -199,14 +199,14 @@  discard block
 block discarded – undo
199 199
                                     <label><?php echo $lang->get('icon'); ?></label>
200 200
                                     <input type="text" class="form-control form-folder-control purify" id="new-folder-add-icon" data-field="icon">
201 201
                                     <small class='form-text text-muted'>
202
-                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
202
+                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
203 203
                                     </small>
204 204
                                 </div>
205 205
                                 <div class="form-group">
206 206
                                     <label><?php echo $lang->get('icon_on_selection'); ?></label>
207 207
                                     <input type="text" class="form-control form-folder-control purify" id="new-folder-add-icon-selected" data-field="iconSelected">
208 208
                                     <small class='form-text text-muted'>
209
-                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL;?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
209
+                                        <?php echo $lang->get('fontawesome_icon_tip'); ?><a href="<?php echo FONTAWESOME_URL; ?>" target="_blank"><i class="fas fa-external-link-alt ml-1"></i></a>
210 210
                                     </small>
211 211
                                 </div>
212 212
                                 <div class="form-group">
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                                 <th scope="col" min-width="200px"><?php echo $lang->get('group'); ?></th>
298 298
                                 <th scope="col" min-width="200px"><?php echo $lang->get('group_parent'); ?></th>
299 299
                                 <th scope="col" width="50px"><i class="fas fa-gavel fa-lg infotip" title="<?php echo $lang->get('password_strength'); ?>"></i></th>
300
-                                <th scope="col" width="50px"><i class="fas fa-recycle fa-lg infotip" title="<?php echo $lang->get('group_pw_duration') . ' ' . $lang->get('group_pw_duration_tip'); ?>"></i></th>
300
+                                <th scope="col" width="50px"><i class="fas fa-recycle fa-lg infotip" title="<?php echo $lang->get('group_pw_duration').' '.$lang->get('group_pw_duration_tip'); ?>"></i></th>
301 301
                                 <th scope="col" width="50px"><i class="fas fa-pen fa-lg infotip" title="<?php echo $lang->get('auth_creation_without_complexity'); ?>"></i></th>
302 302
                                 <th scope="col" width="50px"><i class="fas fa-edit fa-lg infotip" title="<?php echo $lang->get('auth_modification_without_complexity'); ?>"></i></th>
303 303
                                 <th scope="col" width="50px"><i class="fas fa-folder fa-lg infotip" title="<?php echo $lang->get('icon'); ?>"></i></th>
Please login to merge, or discard this patch.