Passed
Push — master ( 5543cb...883394 )
by Nils
06:48
created
pages/options.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('options') === false) {
66 66
     // Not allowed page
67 67
     $superGlobal->put('code', ERR_NOT_ALLOWED, 'SESSION', 'error');
68
-    include $SETTINGS['cpassman_dir'] . '/error.php';
68
+    include $SETTINGS['cpassman_dir'].'/error.php';
69 69
     exit;
70 70
 }
71 71
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
                                     // get list of all timezones
298 298
                                     foreach ($zones as $key => $zone) {
299 299
                                         echo '
300
-                                <option value="' . $key . '"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>' . $zone . '</option>';
300
+                                <option value="' . $key.'"', isset($SETTINGS['timezone']) === true && $SETTINGS['timezone'] === $key ? ' selected' : '', '>'.$zone.'</option>';
301 301
                                     }
302 302
                                     ?>
303 303
                                 </select>
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
                                     <?php
349 349
                                     foreach ($languagesList as $teampassLang) {
350 350
                                         echo '
351
-                                <option value="' . $teampassLang . '"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>' . $teampassLang . '</option>';
351
+                                <option value="' . $teampassLang.'"', isset($SETTINGS['default_language']) === true && $SETTINGS['default_language'] === $teampassLang ? ' selected' : '', '>'.$teampassLang.'</option>';
352 352
                                     }
353 353
                                     ?>
354 354
                                 </select>
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
                                 <?php
446 446
                                 foreach (TP_PW_COMPLEXITY as $complex) {
447 447
                                     echo '
448
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
448
+                                <option value="' . $complex[0].'"', isset($SETTINGS['personal_saltkey_security_level']) === true && $SETTINGS['personal_saltkey_security_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
449 449
                                 }
450 450
                                 ?>
451 451
                             </select>
@@ -781,7 +781,7 @@  discard block
 block discarded – undo
781 781
                                         );
782 782
                                         foreach ($roles as $role) {
783 783
                                             echo '
784
-                                    <option value="' . $role['id'] . '"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>' . addslashes($role['title']) . '</option>';
784
+                                    <option value="' . $role['id'].'"', in_array($role['id'], $arrRolesToPrint) === true ? ' selected' : '', '>'.addslashes($role['title']).'</option>';
785 785
                                         }
786 786
                                     }
787 787
                                     ?>
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
                                     <?php
959 959
                                     foreach (TP_PW_COMPLEXITY as $complex) {
960 960
                                         echo '
961
-                                <option value="' . $complex[0] . '"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>' . $complex[1] . '</option>';
961
+                                <option value="' . $complex[0].'"', isset($SETTINGS['offline_key_level']) === true && $SETTINGS['offline_key_level'] === $complex[0] ? ' selected' : '', '>'.$complex[1].'</option>';
962 962
                                     }
963 963
                                     ?>
964 964
                                 </select>
Please login to merge, or discard this patch.
scripts/task_maintenance_purge_old_files.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 function purgeTemporaryFiles(): void
75 75
 {
76 76
     // Load expected files
77
-    require_once __DIR__. '/../sources/main.functions.php';
78
-    require __DIR__. '/../includes/config/tp.config.php';
77
+    require_once __DIR__.'/../sources/main.functions.php';
78
+    require __DIR__.'/../includes/config/tp.config.php';
79 79
 
80 80
     if (isset($SETTINGS) === true) {
81 81
         //read folder
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
                 //delete file FILES
86 86
                 while (false !== ($f = readdir($dir))) {
87 87
                     if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
88
-                        if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
89
-                            fileDelete($dir . '/' . $f, $SETTINGS);
88
+                        if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
89
+                            fileDelete($dir.'/'.$f, $SETTINGS);
90 90
                         }
91 91
                     }
92 92
                 }
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
                 while (false !== ($f = readdir($dir))) {
106 106
                     if ($f !== '.' && $f !== '..') {
107 107
                         if (strpos($f, '_delete.') > 0) {
108
-                            fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
108
+                            fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
109 109
                         }
110 110
                     }
111 111
                 }
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   +12 added lines, -12 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 : '',
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 'password' => 'trim|escape',
58 58
                 'apikey' => 'trim|escape',
59 59
             ],
60
-            API_ROOT_PATH . '/..'
60
+            API_ROOT_PATH.'/..'
61 61
         );
62 62
         if (empty($inputData['login']) === true || empty($inputData['apikey']) === true) {
63 63
             return ["error" => "Login failed0.", "info" => "Empty entry"];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         // Check apikey
67 67
         if (empty($inputData['password']) === true) {
68 68
             // case where it is a generic key
69
-            $apiInfo = $this->select("SELECT count(*) FROM " . prefixTable('api') . " WHERE value='".$inputData['apikey']."' AND label='".$inputData['login']."'");
69
+            $apiInfo = $this->select("SELECT count(*) FROM ".prefixTable('api')." WHERE value='".$inputData['apikey']."' AND label='".$inputData['login']."'");
70 70
             if ((int) $apiInfo[0]['count(*)'] === 0) {
71 71
                 return ["error" => "Login failed1.", "info" => "apikey : Not valid"];
72 72
             }
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
             // Check if user exists
78 78
             $userInfoRes = $this->select(
79 79
                 "SELECT u.id, u.pw, u.public_key, u.private_key, u.personal_folder, u.fonction_id, u.groupes_visibles, u.groupes_interdits, a.value AS user_api_key
80
-                FROM " . prefixTable('users') . " AS u
81
-                INNER JOIN " . prefixTable('api') . " AS a ON (a.user_id=u.id)
80
+                FROM " . prefixTable('users')." AS u
81
+                INNER JOIN " . prefixTable('api')." AS a ON (a.user_id=u.id)
82 82
                 WHERE login='".$inputData['login']."'");
83 83
             if (count($userInfoRes) === 0) {
84 84
                 return ["error" => "Login failed3.", "info" => "apikey : Not valid"];
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
      */
132 132
     private function createUserJWT(int $id, string $login, int $pf_enabled, string $pubkey, string $privkey, string $folders, string $items): array
133 133
     {
134
-        include API_ROOT_PATH . '/../includes/config/tp.config.php';
134
+        include API_ROOT_PATH.'/../includes/config/tp.config.php';
135 135
         
136 136
 		$payload = [
137 137
             'username' => $login,
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 
176 176
         // Get folders from the roles
177 177
         if (empty($userFunctionId) === false) {
178
-            $rows = $this->select("SELECT * FROM " . prefixTable('roles_values') . " WHERE role_id IN (".$userFunctionId.") AND type IN ('W', 'ND', 'NE', 'NDNE', 'R')");
178
+            $rows = $this->select("SELECT * FROM ".prefixTable('roles_values')." WHERE role_id IN (".$userFunctionId.") AND type IN ('W', 'ND', 'NE', 'NDNE', 'R')");
179 179
             foreach ($rows as $record) {
180 180
                 if ($record['type'] === 'R') {
181 181
                     array_push($readOnlyFolders, $record['folder_id']);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         
197 197
         // Does this user is allowed to see other items
198 198
         $inc = 0;
199
-        $rows = $this->select("SELECT id, id_tree FROM " . prefixTable('items') . " WHERE restricted_to LIKE '".$userInfo['id']."'".
199
+        $rows = $this->select("SELECT id, id_tree FROM ".prefixTable('items')." WHERE restricted_to LIKE '".$userInfo['id']."'".
200 200
             (empty($userFunctionId) === false ? ' AND id_tree NOT IN ('.$userFunctionId.')' : ''));
201 201
         foreach ($rows as $record) {
202 202
             // Exclude restriction on item if folder is fully accessible
@@ -206,8 +206,8 @@  discard block
 block discarded – undo
206 206
 
207 207
         // Check for the users roles if some specific rights exist on items
208 208
         $rows = $this->select("SELECT i.id_tree, r.item_id
209
-            FROM " . prefixTable('items') . " as i
210
-            INNER JOIN " . prefixTable('restriction_to_roles') . " as r ON (r.item_id=i.id)
209
+            FROM " . prefixTable('items')." as i
210
+            INNER JOIN " . prefixTable('restriction_to_roles')." as r ON (r.item_id=i.id)
211 211
             WHERE ".(empty($userFunctionId) === false ? ' id_tree NOT IN ('.$userFunctionId.') AND ' : '')." i.id_tree != ''
212 212
             ORDER BY i.id_tree ASC");
213 213
         foreach ($rows as $record) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
         // Add all personal folders
222 222
         $rows = $this->select(
223 223
             'SELECT id
224
-            FROM ' . prefixTable('nested_tree') . '
224
+            FROM ' . prefixTable('nested_tree').'
225 225
             WHERE title = '.$userInfo['id'].' AND personal_folder = 1'.
226 226
             (empty($userFunctionId) === false ? ' AND id NOT IN ('.$userFunctionId.')' : '').
227 227
             ' LIMIT 0,1'
Please login to merge, or discard this patch.