Passed
Pull Request — master (#4638)
by Nils
05:48
created
sources/roles.queries.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 ) {
78 78
     // Not allowed page
79 79
     $session->set('system-error_code', ERR_NOT_ALLOWED);
80
-    include $SETTINGS['cpassman_dir'] . '/error.php';
80
+    include $SETTINGS['cpassman_dir'].'/error.php';
81 81
     exit;
82 82
 }
83 83
 
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
                         );
463 463
 
464 464
                         // add new role to user
465
-                        $tmp = $data_tmp['fonction_id'] . (substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';' . $role_id);
465
+                        $tmp = $data_tmp['fonction_id'].(substr($data_tmp['fonction_id'], -1) == ';' ? $role_id : ';'.$role_id);
466 466
                         $session->set('user-roles', str_replace(';;', ';', $tmp));
467 467
 
468 468
                         // store in DB
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                         $groupsData = $openLdapExtra->getADGroups($ldapConnection, $SETTINGS);
724 724
                         break;
725 725
                     default:
726
-                        throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
726
+                        throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
727 727
                 }
728 728
             } catch (Exception $e) {
729 729
                 if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
             } else {
744 744
                 // Handle successful retrieval of groups
745 745
                 // exists in Teampass
746
-                foreach($groupsData['userGroups'] as $key => $group) {
746
+                foreach ($groupsData['userGroups'] as $key => $group) {
747 747
                     $role_detail = DB::queryfirstrow(
748 748
                         'SELECT a.increment_id as increment_id, a.role_id as role_id, r.title as title
749 749
                         FROM '.prefixTable('ldap_groups_roles').' AS a
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
             
769 769
             // Get all groups in Teampass
770 770
             $teampassRoles = array();
771
-            $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title'));
771
+            $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title'));
772 772
             foreach ($rows as $record) {
773 773
                 array_push(
774 774
                     $teampassRoles,
Please login to merge, or discard this patch.
sources/ldap.queries.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 ) {
81 81
     // Not allowed page
82 82
     $session->set('system-error_code', ERR_NOT_ALLOWED);
83
-    include $SETTINGS['cpassman_dir'] . '/error.php';
83
+    include $SETTINGS['cpassman_dir'].'/error.php';
84 84
     exit;
85 85
 }
86 86
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
                     $openLdapExtra = new OpenLdapExtra();
155 155
                     break;
156 156
                 default:
157
-                    throw new Exception("Unsupported LDAP type: " . $SETTINGS['ldap_type']);
157
+                    throw new Exception("Unsupported LDAP type: ".$SETTINGS['ldap_type']);
158 158
             }
159 159
         } catch (Exception $e) {
160 160
             if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             // 2- Get user info from AD
174 174
             // We want to isolate attribute ldap_user_attribute or mostly samAccountName
175 175
             $userADInfos = $ldapConnection->query()
176
-                ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
176
+                ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? $SETTINGS['ldap_user_attribute'] : 'samaccountname', '=', $post_username)
177 177
                 ->firstOrFail();
178 178
 
179 179
             // Is user enabled? Only ActiveDirectory
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         } catch (\LdapRecord\Query\ObjectNotFoundException $e) {
195 195
             $error = $e->getDetailedError();
196 196
             if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
197
-                error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
197
+                error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
198 198
             } 
199 199
             // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent
200 200
             echo prepareExchangedData(
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
             // For OpenLDAP and others, we use attribute dn
214 214
             $userAuthAttempt = $ldapConnection->auth()->attempt(
215 215
                 $SETTINGS['ldap_type'] === 'ActiveDirectory' ?
216
-                    $userADInfos['userprincipalname'][0] :  // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
216
+                    $userADInfos['userprincipalname'][0] : // refering to https://ldaprecord.com/docs/core/v2/authentication#basic-authentication
217 217
                     $userADInfos['dn'],
218 218
                 $post_password
219 219
             );
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
         } catch (\LdapRecord\Query\ObjectNotFoundException $e) {
233 233
             $error = $e->getDetailedError();
234 234
             if ($error && defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
235
-                error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage(). " - ".$error->getDiagnosticMessage());
235
+                error_log('TEAMPASS Error - LDAP - '.$error->getErrorCode()." - ".$error->getErrorMessage()." - ".$error->getDiagnosticMessage());
236 236
             }
237 237
             // deepcode ignore ServerLeak: No important data is sent and is encrypted before being sent
238 238
             echo prepareExchangedData(
Please login to merge, or discard this patch.
scripts/background_tasks___functions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 function provideLog(string $message, array $SETTINGS)
103 103
 {
104 104
     if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
105
-        error_log((string) date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], time()) . ' - '.$message);
105
+        error_log((string) date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], time()).' - '.$message);
106 106
     }
107 107
 }
108 108
 
109
-function performVisibleFoldersHtmlUpdate (int $user_id)
109
+function performVisibleFoldersHtmlUpdate(int $user_id)
110 110
 {
111 111
     $html = [];
112 112
 
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 
117 117
     // get current folders visible for user
118 118
     $cache_tree = DB::queryFirstRow(
119
-        'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i',
119
+        'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i',
120 120
         $user_id
121 121
     );
122
-    $folders = json_decode($cache_tree['data'], true);//print_r($folders);
122
+    $folders = json_decode($cache_tree['data'], true); //print_r($folders);
123 123
     foreach ($folders as $folder) {
124 124
         $idFolder = (int) explode("li_", $folder['id'])[1];
125 125
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 
133 133
         // get folder info
134 134
         $folder = DB::queryFirstRow(
135
-            'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i',
135
+            'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i',
136 136
             $idFolder
137 137
         );
138 138
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 function subTaskStatus($taskId)
168 168
 {
169 169
     $subTasks = DB::query(
170
-        'SELECT * FROM ' . prefixTable('background_subtasks') . ' WHERE task_id = %i',
170
+        'SELECT * FROM '.prefixTable('background_subtasks').' WHERE task_id = %i',
171 171
         $taskId
172 172
     );
173 173
 
Please login to merge, or discard this patch.
pages/tasks.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,8 +149,7 @@
 block discarded – undo
149 149
                                             </div>
150 150
         <?php
151 151
     }
152
-}
153
-catch (Exception $e) {
152
+} catch (Exception $e) {
154 153
     if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
155 154
         error_log('TEAMPASS Error - tasks page - '.$e->getMessage());
156 155
     }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('tasks') === false) {
65 65
     // Not allowed page
66 66
     $session->set('system-error_code', ERR_NOT_ALLOWED);
67
-    include $SETTINGS['cpassman_dir'] . '/error.php';
67
+    include $SETTINGS['cpassman_dir'].'/error.php';
68 68
     exit;
69 69
 }
70 70
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     // Get last cron execution timestamp
127 127
     DB::query(
128 128
         'SELECT valeur
129
-        FROM ' . prefixTable('misc') . '
129
+        FROM ' . prefixTable('misc').'
130 130
         WHERE type = %s AND intitule = %s and valeur >= %d',
131 131
         'admin',
132 132
         'last_cron_exec',
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
                                             $task = isset($SETTINGS['users_personal_folder_task']) === true ? explode(";", $SETTINGS['users_personal_folder_task']) : [];
235 235
                                             ?>
236 236
                                             <input type='text' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
237
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
237
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='users_personal_folder_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
238 238
                                         </div>
239 239
                                         <div class='col-2'>
240 240
                                             <button class="btn btn-primary task-define" data-task="users_personal_folder_task">
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
                                             $task = isset($SETTINGS['clean_orphan_objects_task']) === true ? explode(";", $SETTINGS['clean_orphan_objects_task']) : [];
257 257
                                             ?>
258 258
                                             <input type='text' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
259
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
259
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='clean_orphan_objects_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
260 260
                                         </div>
261 261
                                         <div class='col-2'>
262 262
                                             <button class="btn btn-primary task-define" data-task="clean_orphan_objects_task">
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
                                             $task = isset($SETTINGS['purge_temporary_files_task']) === true ? explode(";", $SETTINGS['purge_temporary_files_task']) : [];
279 279
                                             ?>
280 280
                                             <input type='text' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
281
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
281
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='purge_temporary_files_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
282 282
                                         </div>
283 283
                                         <div class='col-2'>
284 284
                                             <button class="btn btn-primary task-define" data-task="purge_temporary_files_task">
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
                                             $task = isset($SETTINGS['reload_cache_table_task']) === true ? explode(";", $SETTINGS['reload_cache_table_task']) : [];
301 301
                                             ?>
302 302
                                             <input type='text' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter' value='<?php echo isset($task[0]) === true && empty($task[0]) === false ? $lang->get($task[0])." ".(isset($task[2]) === true ? strtolower($lang->get('day')).' '.$task[2].' ' : '').$lang->get('at')." ".(isset($task[1]) === true ? $task[1] : '') : $lang->get('not_defined') ?>'>
303
-                                            <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : '';?>'>
303
+                                            <input type='hidden' disabled class='form-control form-control-sm' id='reload_cache_table_task_parameter_value' value='<?php echo isset($task[0]) === true ? $task[0].";".(isset($task[1]) === true ? $task[1] : '').(isset($task[2]) === true ? $task[2] : '') : ''; ?>'>
304 304
                                         </div>
305 305
                                         <div class='col-2'>
306 306
                                             <button class="btn btn-primary task-define" data-task="reload_cache_table_task">
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                         <h5><?php echo $lang->get('day_of_month'); ?></h5>              
518 518
                         <select class='form-control form-control-sm no-save' id='task-define-modal-parameter-monthly-value' style="width:100%;">
519 519
                             <?php
520
-                            for ($i=1; $i<=31; $i++) {
520
+                            for ($i = 1; $i <= 31; $i++) {
521 521
                                 echo '<option value="'.$i.'">'.$lang->get('day').' '.$i.'</option>';
522 522
                             }
523 523
                             ?>
Please login to merge, or discard this patch.
pages/admin.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -222,8 +222,7 @@
 block discarded – undo
222 222
                             </div>
223 223
         <?php
224 224
     }
225
-}
226
-catch (Exception $e) {
225
+} catch (Exception $e) {
227 226
     if (defined('LOG_TO_SERVER') && LOG_TO_SERVER === true) {
228 227
         error_log('TEAMPASS Error - admin page - '.$e->getMessage());
229 228
     }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) {
69 69
     // Not allowed page
70 70
     $session->set('system-error_code', ERR_NOT_ALLOWED);
71
-    include $SETTINGS['cpassman_dir'] . '/error.php';
71
+    include $SETTINGS['cpassman_dir'].'/error.php';
72 72
     exit;
73 73
 }
74 74
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     // Get last cron execution timestamp
200 200
     DB::query(
201 201
         'SELECT valeur
202
-        FROM ' . prefixTable('misc') . '
202
+        FROM ' . prefixTable('misc').'
203 203
         WHERE type = %s AND intitule = %s and valeur >= %d',
204 204
         'admin',
205 205
         'last_cron_exec',
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                     <div class="card-body">
271 271
                         <?php
272 272
                         // Display information about server
273
-                        $dbSize = DB::queryFirstRow("SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'size' FROM information_schema.TABLES WHERE table_schema = '" . DB_NAME . "'");
273
+                        $dbSize = DB::queryFirstRow("SELECT ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS 'size' FROM information_schema.TABLES WHERE table_schema = '".DB_NAME."'");
274 274
 
275 275
                         // Get OS
276 276
                         $uname = php_uname('s');
@@ -326,17 +326,17 @@  discard block
 block discarded – undo
326 326
                         }
327 327
 
328 328
                         echo 
329
-                        '<p>' . $os.
329
+                        '<p>'.$os.
330 330
                             '<br><span class="ml-4"></span>'.
331 331
                         '</p>'.
332 332
                         $internetAccess.
333
-                        '<p><i class="fa-brands fa-php mr-2"></i>PHP version: ' . phpversion().
333
+                        '<p><i class="fa-brands fa-php mr-2"></i>PHP version: '.phpversion().
334 334
                             '<br><span class="ml-4">Memory limit: '.(ini_get('memory_limit')).'</span>'.
335 335
                             '<br><span class="ml-4">Memory usage: '.formatSizeUnits(memory_get_usage()).'</span>'.
336 336
                             '<br><span class="ml-4">Maximum time execution: '.ini_get('max_execution_time').'</span>'.
337 337
                             '<br><span class="ml-4">Maximum file size upload: '.ini_get('upload_max_filesize').'</span>'.
338 338
                         '</p>'.
339
-                        '<p><i class="fa-solid fa-server mr-2"></i>Server version: ' . DB::serverVersion().
339
+                        '<p><i class="fa-solid fa-server mr-2"></i>Server version: '.DB::serverVersion().
340 340
                             '<br><span class="ml-4">Database size: '.($dbSize['size']).'MB</span>'.
341 341
                         '</p>';
342 342
 
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
                         $serverTime = localtime(time(), true);
345 345
                         echo '<div class="row">'.
346 346
                             '<div class="col-6"><i class="fa-solid fa-clock mr-2"></i>Server time:</div>'.
347
-                            '<div class="col-6"><span class="badge badge-info">' . 
348
-                            str_pad(strval($serverTime['tm_hour']), 2, "0", STR_PAD_LEFT) . ':' .
349
-                            str_pad(strval($serverTime['tm_min']), 2, "0", STR_PAD_LEFT) . ':' .
350
-                            str_pad(strval($serverTime['tm_sec']), 2, "0", STR_PAD_LEFT) .
351
-                            '</span></div>' .
347
+                            '<div class="col-6"><span class="badge badge-info">'. 
348
+                            str_pad(strval($serverTime['tm_hour']), 2, "0", STR_PAD_LEFT).':'.
349
+                            str_pad(strval($serverTime['tm_min']), 2, "0", STR_PAD_LEFT).':'.
350
+                            str_pad(strval($serverTime['tm_sec']), 2, "0", STR_PAD_LEFT).
351
+                            '</span></div>'.
352 352
                         '</div>'.
353 353
                         '<div class="row">'.
354 354
                             '<div class="col-6"><span class="ml-4">Timezone:</span></div>'.
Please login to merge, or discard this patch.
sources/core.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 {
58 58
     // Load AntiXSS
59 59
     $antiXss = new AntiXSS();
60
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
61
-        header('Location: ' . $antiXss->xss_clean($url));
60
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
61
+        header('Location: '.$antiXss->xss_clean($url));
62 62
     }
63 63
 
64 64
     //If headers are sent... do java redirect... if java disabled, do html redirect.
65 65
     echo '<script type="text/javascript">';
66
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
66
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
67 67
     echo '</script>';
68 68
     echo '<noscript>';
69
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
69
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
70 70
     echo '</noscript>';
71 71
 }
72 72
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     && isset($SETTINGS['enable_sts']) === true
93 93
     && (int) $SETTINGS['enable_sts'] === 1
94 94
 ) {
95
-    teampassRedirect('https://' . $server['http_host'] . $server['request_uri']);
95
+    teampassRedirect('https://'.$server['http_host'].$server['request_uri']);
96 96
 }
97 97
 
98 98
 // Load pwComplexity
@@ -113,11 +113,11 @@  discard block
 block discarded – undo
113 113
 // LOAD CPASSMAN SETTINGS
114 114
 if (
115 115
     isset($SETTINGS['cpassman_dir']) === true
116
-    && is_dir($SETTINGS['cpassman_dir'] . '/install') === true
116
+    && is_dir($SETTINGS['cpassman_dir'].'/install') === true
117 117
 ) {
118 118
     // Should we delete folder INSTALL?
119 119
     $row = DB::queryFirstRow(
120
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s',
120
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s',
121 121
         'install',
122 122
         'clear_install_folder'
123 123
     );
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
             if ($directories !== false) {
136 136
                 $files = array_diff($directories, ['.', '..']);
137 137
                 foreach ($files as $file) {
138
-                    if (is_dir($dir . '/' . $file)) {
139
-                        delTree($dir . '/' . $file);
138
+                    if (is_dir($dir.'/'.$file)) {
139
+                        delTree($dir.'/'.$file);
140 140
                     } else {
141 141
                         try {
142
-                            unlink($dir . '/' . $file);
142
+                            unlink($dir.'/'.$file);
143 143
                         } catch (Exception $e) {
144 144
                             // do nothing... php will ignore and continue
145 145
                         }
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
             return false;
154 154
         }
155 155
 
156
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
156
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
157 157
             // Set the permissions on the install directory and delete
158 158
             // is server Windows or Linux?
159 159
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
160
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
160
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
161 161
             }
162
-            delTree($SETTINGS['cpassman_dir'] . '/install');
162
+            delTree($SETTINGS['cpassman_dir'].'/install');
163 163
         }
164 164
 
165 165
         // Delete temporary install table
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 // Load Languages stuff
178 178
 if (isset($languagesList) === false) {
179 179
     $languagesList = [];
180
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
180
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
181 181
     foreach ($rows as $record) {
182 182
         array_push($languagesList, $record['name']);
183
-        if ($session->get('user-language') === $record['name'] ) {
183
+        if ($session->get('user-language') === $record['name']) {
184 184
             $session->set('user-language_flag', $record['flag']);
185 185
             $session->set('user-language_code', $record['code']);
186 186
             //$session->set('user-language_label', $record['label']);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
238 238
 if (empty($session->get('user-session_duration')) === false) {
239 239
     $dataSession = DB::queryFirstRow(
240
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
240
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
241 241
         $session->get('user-id')
242 242
     );
243 243
 } else {
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     && ($session->has('user-admin') && $session->get('user-admin') && null !== $session->get('user-admin') && $session->get('user-admin') === 1)
293 293
 ) {
294 294
     $row = DB::queryFirstRow(
295
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
295
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
296 296
         [
297 297
             'type' => 'admin',
298 298
             'intitule' => 'teampass_version',
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 
334 334
         syslog(
335 335
             LOG_WARNING,
336
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
336
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
337 337
         );
338 338
         // erase session table
339 339
         $session->invalidate();
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 if ($session->has('user-timezone') && null !== $session->get('user-id') && empty($session->get('user-id')) === false) {
390 390
     // query on user
391 391
     $data = DB::queryfirstrow(
392
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM ' . prefixTable('users') . ' WHERE id=%i',
392
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion, roles_from_ad_groups, auth_type, last_pw_change FROM '.prefixTable('users').' WHERE id=%i',
393 393
         $session->get('user-id')
394 394
     );
395 395
     //Check if user has been deleted or unlogged
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
             $data['groupes_visibles'],
437 437
             $data['groupes_interdits'],
438 438
             $data['admin'],
439
-            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'] . ';' . $data['roles_from_ad_groups']),
439
+            is_null($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : (empty($data['roles_from_ad_groups']) === true ? $data['fonction_id'] : $data['fonction_id'].';'.$data['roles_from_ad_groups']),
440 440
             $SETTINGS
441 441
         );
442 442
         if ($session->has('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') && null !== $session->get('user-can_create_root_folder') && (int) $session->get('user-can_create_root_folder') === 1) {
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $session->set('system-item_fields', []);
472 472
     $rows = DB::query(
473 473
         'SELECT *
474
-            FROM ' . prefixTable('categories') . '
474
+            FROM ' . prefixTable('categories').'
475 475
             WHERE level=%i',
476 476
         '0'
477 477
     );
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
         // get each field
481 481
         $rows2 = DB::query(
482 482
             'SELECT *
483
-            FROM ' . prefixTable('categories') . '
483
+            FROM ' . prefixTable('categories').'
484 484
             WHERE parent_id=%i
485 485
             ORDER BY `order` ASC',
486 486
             $record['id']
@@ -567,5 +567,5 @@  discard block
 block discarded – undo
567 567
 }
568 568
 
569 569
 /* CHECK NUMBER OF USER ONLINE */
570
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
570
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
571 571
 $session->set('system-nb_users_online', DB::count());
Please login to merge, or discard this patch.
scripts/background_tasks___user_task.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     // launched several times.
70 70
     $record = DB::queryFirstRow(
71 71
         'SELECT *
72
-        FROM ' . prefixTable('background_tasks') . '
72
+        FROM ' . prefixTable('background_tasks').'
73 73
         WHERE is_in_progress = %i AND process_type = %s
74 74
         ORDER BY increment_id ASC LIMIT 1',
75 75
         0,
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -77,8 +77,9 @@
 block discarded – undo
77 77
     );
78 78
 
79 79
     // No more pending user_build_cache_tree tasks
80
-    if (DB::count() === 0)
81
-        exit;
80
+    if (DB::count() === 0) {
81
+            exit;
82
+    }
82 83
 
83 84
     // get email properties
84 85
     $arguments = json_decode($record['arguments'], true);
Please login to merge, or discard this patch.
sources/folders.class.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 
85 85
         $parentComplexity = $this->checkComplexityLevel($parentFolderData, $complexity, $parent_id);
86 86
         if (isset($parentComplexity ['error']) && $parentComplexity['error'] === true) {
87
-            return $this->errorResponse($this->lang->get('error_folder_complexity_lower_than_top_folder') . " [<b>{$this->settings['TP_PW_COMPLEXITY'][$parentComplexity['valeur']][1]}</b>]");
87
+            return $this->errorResponse($this->lang->get('error_folder_complexity_lower_than_top_folder')." [<b>{$this->settings['TP_PW_COMPLEXITY'][$parentComplexity['valeur']][1]}</b>]");
88 88
         }
89 89
 
90 90
         return $this->createFolder($params, array_merge($parentFolderData, $parentComplexity));
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
         ) {
134 134
             DB::query(
135 135
                 'SELECT *
136
-                FROM ' . prefixTable('nested_tree') . '
136
+                FROM ' . prefixTable('nested_tree').'
137 137
                 WHERE title = %s AND personal_folder = 0',
138 138
                 $title
139 139
             );
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         //check if parent folder is personal
158 158
         $data = DB::queryfirstrow(
159 159
             'SELECT personal_folder, bloquer_creation, bloquer_modification
160
-            FROM ' . prefixTable('nested_tree') . '
160
+            FROM ' . prefixTable('nested_tree').'
161 161
             WHERE id = %i',
162 162
             $parent_id
163 163
         );
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             // get complexity level for this folder
197 197
             $data = DB::queryfirstrow(
198 198
                 'SELECT valeur
199
-                FROM ' . prefixTable('misc') . '
199
+                FROM ' . prefixTable('misc').'
200 200
                 WHERE intitule = %i AND type = %s',
201 201
                 $parent_id,
202 202
                 'complex'
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
      */
248 248
     private function canCreateFolder($isPersonal, $user_is_admin, $user_is_manager, $user_can_manage_all_users, $user_can_create_root_folder)
249 249
     {
250
-        return (int)$isPersonal === 1 ||
251
-            (int)$user_is_admin === 1 ||
252
-            ((int)$user_is_manager === 1 || (int)$user_can_manage_all_users === 1) ||
250
+        return (int) $isPersonal === 1 ||
251
+            (int) $user_is_admin === 1 ||
252
+            ((int) $user_is_manager === 1 || (int) $user_can_manage_all_users === 1) ||
253 253
             ($this->settings['enable_user_can_create_folders'] ?? false) ||
254
-            ((int)$user_can_create_root_folder === 1);
254
+            ((int) $user_can_create_root_folder === 1);
255 255
     }
256 256
 
257 257
     /**
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $path = '';
332 332
         $tree_path = $tree->getPath(0, false);
333 333
         foreach ($tree_path as $fld) {
334
-            $path .= empty($path) ? $fld->title : '/' . $fld->title;
334
+            $path .= empty($path) ? $fld->title : '/'.$fld->title;
335 335
         }
336 336
 
337 337
         $new_json = [
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             "is_visible_active" => 0,
346 346
         ];
347 347
 
348
-        $cache_tree = DB::queryFirstRow('SELECT increment_id, folders, visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', (int)$user_id);
348
+        $cache_tree = DB::queryFirstRow('SELECT increment_id, folders, visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', (int) $user_id);
349 349
 
350 350
         if (empty($cache_tree)) {
351 351
             DB::insert(prefixTable('cache_tree'), [
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
                 'folders' => json_encode($folders),
366 366
                 'visible_folders' => json_encode($visible_folders),
367 367
                 'timestamp' => time(),
368
-            ], 'increment_id = %i', (int)$cache_tree['increment_id']);
368
+            ], 'increment_id = %i', (int) $cache_tree['increment_id']);
369 369
         }
370 370
     }
371 371
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
     private function manageFolderPermissions($parent_id, $newId, $user_roles, $access_rights, $user_is_admin)
376 376
     {
377 377
         if ($this->settings['subfolder_rights_as_parent'] ?? false) {
378
-            $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $parent_id);
378
+            $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $parent_id);
379 379
             foreach ($rows as $record) {
380 380
                 DB::insert(prefixTable('roles_values'), [
381 381
                     'role_id' => $record['role_id'],
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
                     'type' => $record['type'],
384 384
                 ]);
385 385
             }
386
-        } elseif ((int)$user_is_admin !== 1) {
386
+        } elseif ((int) $user_is_admin !== 1) {
387 387
             foreach (array_unique(explode(';', $user_roles)) as $role) {
388 388
                 if (!empty($role)) {
389 389
                     DB::insert(prefixTable('roles_values'), [
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
      */
402 402
     private function copyCustomFieldsCategories($parent_id, $newId)
403 403
     {
404
-        $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $parent_id);
404
+        $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $parent_id);
405 405
         foreach ($rows as $record) {
406 406
             DB::insert(prefixTable('categories_folders'), [
407 407
                 'id_category' => $record['id_category'],
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             // Search for existing job
427 427
             $count = DB::queryFirstRow(
428 428
                 'SELECT COUNT(*) AS count
429
-                FROM ' . prefixTable('background_tasks') . '
429
+                FROM ' . prefixTable('background_tasks').'
430 430
                 WHERE is_in_progress = %i AND process_type = %s AND arguments = %s',
431 431
                 0,
432 432
                 'user_build_cache_tree',
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
         return [
461 461
             'error' => true,
462 462
             'message' => $message,
463
-            'newId' => '' . $newIdSuffix,
463
+            'newId' => ''.$newIdSuffix,
464 464
         ];
465 465
     }
466 466
 }
467 467
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -434,8 +434,9 @@
 block discarded – undo
434 434
             )['count'];
435 435
 
436 436
             // Don't insert duplicates
437
-            if ($count > 0)
438
-                continue;
437
+            if ($count > 0) {
438
+                            continue;
439
+            }
439 440
 
440 441
             // Insert new background task
441 442
             DB::insert(
Please login to merge, or discard this patch.
pages/oauth.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('oauth') === false) {
72 72
     // Not allowed page
73 73
     $session->set('system-error_code', ERR_NOT_ALLOWED);
74
-    include $SETTINGS['cpassman_dir'] . '/error.php';
74
+    include $SETTINGS['cpassman_dir'].'/error.php';
75 75
     exit;
76 76
 }
77 77
 ?>
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             }).fail(function(error) {
216 216
                 toastr.remove();
217 217
                 toastr.error(
218
-                    '<?php echo $lang->get('server_answer_error') . '<br />' . $lang->get('server_returned_data') . ':<br />'; ?>' + error,
218
+                    '<?php echo $lang->get('server_answer_error').'<br />'.$lang->get('server_returned_data').':<br />'; ?>' + error,
219 219
                     '', {
220 220
                         closeButton: true,
221 221
                         positionClass: 'toast-bottom-right'
Please login to merge, or discard this patch.