Passed
Push — teampass_3.0 ( 2c08f5...ae6be7 )
by Nils
04:47
created
pages/roles.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'roles', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49
-    include $SETTINGS['cpassman_dir'] . '/error.php';
49
+    include $SETTINGS['cpassman_dir'].'/error.php';
50 50
     exit;
51 51
 }
52 52
 
53 53
 // Load template
54
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
54
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
55 55
 
56 56
 ?>
57 57
 
@@ -94,17 +94,17 @@  discard block
 block discarded – undo
94 94
                                 $arrUserRoles = array_filter($_SESSION['user_roles']);
95 95
                                 $where = '';
96 96
                                 if (count($arrUserRoles) > 0 && (int) $_SESSION['is_admin'] !== 1) {
97
-                                    $where = ' WHERE id IN (' . implode(',', $arrUserRoles) . ')';
97
+                                    $where = ' WHERE id IN ('.implode(',', $arrUserRoles).')';
98 98
                                 }
99
-                                $rows = DB::query('SELECT * FROM ' . prefixTable('roles_title') . $where);
99
+                                $rows = DB::query('SELECT * FROM '.prefixTable('roles_title').$where);
100 100
                                 foreach ($rows as $reccord) {
101 101
                                     echo '
102
-                                    <option value="' . $reccord['id'] . '"
103
-                                        data-complexity-text="' . addslashes(TP_PW_COMPLEXITY[$reccord['complexity']][1]) . '"
104
-                                        data-complexity-icon="' . TP_PW_COMPLEXITY[$reccord['complexity']][2] . '"
105
-                                        data-complexity="' . TP_PW_COMPLEXITY[$reccord['complexity']][0] . '"
106
-                                        data-allow-edit-all="' . $reccord['allow_pw_change'] . '">'.
107
-                                        $reccord['title'] . '</option>';
102
+                                    <option value="' . $reccord['id'].'"
103
+                                        data-complexity-text="' . addslashes(TP_PW_COMPLEXITY[$reccord['complexity']][1]).'"
104
+                                        data-complexity-icon="' . TP_PW_COMPLEXITY[$reccord['complexity']][2].'"
105
+                                        data-complexity="' . TP_PW_COMPLEXITY[$reccord['complexity']][0].'"
106
+                                        data-allow-edit-all="' . $reccord['allow_pw_change'].'">'.
107
+                                        $reccord['title'].'</option>';
108 108
                                 }
109 109
                                 ?>
110 110
                             </select>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
                                         <?php
126 126
                                         foreach (TP_PW_COMPLEXITY as $entry) {
127 127
                                             echo '
128
-                                        <option value="' . $entry[0] . '">' . addslashes($entry[1]) . '</option>';
128
+                                        <option value="' . $entry[0].'">'.addslashes($entry[1]).'</option>';
129 129
                                         }
130 130
                                         ?>
131 131
                                     </select>
Please login to merge, or discard this patch.
pages/2fa.js.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,11 +43,11 @@
 block discarded – undo
43 43
 }
44 44
 echo "ici";
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], '2fa', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49 49
     //not allowed page
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 ?>
Please login to merge, or discard this patch.
pages/2fa.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], '2fa', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49
-    include $SETTINGS['cpassman_dir'] . '/error.php';
49
+    include $SETTINGS['cpassman_dir'].'/error.php';
50 50
     exit;
51 51
 }
52 52
 
53 53
 // Load template
54
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
54
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
55 55
 
56 56
 ?>
57 57
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                                     );
116 116
                                     foreach ($roles as $role) {
117 117
                                         echo '
118
-                                    <option value="' . $role['id'] . '"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>' . addslashes($role['title']) . '</option>';
118
+                                    <option value="' . $role['id'].'"', in_array($role['id'], $arrRolesMFA) === true ? ' selected' : '', '>'.addslashes($role['title']).'</option>';
119 119
                                     }
120 120
                                     ?>
121 121
                                 </select>
Please login to merge, or discard this patch.
pages/actions.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 /* do checks */
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'ldap', $SETTINGS) === false) {
48 48
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
49
-    include $SETTINGS['cpassman_dir'] . '/error.php';
49
+    include $SETTINGS['cpassman_dir'].'/error.php';
50 50
     exit;
51 51
 }
52 52
 
53 53
 // Load template
54
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
54
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
55 55
 
56 56
 ?>
57 57
 
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
                                 <?php
91 91
                                 echo langHdl('rebuild_config_file');
92 92
 $data = DB::queryfirstrow(
93
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
93
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
94 94
                                     WHERE label = %s
95 95
                                     ORDER BY id DESC',
96 96
     'admin_action_rebuild_config_file'
97 97
 );
98 98
 if (DB::count() > 0) {
99
-    $tmp = langHdl('last_execution') . ' ' .
100
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
99
+    $tmp = langHdl('last_execution').' '.
100
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
101 101
     $tmp .= $data['field_1'] === 'success' ?
102 102
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
103 103
 } else {
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
                                 </span>
120 120
                                 <?php echo langHdl('admin_action_check_pf');
121 121
 $data = DB::queryfirstrow(
122
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
122
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
123 123
                                     WHERE label = %s
124 124
                                     ORDER BY id DESC',
125 125
     'admin_action_check_pf'
126 126
 );
127 127
 if (DB::count() > 0) {
128
-    $tmp = langHdl('last_execution') . ' ' .
129
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
128
+    $tmp = langHdl('last_execution').' '.
129
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
130 130
     $tmp .= $data['field_1'] === 'success' ?
131 131
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
132 132
 } else {
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
                                 </span>
147 147
                                 <?php echo langHdl('admin_action_db_clean_items');
148 148
 $data = DB::queryfirstrow(
149
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
149
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
150 150
                                     WHERE label = %s
151 151
                                     ORDER BY id DESC',
152 152
     'admin_action_db_clean_items'
153 153
 );
154 154
 if (DB::count() > 0) {
155
-    $tmp = langHdl('last_execution') . ' ' .
156
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
155
+    $tmp = langHdl('last_execution').' '.
156
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
157 157
     $tmp .= $data['field_1'] === 'success' ?
158 158
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
159 159
 } else {
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
                                 </span>
176 176
                                 <?php echo langHdl('admin_action_db_optimize');
177 177
 $data = DB::queryfirstrow(
178
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
178
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
179 179
                                     WHERE label = %s
180 180
                                     ORDER BY id DESC',
181 181
     'admin_action_db_optimize'
182 182
 );
183 183
 if (DB::count() > 0) {
184
-    $tmp = langHdl('last_execution') . ' ' .
185
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
184
+    $tmp = langHdl('last_execution').' '.
185
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
186 186
     $tmp .= $data['field_1'] === 'success' ?
187 187
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
188 188
 } else {
@@ -201,14 +201,14 @@  discard block
 block discarded – undo
201 201
                                 </span>
202 202
                                 <?php echo langHdl('admin_action_purge_old_files');
203 203
 $data = DB::queryfirstrow(
204
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
204
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
205 205
                                     WHERE label = %s
206 206
                                     ORDER BY id DESC',
207 207
     'admin_action_purge_old_files'
208 208
 );
209 209
 if (DB::count() > 0) {
210
-    $tmp = langHdl('last_execution') . ' ' .
211
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
210
+    $tmp = langHdl('last_execution').' '.
211
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
212 212
     $tmp .= $data['field_1'] === 'success' ?
213 213
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
214 214
 } else {
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
                                 </span>
231 231
                                 <?php echo langHdl('admin_action_reload_cache_table');
232 232
 $data = DB::queryfirstrow(
233
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
233
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
234 234
                                     WHERE label = %s
235 235
                                     ORDER BY id DESC',
236 236
     'admin_action_reload_cache_table'
237 237
 );
238 238
 if (DB::count() > 0) {
239
-    $tmp = langHdl('last_execution') . ' ' .
240
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
239
+    $tmp = langHdl('last_execution').' '.
240
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
241 241
     $tmp .= $data['field_1'] === 'success' ?
242 242
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
243 243
 } else {
@@ -260,14 +260,14 @@  discard block
 block discarded – undo
260 260
                                 </span>
261 261
                                 <?php echo langHdl('admin_action_change_salt_key');
262 262
 $data = DB::queryfirstrow(
263
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
263
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
264 264
                                     WHERE label = %s
265 265
                                     ORDER BY id DESC',
266 266
     'admin_action_change_sk'
267 267
 );
268 268
 if (DB::count() > 0) {
269
-    $tmp = langHdl('last_execution') . ' ' .
270
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
269
+    $tmp = langHdl('last_execution').' '.
270
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
271 271
     $tmp .= $data['field_1'] === 'success' ?
272 272
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
273 273
 } else {
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
                                 </span>
291 291
                                 <?php echo langHdl('admin_action_attachments_cryption');
292 292
 $data = DB::queryfirstrow(
293
-    'SELECT field_1, date FROM ' . prefixTable('log_system') . '
293
+    'SELECT field_1, date FROM '.prefixTable('log_system').'
294 294
                                     WHERE label = %s
295 295
                                     ORDER BY id DESC',
296 296
     'admin_action_change_file_encryption'
297 297
 );
298 298
 if (DB::count() > 0) {
299
-    $tmp = langHdl('last_execution') . ' ' .
300
-                                        date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']);
299
+    $tmp = langHdl('last_execution').' '.
300
+                                        date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']);
301 301
     $tmp .= $data['field_1'] === 'success' ?
302 302
                                         '<i class="fas fa-check ml-2 text-success"></i>' : '<i class="fas fa-times ml-2 text-danger"></i>';
303 303
 } else {
Please login to merge, or discard this patch.
sources/expired.datatables.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 require_once 'SecureHandler.php';
29 29
 session_name('teampass_session');
30 30
 session_start();
31
-if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) {
31
+if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) {
32 32
     die('Hacking attempt...');
33 33
 }
34 34
 
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
 }
43 43
 
44 44
 // Do checks
45
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
46
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
45
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
46
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
47 47
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'folders', $SETTINGS) === false) {
48 48
     // Not allowed page
49 49
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
50
-    include $SETTINGS['cpassman_dir'] . '/error.php';
50
+    include $SETTINGS['cpassman_dir'].'/error.php';
51 51
     exit;
52 52
 }
53 53
 
54
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
55
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
54
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
55
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
56 56
 header('Content-type: text/html; charset=utf-8');
57 57
 header('Cache-Control: no-cache, must-revalidate');
58 58
 require_once 'main.functions.php';
59 59
 // Connect to mysql server
60
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
60
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
61 61
 if (defined('DB_PASSWD_CLEAR') === false) {
62 62
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
63 63
 }
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 DB::$port = DB_PORT;
69 69
 DB::$encoding = DB_ENCODING;
70 70
 // Class loader
71
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
71
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
72 72
 //Build tree
73
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
73
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
74 74
 $tree->register();
75 75
 $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title');
76 76
 //Columns name
@@ -81,22 +81,22 @@  discard block
 block discarded – undo
81 81
 $sOrder = $sLimit = '';
82 82
 // Is a date sent?
83 83
 if (isset($_GET['dateCriteria']) === true && empty($_GET['dateCriteria']) === false) {
84
-    $sWhere .= ' AND a.del_value < ' . round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
84
+    $sWhere .= ' AND a.del_value < '.round(filter_var($_GET['dateCriteria'], FILTER_SANITIZE_NUMBER_INT) / 1000, 0);
85 85
 }
86 86
 //echo $sWhere;
87 87
 /* BUILD QUERY */
88 88
 //Paging
89 89
 $sLimit = '';
90 90
 if (isset($_GET['length']) === true && (int) $_GET['length'] !== -1) {
91
-    $sLimit = ' LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . '';
91
+    $sLimit = ' LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).'';
92 92
 }
93 93
 
94 94
 //Ordering
95 95
 if (isset($_GET['order'][0]['dir']) && in_array($_GET['order'][0]['dir'], $aSortTypes)) {
96 96
     $sOrder = 'ORDER BY  ';
97 97
     if (preg_match('#^(asc|desc)$#i', $_GET['order'][0]['column'])) {
98
-        $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' '
99
-            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING) . ', ';
98
+        $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' '
99
+            . filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_STRING).', ';
100 100
     }
101 101
 
102 102
     $sOrder = substr_replace($sOrder, '', -2);
@@ -117,29 +117,29 @@  discard block
 block discarded – undo
117 117
     && $_GET['letter'] !== 'None'
118 118
 ) {
119 119
     $sWhere .= ' AND ';
120
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
121
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' OR ";
122
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['letter'], FILTER_SANITIZE_STRING) . "%' ";
120
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
121
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' OR ";
122
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['letter'], FILTER_SANITIZE_STRING)."%' ";
123 123
 } elseif (isset($_GET['search']['value']) === true && $_GET['search']['value'] !== '') {
124 124
     $sWhere = ' AND ';
125
-    $sWhere .= $aColumns[1] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
126
-    $sWhere .= $aColumns[2] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' OR ";
127
-    $sWhere .= $aColumns[3] . " LIKE '" . filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING) . "%' ";
125
+    $sWhere .= $aColumns[1]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
126
+    $sWhere .= $aColumns[2]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' OR ";
127
+    $sWhere .= $aColumns[3]." LIKE '".filter_var($_GET['search']['value'], FILTER_SANITIZE_STRING)."%' ";
128 128
 }
129 129
 
130 130
 $rows = DB::query(
131 131
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
132
-    FROM ' . prefixTable('automatic_del') . ' AS a
133
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
132
+    FROM ' . prefixTable('automatic_del').' AS a
133
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
134 134
     $sWhere.
135 135
     (string) $sOrder
136 136
 );
137 137
 $iTotal = DB::count();
138 138
 $rows = DB::query(
139 139
     'SELECT a.item_id, i.label, a.del_value, i.id_tree
140
-    FROM ' . prefixTable('automatic_del') . ' AS a
141
-    INNER JOIN ' . prefixTable('items') . ' AS i ON (i.id = a.item_id)' .
142
-        $sWhere .
140
+    FROM ' . prefixTable('automatic_del').' AS a
141
+    INNER JOIN ' . prefixTable('items').' AS i ON (i.id = a.item_id)'.
142
+        $sWhere.
143 143
         $sLimit
144 144
 );
145 145
 $iFilteredTotal = DB::count();
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
     // start the line
158 158
     $sOutput .= '[';
159 159
     // Column 1
160
-    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"' . $record['item_id'] . '\"  data-item-tree-id=\"' . $record['id_tree'] . '\"></i>", ';
160
+    $sOutput .= '"<i class=\"fas fa-external-link-alt pointer text-primary mr-2\" onclick=\"showItemCard($(this))\" data-item-id=\"'.$record['item_id'].'\"  data-item-tree-id=\"'.$record['id_tree'].'\"></i>", ';
161 161
     // Column 2
162
-    $sOutput .= '"' . $record['label'] . '", ';
162
+    $sOutput .= '"'.$record['label'].'", ';
163 163
     // Column 3
164
-    $sOutput .= '"' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['del_value']) . '", ';
164
+    $sOutput .= '"'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['del_value']).'", ';
165 165
     // Column 4
166 166
     $path = [];
167 167
     $treeDesc = $tree->getPath($record['id_tree'], true);
168 168
     foreach ($treeDesc as $t) {
169 169
         array_push($path, $t->title);
170 170
     }
171
-    $sOutput .= '"' . implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path) . '"],';
171
+    $sOutput .= '"'.implode('<i class=\"fas fa-angle-right ml-1 mr-1\"></i>', $path).'"],';
172 172
 }
173 173
 
174 174
 if ($iTotal > 0) {
@@ -181,4 +181,4 @@  discard block
 block discarded – undo
181 181
 }
182 182
 
183 183
 // finalize output
184
-echo '{"recordsTotal": ' . $iTotal . ', "recordsFiltered": ' . $iFilteredTotal . ', "data": ' . $sOutput;
184
+echo '{"recordsTotal": '.$iTotal.', "recordsFiltered": '.$iFilteredTotal.', "data": '.$sOutput;
Please login to merge, or discard this patch.
sources/utilities.queries.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 }
38 38
 
39 39
 // Do checks
40
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
41
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
40
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
41
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
42 42
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'utilities.database', $SETTINGS) === false) {
43 43
     // Not allowed page
44 44
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
45
-    include $SETTINGS['cpassman_dir'] . '/error.php';
45
+    include $SETTINGS['cpassman_dir'].'/error.php';
46 46
     exit();
47 47
 }
48 48
 
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
     date_default_timezone_set('UTC');
56 56
 }
57 57
 
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
60 60
 header('Content-type: text/html; charset=utf-8');
61 61
 header('Cache-Control: no-cache, must-revalidate');
62 62
 require_once 'main.functions.php';
63 63
 
64 64
 //Connect to DB
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
66 66
 if (defined('DB_PASSWD_CLEAR') === false) {
67 67
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
68 68
 }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             $arrFolders = array();
103 103
             $rows = DB::query(
104 104
                 'SELECT valeur, intitule
105
-                FROM ' . prefixTable('misc') . '
105
+                FROM ' . prefixTable('misc').'
106 106
                 WHERE type  = %s',
107 107
                 'folder_deleted'
108 108
             );
@@ -123,10 +123,10 @@  discard block
 block discarded – undo
123 123
                 'SELECT u.login as login, u.name as name, u.lastname as lastname,
124 124
                 i.id as id, i.label as label,
125 125
                 i.id_tree as id_tree, l.date as date, n.title as folder_title
126
-                FROM ' . prefixTable('log_items') . ' as l
127
-                INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id)
128
-                INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id)
129
-                INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree=n.id)
126
+                FROM ' . prefixTable('log_items').' as l
127
+                INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id)
128
+                INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id)
129
+                INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree=n.id)
130 130
                 WHERE i.inactif = %i
131 131
                 AND l.action = %s',
132 132
                 1,
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
                             'label' => $record['label'],
149 149
                             'date' => date($SETTINGS['date_format'], (int) $record['date']),
150 150
                             'login' => $record['login'],
151
-                            'name' => $record['name'] . ' ' . $record['lastname'],
151
+                            'name' => $record['name'].' '.$record['lastname'],
152 152
                             'folder_label' => $record['folder_title'],
153 153
                             'folder_deleted' => $thisFolder,
154 154
                         )
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
             foreach ($post_folders as $folderId) {
204 204
                 $data = DB::queryfirstrow(
205 205
                     'SELECT valeur
206
-                    FROM ' . prefixTable('misc') . "
206
+                    FROM ' . prefixTable('misc')."
207 207
                     WHERE type = 'folder_deleted'
208 208
                     AND intitule = %s",
209
-                    'f' . $folderId
209
+                    'f'.$folderId
210 210
                 );
211 211
                 if ((int) $data['valeur'] !== 0) {
212 212
                     $folderData = explode(', ', $data['valeur']);
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                         prefixTable('misc'),
233 233
                         'type = %s AND intitule = %s',
234 234
                         'folder_deleted',
235
-                        'f' . $folderId
235
+                        'f'.$folderId
236 236
                     );
237 237
 
238 238
                     // Restore all items in this folder
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
                     // Get list of all items in thos folder
249 249
                     $items = DB::query(
250 250
                         'SELECT id
251
-                        FROM ' . prefixTable('items') . '
251
+                        FROM ' . prefixTable('items').'
252 252
                         WHERE id_tree = %i',
253 253
                         $folderId
254 254
                     );
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
             foreach ($post_folders as $folderId) {
334 334
                 $data = DB::queryfirstrow(
335 335
                     'SELECT valeur
336
-                    FROM ' . prefixTable('misc') . "
336
+                    FROM ' . prefixTable('misc')."
337 337
                     WHERE type = 'folder_deleted'
338 338
                     AND intitule = %s",
339
-                    'f' . $folderId
339
+                    'f'.$folderId
340 340
                 );
341 341
                 if ((int) $data['valeur'] !== 0) {
342 342
                     $folderData = explode(', ', $data['valeur']);
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                         prefixTable('misc'),
369 369
                         'type = %s AND intitule = %s',
370 370
                         'folder_deleted',
371
-                        'f' . $folderData[0]
371
+                        'f'.$folderData[0]
372 372
                     );
373 373
 
374 374
                     // Delete all items in this folder
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
                     // Get list of all items in thos folder
383 383
                     $items = DB::query(
384 384
                         'SELECT id
385
-                        FROM ' . prefixTable('items') . '
385
+                        FROM ' . prefixTable('items').'
386 386
                         WHERE id_tree = %i',
387 387
                         $folderData[0]
388 388
                     );
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             ) {
479 479
                 if ($post_log_type === 'items') {
480 480
                     DB::query(
481
-                        'SELECT * FROM ' . prefixTable('log_items') . '
481
+                        'SELECT * FROM '.prefixTable('log_items').'
482 482
                         WHERE action=%s ' .  'AND date BETWEEN %i AND %i'
483 483
                         . ($post_filter_action === 'all' ? '' : ' AND action = %s')
484 484
                         . ($post_filter_user === -1 ? '' : ' AND id_user = %i'),
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
                 } elseif ($post_log_type === 'connections') {
501 501
                     db::debugmode(true);
502 502
                     DB::query(
503
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
503
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
504 504
                             'AND date BETWEEN %i AND %i',
505 505
                         'user_connection',
506 506
                         $post_date_from,
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                     );
518 518
                 } elseif ($post_log_type === 'errors') {
519 519
                     DB::query(
520
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
520
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
521 521
                             'AND date BETWEEN %i AND %i',
522 522
                         'error',
523 523
                         $post_date_from,
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
                     );
535 535
                 } elseif ($post_log_type === 'copy') {
536 536
                     DB::query(
537
-                        'SELECT * FROM ' . prefixTable('log_items') . ' WHERE action=%s ' .
537
+                        'SELECT * FROM '.prefixTable('log_items').' WHERE action=%s '.
538 538
                             'AND date BETWEEN %i AND %i',
539 539
                         'at_copy',
540 540
                         $post_date_from,
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     );
552 552
                 } elseif ($post_log_type === 'admin') {
553 553
                     DB::query(
554
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
554
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
555 555
                             'AND date BETWEEN %i AND %i',
556 556
                         'admin_action',
557 557
                         $post_date_from,
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
                     );
569 569
                 } elseif ($post_log_type === 'failed') {
570 570
                     DB::query(
571
-                        'SELECT * FROM ' . prefixTable('log_system') . ' WHERE type=%s ' .
571
+                        'SELECT * FROM '.prefixTable('log_system').' WHERE type=%s '.
572 572
                             'AND date BETWEEN %i AND %i',
573 573
                         'failed_auth',
574 574
                         $post_date_from,
Please login to merge, or discard this patch.
sources/export.queries.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -50,26 +50,26 @@  discard block
 block discarded – undo
50 50
 }
51 51
 
52 52
 // Do checks
53
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
54
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
53
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
54
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
55 55
 if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) {
56 56
     // Not allowed page
57 57
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED;
58
-    include $SETTINGS['cpassman_dir'] . '/error.php';
58
+    include $SETTINGS['cpassman_dir'].'/error.php';
59 59
     exit();
60 60
 }
61 61
 
62 62
 // No time limit
63 63
 set_time_limit(0);
64 64
 
65
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
65
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
66 66
 header('Content-type: text/html; charset=utf-8');
67 67
 error_reporting(E_ERROR);
68
-require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
69
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
68
+require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
69
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
70 70
 
71 71
 // Connect to mysql server
72
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
72
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
73 73
 if (defined('DB_PASSWD_CLEAR') === false) {
74 74
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
75 75
 }
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 DB::$encoding = DB_ENCODING;
82 82
 
83 83
 // Build tree
84
-$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries');
84
+$tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries');
85 85
 $tree->register();
86
-$tree = new Tree\NestedTree\NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
86
+$tree = new Tree\NestedTree\NestedTree($pre.'nested_tree', 'id', 'parent_id', 'title');
87 87
 
88 88
 // User's language loading
89
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
89
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
90 90
 
91 91
 // Prepare POST variables
92 92
 $id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
@@ -137,9 +137,9 @@  discard block
 block discarded – undo
137 137
                         'SELECT i.id as id, i.id_tree as id_tree, i.restricted_to as restricted_to, i.perso as perso,
138 138
                             i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url,
139 139
                             i.email as email,l.date as date, i.pw_iv as pw_iv,n.renewal_period as renewal_period
140
-                        FROM ' . prefixTable('items') . ' as i
141
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
142
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
140
+                        FROM ' . prefixTable('items').' as i
141
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
142
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
143 143
                         WHERE i.inactif = %i
144 144
                         AND i.id_tree= %i
145 145
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
                                 // Run query
163 163
                                 $dataItem = DB::queryfirstrow(
164 164
                                     'SELECT i.pw AS pw, s.share_key AS share_key
165
-                                    FROM ' . prefixTable('items') . ' AS i
166
-                                    INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
165
+                                    FROM ' . prefixTable('items').' AS i
166
+                                    INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
167 167
                                     WHERE user_id = %i AND i.id = %i',
168 168
                                     $_SESSION['user_id'],
169 169
                                     $record['id']
@@ -187,8 +187,8 @@  discard block
 block discarded – undo
187 187
                                 $arr_kbs = [];
188 188
                                 $rows_kb = DB::query(
189 189
                                     'SELECT b.label, b.id
190
-                                    FROM ' . prefixTable('kb_items') . ' AS a
191
-                                    INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
190
+                                    FROM ' . prefixTable('kb_items').' AS a
191
+                                    INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
192 192
                                     WHERE a.item_id = %i',
193 193
                                     $record['id']
194 194
                                 );
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                                 $arr_tags = [];
201 201
                                 $rows_tag = DB::query(
202 202
                                     'SELECT tag
203
-                                    FROM ' . prefixTable('tags') . '
203
+                                    FROM ' . prefixTable('tags').'
204 204
                                     WHERE item_id = %i',
205 205
                                     $record['id']
206 206
                                 );
@@ -247,14 +247,14 @@  discard block
 block discarded – undo
247 247
                 $tmp .= array2csv($value);
248 248
             }
249 249
 
250
-            echo '[{"content":"' . base64_encode($tmp) . '"}]';
250
+            echo '[{"content":"'.base64_encode($tmp).'"}]';
251 251
             break;
252 252
 
253 253
             /*
254 254
          * PDF - step 1 - Prepare database
255 255
          */
256 256
         case 'initialize_export_table':
257
-            DB::query('TRUNCATE TABLE ' . prefixTable('export'));
257
+            DB::query('TRUNCATE TABLE '.prefixTable('export'));
258 258
             break;
259 259
 
260 260
             /*
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
                     'SELECT i.id as id, i.restricted_to as restricted_to, i.perso as perso, i.label as label, i.description as description, i.pw as pw, i.login as login, i.url as url, i.email as email,
299 299
                         l.date as date, i.pw_iv as pw_iv,
300 300
                         n.renewal_period as renewal_period
301
-                        FROM ' . prefixTable('items') . ' as i
302
-                        INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
303
-                        INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
301
+                        FROM ' . prefixTable('items').' as i
302
+                        INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
303
+                        INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
304 304
                         WHERE i.inactif = %i
305 305
                         AND i.id_tree= %i
306 306
                         AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
                             // Run query
327 327
                             $dataItem = DB::queryfirstrow(
328 328
                                 'SELECT i.pw AS pw, s.share_key AS share_key
329
-                                FROM ' . prefixTable('items') . ' AS i
330
-                                INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id)
329
+                                FROM ' . prefixTable('items').' AS i
330
+                                INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id)
331 331
                                 WHERE user_id = %i AND i.id = %i',
332 332
                                 $_SESSION['user_id'],
333 333
                                 $record['id']
@@ -351,8 +351,8 @@  discard block
 block discarded – undo
351 351
                             $arr_kbs = '';
352 352
                             $rows_kb = DB::query(
353 353
                                 'SELECT b.label, b.id
354
-                                FROM ' . prefixTable('kb_items') . ' AS a
355
-                                INNER JOIN ' . prefixTable('kb') . ' AS b ON (a.kb_id = b.id)
354
+                                FROM ' . prefixTable('kb_items').' AS a
355
+                                INNER JOIN ' . prefixTable('kb').' AS b ON (a.kb_id = b.id)
356 356
                                 WHERE a.item_id = %i',
357 357
                                 $record['id']
358 358
                             );
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
                                 if (empty($arr_kbs)) {
361 361
                                     $arr_kbs = $rec_kb['label'];
362 362
                                 } else {
363
-                                    $arr_kbs .= ' | ' . $rec_kb['label'];
363
+                                    $arr_kbs .= ' | '.$rec_kb['label'];
364 364
                                 }
365 365
                             }
366 366
 
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
                             $arr_tags = '';
369 369
                             $rows_tag = DB::query(
370 370
                                 'SELECT tag
371
-                                FROM ' . prefixTable('tags') . '
371
+                                FROM ' . prefixTable('tags').'
372 372
                                 WHERE item_id = %i',
373 373
                                 $record['id']
374 374
                             );
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                                 if (empty($arr_tags)) {
377 377
                                     $arr_tags = $rec_tag['tag'];
378 378
                                 } else {
379
-                                    $arr_tags .= ' ' . $rec_tag['tag'];
379
+                                    $arr_tags .= ' '.$rec_tag['tag'];
380 380
                                 }
381 381
                             }
382 382
 
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
             header('Content-type: application/pdf');
445 445
 
446 446
             // query
447
-            $rows = DB::query('SELECT * FROM ' . prefixTable('export'));
447
+            $rows = DB::query('SELECT * FROM '.prefixTable('export'));
448 448
             $counter = DB::count();
449 449
             if ($counter > 0) {
450 450
                 // print
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
                 $prev_path = '';
453 453
 
454 454
                 //Prepare the PDF file
455
-                require_once($SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
456
-                include $SETTINGS['cpassman_dir'] . '/includes/libraries/Pdf/tcpdf/tcpdf.php';
455
+                require_once($SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/config/tcpdf_config.php');
456
+                include $SETTINGS['cpassman_dir'].'/includes/libraries/Pdf/tcpdf/tcpdf.php';
457 457
 
458 458
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
459 459
                 $pdf->SetProtection(array('print'), $dataReceived['pdf_password'], null);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 
466 466
                 // set default header data
467 467
                 $pdf->SetHeaderData(
468
-                    $SETTINGS['cpassman_dir'] . '/includes/images/teampass-logo2-home.png',
468
+                    $SETTINGS['cpassman_dir'].'/includes/images/teampass-logo2-home.png',
469 469
                     PDF_HEADER_LOGO_WIDTH,
470 470
                     'Teampass export',
471 471
                     $_SESSION['lastname']." ".$_SESSION['name'].' @ '.date($SETTINGS['date_format']." ".$SETTINGS['time_format'], (int) time())
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                 logEvents($SETTINGS, 'pdf_export', '', (string) $_SESSION['user_id'], $_SESSION['login']);
570 570
 
571 571
                 //clean table
572
-                DB::query('TRUNCATE TABLE ' . prefixTable('export'));
572
+                DB::query('TRUNCATE TABLE '.prefixTable('export'));
573 573
 
574 574
                 // Send back the file in Blob
575 575
                 echo $pdf->Output(null, 'I');
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
             // step 1:
582 582
             // - prepare export file
583 583
             // - get full list of objects id to export
584
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
585
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
584
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
585
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
586 586
             $idsList = array();
587 587
 
588 588
             foreach (explode(';', $post_ids) as $id) {
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
                     // count elements to display
595 595
                     $result = DB::query(
596 596
                         'SELECT i.id AS id, i.label AS label, i.restricted_to AS restricted_to, i.perso AS perso
597
-                    FROM ' . prefixTable('items') . ' as i
598
-                    INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
599
-                    INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
597
+                    FROM ' . prefixTable('items').' as i
598
+                    INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
599
+                    INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
600 600
                     WHERE i.inactif = %i
601 601
                     AND i.id_tree= %i
602 602
                     AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -624,9 +624,9 @@  discard block
 block discarded – undo
624 624
 
625 625
             // prepare export file
626 626
             //save the file
627
-            $html_file = '/teampass_export_' . time() . '_' . generateKey() . '.html';
627
+            $html_file = '/teampass_export_'.time().'_'.generateKey().'.html';
628 628
             //print_r($full_listing);
629
-            $outstream = fopen($SETTINGS['path_to_files_folder'] . $html_file, 'w');
629
+            $outstream = fopen($SETTINGS['path_to_files_folder'].$html_file, 'w');
630 630
             if ($outstream === false) {
631 631
                 echo '[{"error":"true"}]';
632 632
                 break;
@@ -650,12 +650,12 @@  discard block
 block discarded – undo
650 650
     </style>
651 651
     </head>
652 652
     <body>
653
-    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password) . '" />
653
+    <input type="hidden" id="generation_date" value="' . GibberishAES::enc(/** @scrutinizer ignore-type */ (string) time(), $post_pdf_password).'" />
654 654
     <div id="header">
655
-    ' . TP_TOOL_NAME . ' - Off Line mode
655
+    ' . TP_TOOL_NAME.' - Off Line mode
656 656
     </div>
657 657
     <div style="margin:10px; font-size:9px;">
658
-    <i>This page was generated by <b>' . $_SESSION['name'] . ' ' . $_SESSION['lastname'] . '</b>, the ' . date('Y/m/d H:i:s') . '.</i>
658
+    <i>This page was generated by <b>' . $_SESSION['name'].' '.$_SESSION['lastname'].'</b>, the '.date('Y/m/d H:i:s').'.</i>
659 659
     <span id="info_page" style="margin-left:20px; font-weight:bold; font-size: 14px; color:red;"></span>
660 660
     </div>
661 661
     <div id="information"></div>
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
     <div>
667 667
     <table id="itemsTable">
668 668
         <thead><tr>
669
-            <th style="width:15%;">' . $LANG['label'] . '</th>
670
-            <th style="width:10%;">' . $LANG['pw'] . '</th>
671
-            <th style="width:30%;">' . $LANG['description'] . '</th>
672
-            <th style="width:5%;">' . $LANG['user_login'] . '</th>
673
-            <th style="width:20%;">' . $LANG['url'] . '</th>
669
+            <th style="width:15%;">' . $LANG['label'].'</th>
670
+            <th style="width:10%;">' . $LANG['pw'].'</th>
671
+            <th style="width:30%;">' . $LANG['description'].'</th>
672
+            <th style="width:5%;">' . $LANG['user_login'].'</th>
673
+            <th style="width:20%;">' . $LANG['url'].'</th>
674 674
         </tr></thead>
675 675
         <tbody id="itemsTable_tbody">'
676 676
             );
@@ -695,22 +695,22 @@  discard block
 block discarded – undo
695 695
                 || in_array($post_idTree, $_SESSION['groupes_visibles']) === false
696 696
                 || (in_array($post_idTree, $_SESSION['no_access_folders']) === true)
697 697
             ) {
698
-                echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
698
+                echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
699 699
                 break;
700 700
             }
701 701
 
702 702
             $full_listing = array();
703 703
             $items_id_list = array();
704
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
705
-            include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
704
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
705
+            include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
706 706
 
707 707
             $rows = DB::query(
708 708
                 'SELECT i.id as id, i.url as url, i.perso as perso, i.label as label, i.description as description, i.pw as pw, i.login as login, i.id_tree as id_tree,
709 709
                 l.date as date, i.pw_iv as pw_iv,
710 710
                 n.renewal_period as renewal_period
711
-            FROM ' . prefixTable('items') . ' as i
712
-            INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id)
713
-            INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item)
711
+            FROM ' . prefixTable('items').' as i
712
+            INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id)
713
+            INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item)
714 714
             WHERE i.inactif = %i
715 715
             AND i.id_tree= %i
716 716
             AND (l.action = %s OR (l.action = %s AND l.raison LIKE %s))
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             }
771 771
 
772 772
             //save in export file
773
-            $outstream = fopen($post_file . '.txt', 'a');
773
+            $outstream = fopen($post_file.'.txt', 'a');
774 774
             if ($outstream === false) {
775 775
                 echo '[{"error":"true"}]';
776 776
                 break;
@@ -808,13 +808,13 @@  discard block
 block discarded – undo
808 808
                         if (empty($arboHtml)) {
809 809
                             $arboHtml = $arboHtml_tmp;
810 810
                         } else {
811
-                            $arboHtml .= ' » ' . $arboHtml_tmp;
811
+                            $arboHtml .= ' » '.$arboHtml_tmp;
812 812
                         }
813 813
                     }
814 814
                     fputs(
815 815
                         $outstream,
816 816
                         '
817
-        <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'
817
+        <tr class="path"><td colspan="5">' . $arboHtml.'</td></tr>'
818 818
                     );
819 819
                     $idTree = $elem['id_tree'];
820 820
                 }
@@ -823,12 +823,12 @@  discard block
 block discarded – undo
823 823
                 fputs(
824 824
                     $outstream,
825 825
                     '
826
-        <tr class="' . $lineType . '">
827
-            <td>' . addslashes($elem['label']) . '</td>
828
-            <td align="center"><span class="span_pw" id="span_' . $elem['id'] . '"><a href="#" onclick="decryptme(' . $elem['id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $elem['id'] . '" value="' . $encPw . '" /></td>
829
-            <td>' . $desc . '</td>
830
-            <td align="center">' . $login . '</td>
831
-            <td align="center">' . $url . '</td>
826
+        <tr class="' . $lineType.'">
827
+            <td>' . addslashes($elem['label']).'</td>
828
+            <td align="center"><span class="span_pw" id="span_' . $elem['id'].'"><a href="#" onclick="decryptme('.$elem['id'].', \''.$encPw.'\');return false;">Decrypt </a></span><input type="hidden" id="hide_'.$elem['id'].'" value="'.$encPw.'" /></td>
829
+            <td>' . $desc.'</td>
830
+            <td align="center">' . $login.'</td>
831
+            <td align="center">' . $url.'</td>
832 832
             </tr>'
833 833
                 );
834 834
             }
@@ -836,29 +836,29 @@  discard block
 block discarded – undo
836 836
             fclose($outstream);
837 837
 
838 838
             // send back and continue
839
-            echo '[{"loop":"true", "number":"' . $post_number . '", "cpt":"' . $post_cpt . '", "file":"' . $post_file . '", "idsList":"' . $post_idsList . '" , "file_link":"' . $post_file_link . '"}]';
839
+            echo '[{"loop":"true", "number":"'.$post_number.'", "cpt":"'.$post_cpt.'", "file":"'.$post_file.'", "idsList":"'.$post_idsList.'" , "file_link":"'.$post_file_link.'"}]';
840 840
             break;
841 841
 
842 842
             //CASE export in HTML format - Iteration loop
843 843
         case 'export_to_html_format_finalize':
844 844
             // Load includes
845
-            include $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
846
-            require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
845
+            include $SETTINGS['cpassman_dir'].'/includes/config/include.php';
846
+            require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/GibberishAES/GibberishAES.php';
847 847
 
848 848
             // read the content of the temporary file
849
-            $handle = fopen($post_file . '.txt', 'r');
849
+            $handle = fopen($post_file.'.txt', 'r');
850 850
             if ($handle === false) {
851 851
                 echo '[{"error":"true"}]';
852 852
                 break;
853 853
             }
854
-            $contents = fread($handle, filesize($post_file . '.txt'));
854
+            $contents = fread($handle, filesize($post_file.'.txt'));
855 855
             if ($contents === false) {
856 856
                 echo '[{"error":"true"}]';
857 857
                 break;
858 858
             }
859 859
             fclose($handle);
860
-            if (is_file($post_file . '.txt')) {
861
-                unlink($post_file . '.txt');
860
+            if (is_file($post_file.'.txt')) {
861
+                unlink($post_file.'.txt');
862 862
             }
863 863
 
864 864
             // Encrypt its content
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
                 if (empty($encrypted_text) === true) {
870 870
                     $encrypted_text = GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
871 871
                 } else {
872
-                    $encrypted_text .= '|#|#|' . GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
872
+                    $encrypted_text .= '|#|#|'.GibberishAES::enc(/** @scrutinizer ignore-type */ $chunk, $post_pdf_password);
873 873
                 }
874 874
             }
875 875
 
@@ -886,9 +886,9 @@  discard block
 block discarded – undo
886 886
         </table></div>
887 887
         <input type="button" value="Hide all" onclick="hideAll()" />
888 888
         <div id="footer" style="text-align:center;">
889
-            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME . '&nbsp;' . TP_VERSION_FULL . '&nbsp;' . TP_COPYRIGHT . '</a>
889
+            <a href="https://teampass.net/about/" target="_blank" style="">' . TP_TOOL_NAME.'&nbsp;'.TP_VERSION_FULL.'&nbsp;'.TP_COPYRIGHT.'</a>
890 890
         </div>
891
-        <div id="enc_html" style="display:none;">' . $encrypted_text . '</div>
891
+        <div id="enc_html" style="display:none;">' . $encrypted_text.'</div>
892 892
         </body>
893 893
     </html>
894 894
     <script type="text/javascript">
@@ -994,9 +994,9 @@  discard block
 block discarded – undo
994 994
 
995 995
             fclose($outstream);
996 996
 
997
-            echo '[{"text":"<a href=\'' .
998
-                $post_file_link .
999
-                '\' target=\'_blank\'>' . $LANG['pdf_download'] . '</a>"}]';
997
+            echo '[{"text":"<a href=\''.
998
+                $post_file_link.
999
+                '\' target=\'_blank\'>'.$LANG['pdf_download'].'</a>"}]';
1000 1000
             break;
1001 1001
     }
1002 1002
 }
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
@@ -50,22 +50,22 @@  discard block
 block discarded – undo
50 50
     // Load AntiXSS
51 51
     include_once '../includes/libraries/voku/helper/AntiXSS.php';
52 52
     $antiXss = new voku\helper\AntiXSS();
53
-    if (! headers_sent()) {    //If headers not sent yet... then do php redirect
54
-        header('Location: ' . $antiXss->xss_clean($url));
53
+    if (!headers_sent()) {    //If headers not sent yet... then do php redirect
54
+        header('Location: '.$antiXss->xss_clean($url));
55 55
         exit;
56 56
     }
57 57
 
58 58
     //If headers are sent... do java redirect... if java disabled, do html redirect.
59 59
     echo '<script type="text/javascript">';
60
-    echo 'window.location.href="' . $antiXss->xss_clean($url) . '";';
60
+    echo 'window.location.href="'.$antiXss->xss_clean($url).'";';
61 61
     echo '</script>';
62 62
     echo '<noscript>';
63
-    echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />';
63
+    echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />';
64 64
     echo '</noscript>';
65 65
 }
66 66
 
67 67
 // Include files
68
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
68
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
69 69
 $superGlobal = new protect\SuperGlobal\SuperGlobal();
70 70
 // Prepare GET variables
71 71
 $server = [];
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     && isset($SETTINGS['enable_sts']) === true
89 89
     && (int) $SETTINGS['enable_sts'] === 1
90 90
 ) {
91
-    redirect('https://' . $server['http_host'] . $server['request_uri']);
91
+    redirect('https://'.$server['http_host'].$server['request_uri']);
92 92
 }
93 93
 
94 94
 // 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
                         }
@@ -152,13 +152,13 @@  discard block
 block discarded – undo
152 152
             }
153 153
         }
154 154
 
155
-        if (is_dir($SETTINGS['cpassman_dir'] . '/install')) {
155
+        if (is_dir($SETTINGS['cpassman_dir'].'/install')) {
156 156
             // Set the permissions on the install directory and delete
157 157
             // is server Windows or Linux?
158 158
             if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
159
-                recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440);
159
+                recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440);
160 160
             }
161
-            delTree($SETTINGS['cpassman_dir'] . '/install');
161
+            delTree($SETTINGS['cpassman_dir'].'/install');
162 162
         }
163 163
 
164 164
         // Delete temporary install table
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 // Load Languages stuff
177 177
 if (isset($languagesList) === false) {
178 178
     $languagesList = [];
179
-    $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC');
179
+    $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC');
180 180
     foreach ($rows as $record) {
181 181
         array_push($languagesList, $record['name']);
182 182
         if (isset($_SESSION['user_language']) && $record['name'] === $_SESSION['user_language']) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 // CHECK IF SESSION EXISTS AND IF SESSION IS VALID
235 235
 if (empty($_SESSION['sessionDuration']) === false) {
236 236
     $dataSession = DB::queryFirstRow(
237
-        'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i',
237
+        'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i',
238 238
         $_SESSION['user_id']
239 239
     );
240 240
 } else {
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
     && (isset($_SESSION['user_admin']) === true && $_SESSION['user_admin'] === 1)
299 299
 ) {
300 300
     $row = DB::queryFirstRow(
301
-        'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule',
301
+        'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule',
302 302
         [
303 303
             'type' => 'admin',
304 304
             'intitule' => 'cpassman_version',
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
         syslog(
360 360
             LOG_WARNING,
361
-            'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})"
361
+            'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})"
362 362
         );
363 363
         // erase session table
364 364
         $_SESSION = [];
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) {
410 410
     // query on user
411 411
     $data = DB::queryfirstrow(
412
-        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM ' . prefixTable('users') . ' WHERE id=%i',
412
+        'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM '.prefixTable('users').' WHERE id=%i',
413 413
         $_SESSION['user_id']
414 414
     );
415 415
     //Check if user has been deleted or unlogged
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
     $_SESSION['item_fields'] = [];
491 491
     $rows = DB::query(
492 492
         'SELECT *
493
-            FROM ' . prefixTable('categories') . '
493
+            FROM ' . prefixTable('categories').'
494 494
             WHERE level=%i',
495 495
         '0'
496 496
     );
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
         // get each field
500 500
         $rows2 = DB::query(
501 501
             'SELECT *
502
-            FROM ' . prefixTable('categories') . '
502
+            FROM ' . prefixTable('categories').'
503 503
             WHERE parent_id=%i
504 504
             ORDER BY `order` ASC',
505 505
             $record['id']
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 if (
577 577
     isset($SETTINGS['roles_allowed_to_print']) === true
578 578
     && isset($_SESSION['user_roles']) === true
579
-    && (! isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
579
+    && (!isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout']))
580 580
 ) {
581 581
     foreach (explode(';', $SETTINGS['roles_allowed_to_print']) as $role) {
582 582
         if (in_array($role, $_SESSION['user_roles']) === true) {
@@ -586,5 +586,5 @@  discard block
 block discarded – undo
586 586
 }
587 587
 
588 588
 /* CHECK NUMBER OF USER ONLINE */
589
-DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600);
589
+DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600);
590 590
 $_SESSION['nb_users_online'] = DB::count();
Please login to merge, or discard this patch.
sources/admin.queries.php 1 patch
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
 }
47 47
 
48 48
 /* do checks */
49
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php';
50
-require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php';
49
+require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
50
+require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
51 51
 if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) {
52 52
     $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
53
-    include $SETTINGS['cpassman_dir'] . '/error.php';
53
+    include $SETTINGS['cpassman_dir'].'/error.php';
54 54
     exit;
55 55
 }
56 56
 
57
-require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php';
58
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
59
-require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php';
57
+require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php';
58
+require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
+require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php';
60 60
 
61 61
 header('Content-type: text/html; charset=utf-8');
62 62
 header('Cache-Control: no-cache, no-store, must-revalidate');
63 63
 
64
-require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php';
64
+require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
65 65
 
66 66
 // connect to the server
67
-require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php';
67
+require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php';
68 68
 if (defined('DB_PASSWD_CLEAR') === false) {
69 69
     define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS));
70 70
 }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                         array(
118 118
                             'http' => array(
119 119
                                 'ignore_errors' => true,
120
-                                'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'],
120
+                                'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'],
121 121
                             ),
122 122
                         )
123 123
                     );
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
                     $json_array = json_decode($json, true);
137 137
 
138 138
                     // About version
139
-                    $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL;
139
+                    $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL;
140 140
                     if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) {
141
-                        $text .= '&nbsp;&nbsp;<b>' . $LANG['please_update'] . '</b>';
141
+                        $text .= '&nbsp;&nbsp;<b>'.$LANG['please_update'].'</b>';
142 142
                     }
143 143
                     $text .= '</li>';
144 144
 
145 145
                     // Libraries
146 146
                     $text .= '<li><u>Libraries</u> :</li>';
147 147
                     foreach ($json_array['libraries'] as $key => $val) {
148
-                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;" . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>';
148
+                        $text .= "<li>&nbsp;<span class='fa fa-caret-right'></span>&nbsp;".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>';
149 149
                     }
150 150
                 }
151 151
             } else {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         }
157 157
         $text .= '</ul>';
158 158
 
159
-        echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]';
159
+        echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]';
160 160
         break;
161 161
 
162 162
         //##########################################################
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
         //get through all users
189 189
         $rows = DB::query(
190 190
             'SELECT id, login, email
191
-            FROM ' . prefixTable('users') . '
191
+            FROM ' . prefixTable('users').'
192 192
             ORDER BY login ASC'
193 193
         );
194 194
         foreach ($rows as $record) {
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
             //if folder doesn't exist then create it
206 206
             $data = DB::queryfirstrow(
207 207
                 'SELECT id
208
-                FROM ' . prefixTable('nested_tree') . '
208
+                FROM ' . prefixTable('nested_tree').'
209 209
                 WHERE title = %s AND parent_id = %i',
210 210
                 $record['id'],
211 211
                 0
@@ -267,8 +267,8 @@  discard block
 block discarded – undo
267 267
         echo prepareExchangedData(
268 268
             array(
269 269
                 'error' => false,
270
-                'message' => langHdl('last_execution') . ' ' .
271
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
270
+                'message' => langHdl('last_execution').' '.
271
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
272 272
                     '<i class="fas fa-check text-success ml-2"></i>',
273 273
             ),
274 274
             'encode'
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
         }
303 303
 
304 304
         //Libraries call
305
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
305
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
306 306
 
307 307
         //init
308 308
         $foldersIds = array();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
             }
317 317
         }
318 318
 
319
-        $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds);
319
+        $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds);
320 320
         foreach ($items as $item) {
321 321
             //Delete item
322 322
             DB::DELETE(prefixTable('items'), 'id = %i', $item['id']);
@@ -337,12 +337,12 @@  discard block
 block discarded – undo
337 337
         // delete orphan items
338 338
         $rows = DB::query(
339 339
             'SELECT id
340
-            FROM ' . prefixTable('items') . '
340
+            FROM ' . prefixTable('items').'
341 341
             ORDER BY id ASC'
342 342
         );
343 343
         foreach ($rows as $item) {
344 344
             DB::query(
345
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
345
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
346 346
                 $item['id'],
347 347
                 'at_creation'
348 348
             );
@@ -372,11 +372,11 @@  discard block
 block discarded – undo
372 372
         echo prepareExchangedData(
373 373
             array(
374 374
                 'error' => false,
375
-                'message' => langHdl('last_execution') . ' ' .
376
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
375
+                'message' => langHdl('last_execution').' '.
376
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
377 377
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
378 378
                     <i class="fas fa-chevron-right mr-2"></i>' .
379
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
379
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
380 380
             ),
381 381
             'encode'
382 382
         );
@@ -408,21 +408,21 @@  discard block
 block discarded – undo
408 408
             break;
409 409
         }
410 410
 
411
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
411
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
412 412
         $return = '';
413 413
 
414 414
         //Get all tables
415 415
         $tables = array();
416 416
         $result = DB::query('SHOW TABLES');
417 417
         foreach ($result as $row) {
418
-            $tables[] = $row['Tables_in_' . $database];
418
+            $tables[] = $row['Tables_in_'.$database];
419 419
         }
420 420
 
421 421
         //cycle through
422 422
         foreach ($tables as $table) {
423 423
             if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) {
424 424
                 // Do query
425
-                $result = DB::queryRaw('SELECT * FROM ' . $table);
425
+                $result = DB::queryRaw('SELECT * FROM '.$table);
426 426
                 DB::queryRaw(
427 427
                     'SELECT *
428 428
                     FROM INFORMATION_SCHEMA.COLUMNS
@@ -434,19 +434,19 @@  discard block
 block discarded – undo
434 434
                 $numFields = DB::count();
435 435
 
436 436
                 // prepare a drop table
437
-                $return .= 'DROP TABLE ' . $table . ';';
438
-                $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table);
439
-                $return .= "\n\n" . $row2['Create Table'] . ";\n\n";
437
+                $return .= 'DROP TABLE '.$table.';';
438
+                $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table);
439
+                $return .= "\n\n".$row2['Create Table'].";\n\n";
440 440
 
441 441
                 //prepare all fields and datas
442 442
                 for ($i = 0; $i < $numFields; ++$i) {
443 443
                     while ($row = $result->fetch_row()) {
444
-                        $return .= 'INSERT INTO ' . $table . ' VALUES(';
444
+                        $return .= 'INSERT INTO '.$table.' VALUES(';
445 445
                         for ($j = 0; $j < $numFields; ++$j) {
446 446
                             $row[$j] = addslashes($row[$j]);
447 447
                             $row[$j] = preg_replace("/\n/", '\\n', $row[$j]);
448 448
                             if (isset($row[$j])) {
449
-                                $return .= '"' . $row[$j] . '"';
449
+                                $return .= '"'.$row[$j].'"';
450 450
                             } else {
451 451
                                 $return .= 'NULL';
452 452
                             }
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
             $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS);
467 467
 
468 468
             //save file
469
-            $filename = time() . '-' . $token . '.sql';
470
-            $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+');
469
+            $filename = time().'-'.$token.'.sql';
470
+            $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+');
471 471
             if ($handle !== false) {
472 472
                 //write file
473 473
                 fwrite($handle, $return);
@@ -479,17 +479,17 @@  discard block
 block discarded – undo
479 479
                 // Encrypt the file
480 480
                 prepareFileWithDefuse(
481 481
                     'encrypt',
482
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename,
483
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
482
+                    $SETTINGS['path_to_files_folder'].'/'.$filename,
483
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
484 484
                     $SETTINGS,
485 485
                     $post_option
486 486
                 );
487 487
 
488 488
                 // Do clean
489
-                unlink($SETTINGS['path_to_files_folder'] . '/' . $filename);
489
+                unlink($SETTINGS['path_to_files_folder'].'/'.$filename);
490 490
                 rename(
491
-                    $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename,
492
-                    $SETTINGS['path_to_files_folder'] . '/' . $filename
491
+                    $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename,
492
+                    $SETTINGS['path_to_files_folder'].'/'.$filename
493 493
                 );
494 494
             }
495 495
 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
             //update LOG
500 500
             logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']);
501 501
 
502
-            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]';
502
+            echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]';
503 503
         }
504 504
         break;
505 505
 
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
             );
529 529
             break;
530 530
         }
531
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
531
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
532 532
 
533 533
         $dataPost = explode('&', $post_option);
534 534
         $file = htmlspecialchars($dataPost[0]);
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
         // Get filename from database
538 538
         $data = DB::queryFirstRow(
539 539
             'SELECT valeur
540
-            FROM ' . prefixTable('misc') . '
540
+            FROM ' . prefixTable('misc').'
541 541
             WHERE increment_id = %i',
542 542
             $file
543 543
         );
@@ -556,22 +556,22 @@  discard block
 block discarded – undo
556 556
             // Decrypt the file
557 557
             $ret = prepareFileWithDefuse(
558 558
                 'decrypt',
559
-                $SETTINGS['path_to_files_folder'] . '/' . $file,
560
-                $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file,
559
+                $SETTINGS['path_to_files_folder'].'/'.$file,
560
+                $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file,
561 561
                 $SETTINGS,
562 562
                 $key
563 563
             );
564 564
 
565 565
             if (empty($ret) === false) {
566
-                echo '[{"result":"db_restore" , "message":"' . $ret . '"}]';
566
+                echo '[{"result":"db_restore" , "message":"'.$ret.'"}]';
567 567
                 break;
568 568
             }
569 569
 
570 570
             // Do clean
571
-            fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS);
572
-            $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file;
571
+            fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS);
572
+            $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file;
573 573
         } else {
574
-            $file = $SETTINGS['path_to_files_folder'] . '/' . $file;
574
+            $file = $SETTINGS['path_to_files_folder'].'/'.$file;
575 575
         }
576 576
 
577 577
         //read sql file
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
         fclose($handle);
589 589
 
590 590
         //delete file
591
-        unlink($SETTINGS['path_to_files_folder'] . '/' . $file);
591
+        unlink($SETTINGS['path_to_files_folder'].'/'.$file);
592 592
 
593 593
         //Show done
594 594
         echo '[{"result":"db_restore" , "message":""}]';
@@ -626,8 +626,8 @@  discard block
 block discarded – undo
626 626
             foreach ($table as $i => $tablename) {
627 627
                 if (substr_count($tablename, DB_PREFIX) > 0) {
628 628
                     // launch optimization quieries
629
-                    DB::query('ANALYZE TABLE `' . $tablename . '`');
630
-                    DB::query('OPTIMIZE TABLE `' . $tablename . '`');
629
+                    DB::query('ANALYZE TABLE `'.$tablename.'`');
630
+                    DB::query('OPTIMIZE TABLE `'.$tablename.'`');
631 631
                 }
632 632
             }
633 633
         }
@@ -635,12 +635,12 @@  discard block
 block discarded – undo
635 635
         //Clean up LOG_ITEMS table
636 636
         $rows = DB::query(
637 637
             'SELECT id
638
-            FROM ' . prefixTable('items') . '
638
+            FROM ' . prefixTable('items').'
639 639
             ORDER BY id ASC'
640 640
         );
641 641
         foreach ($rows as $item) {
642 642
             DB::query(
643
-                'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s',
643
+                'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s',
644 644
                 $item['id'],
645 645
                 'at_creation'
646 646
             );
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
             if ($counter === 0) {
649 649
                 //Create new at_creation entry
650 650
                 $rowTmp = DB::queryFirstRow(
651
-                    'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC',
651
+                    'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC',
652 652
                     $item['id']
653 653
                 );
654 654
                 DB::insert(
@@ -678,8 +678,8 @@  discard block
 block discarded – undo
678 678
         echo prepareExchangedData(
679 679
             array(
680 680
                 'error' => false,
681
-                'message' => langHdl('last_execution') . ' ' .
682
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
681
+                'message' => langHdl('last_execution').' '.
682
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
683 683
                     '<i class="fas fa-check text-success ml-2"></i>',
684 684
             ),
685 685
             'encode'
@@ -712,14 +712,14 @@  discard block
 block discarded – undo
712 712
             break;
713 713
         }
714 714
 
715
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
715
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
716 716
 
717 717
         //read folder
718 718
         if (is_dir($SETTINGS['path_to_files_folder']) === false) {
719 719
             echo prepareExchangedData(
720 720
                 array(
721 721
                     'error' => true,
722
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'],
722
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'],
723 723
                 ),
724 724
                 'encode'
725 725
             );
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
             //delete file FILES
732 732
             while (false !== ($f = readdir($dir))) {
733 733
                 if ($f !== '.' && $f !== '..' && $f !== '.htaccess') {
734
-                    if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) {
735
-                        fileDelete($dir . '/' . $f, $SETTINGS);
734
+                    if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) {
735
+                        fileDelete($dir.'/'.$f, $SETTINGS);
736 736
                     }
737 737
                 }
738 738
             }
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
             echo prepareExchangedData(
747 747
                 array(
748 748
                     'error' => true,
749
-                    'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'],
749
+                    'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'],
750 750
                 ),
751 751
                 'encode'
752 752
             );
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
             while (false !== ($f = readdir($dir))) {
761 761
                 if ($f !== '.' && $f !== '..') {
762 762
                     if (strpos($f, '_delete.') > 0) {
763
-                        fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS);
763
+                        fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS);
764 764
                     }
765 765
                 }
766 766
             }
@@ -782,11 +782,11 @@  discard block
 block discarded – undo
782 782
         echo prepareExchangedData(
783 783
             array(
784 784
                 'error' => false,
785
-                'message' => langHdl('last_execution') . ' ' .
786
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
785
+                'message' => langHdl('last_execution').' '.
786
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
787 787
                     '<i class="fas fa-check text-success ml-2 mr-3"></i>
788 788
                     <i class="fas fa-chevron-right mr-2"></i>' .
789
-                    $nbItemsDeleted . ' ' . langHdl('deleted_items'),
789
+                    $nbItemsDeleted.' '.langHdl('deleted_items'),
790 790
             ),
791 791
             'encode'
792 792
         );
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
             break;
820 820
         }
821 821
 
822
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
822
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
823 823
         updateCacheTable('reload', $SETTINGS, NULL);
824 824
 
825 825
         // Log
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
         echo prepareExchangedData(
836 836
             [
837 837
                 'error' => false,
838
-                'message' => langHdl('last_execution') . ' ' .
839
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
838
+                'message' => langHdl('last_execution').' '.
839
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
840 840
                     '<i class="fas fa-check text-success mr-2"></i>',
841 841
             ],
842 842
             'encode'
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
         }
872 872
 
873 873
         // Perform
874
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
874
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
875 875
         $ret = handleConfigFile('rebuild', $SETTINGS);
876 876
 
877 877
         // Log
@@ -898,8 +898,8 @@  discard block
 block discarded – undo
898 898
         echo prepareExchangedData(
899 899
             array(
900 900
                 'error' => false,
901
-                'message' => langHdl('last_execution') . ' ' .
902
-                    date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
901
+                'message' => langHdl('last_execution').' '.
902
+                    date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
903 903
                     '<i class="fas fa-check text-success ml-2"></i>',
904 904
             ),
905 905
             'encode'
@@ -939,33 +939,33 @@  discard block
 block discarded – undo
939 939
         $filename = $post_option;
940 940
         $tp_settings = [];
941 941
         //get backups infos
942
-        $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin');
942
+        $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin');
943 943
         foreach ($rows as $record) {
944 944
             $tp_settings[$record['intitule']] = $record['valeur'];
945 945
         }
946 946
 
947 947
         // check if backup file is in DB.
948 948
         // If YES then it is encrypted with DEFUSE
949
-        $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename');
949
+        $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename');
950 950
 
951 951
         //read file
952 952
         $return = '';
953
-        $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql';
953
+        $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql';
954 954
         if (file_exists($Fnm)) {
955 955
             if (!empty($bck) && $bck['valeur'] === $filename) {
956 956
                 $err = '';
957 957
 
958 958
                 // it means that file is DEFUSE encrypted
959
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
960
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
963
-                include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
959
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
960
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
961
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
962
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
963
+                include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
964 964
 
965 965
                 try {
966 966
                     \Defuse\Crypto\File::decryptFileWithPassword(
967
-                        $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql',
968
-                        $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql',
967
+                        $SETTINGS['bck_script_path'].'/'.$post_option.'.sql',
968
+                        $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql',
969 969
                         base64_decode($SETTINGS['bck_script_key'])
970 970
                     );
971 971
                 } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
                 }
974 974
 
975 975
                 if (!empty($err)) {
976
-                    echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]';
976
+                    echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]';
977 977
                     break;
978 978
                 }
979 979
             } else {
@@ -995,19 +995,19 @@  discard block
 block discarded – undo
995 995
                 );
996 996
 
997 997
                 //save the file
998
-                $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+');
998
+                $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+');
999 999
                 if ($handle !== false) {
1000 1000
                     fwrite($handle, $return);
1001 1001
                     fclose($handle);
1002 1002
                 }
1003 1003
             }
1004 1004
             $result = 'backup_decrypt_success';
1005
-            $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql';
1005
+            $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql';
1006 1006
         } else {
1007 1007
             $result = 'backup_decrypt_fails';
1008
-            $msg = 'File not found: ' . $Fnm;
1008
+            $msg = 'File not found: '.$Fnm;
1009 1009
         }
1010
-        echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]';
1010
+        echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]';
1011 1011
         break;
1012 1012
 
1013 1013
         /*
@@ -1041,22 +1041,22 @@  discard block
 block discarded – undo
1041 1041
         require_once 'main.functions.php';
1042 1042
 
1043 1043
         // store old sk
1044
-        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1044
+        $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1045 1045
 
1046 1046
         // generate new saltkey
1047
-        $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time();
1047
+        $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time();
1048 1048
         copy(
1049
-            SECUREPATH . '/teampass-seckey.txt',
1049
+            SECUREPATH.'/teampass-seckey.txt',
1050 1050
             $old_sk_filename
1051 1051
         );
1052 1052
         $new_key = defuse_generate_key();
1053 1053
         file_put_contents(
1054
-            SECUREPATH . '/teampass-seckey.txt',
1054
+            SECUREPATH.'/teampass-seckey.txt',
1055 1055
             $new_key
1056 1056
         );
1057 1057
 
1058 1058
         // store new sk
1059
-        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt');
1059
+        $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt');
1060 1060
 
1061 1061
         //put tool in maintenance.
1062 1062
         DB::update(
@@ -1072,13 +1072,13 @@  discard block
 block discarded – undo
1072 1072
         logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']);
1073 1073
 
1074 1074
         // get number of items to change
1075
-        DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0);
1075
+        DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0);
1076 1076
         $nb_of_items = DB::count();
1077 1077
 
1078 1078
         // create backup table
1079
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1079
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1080 1080
         DB::query(
1081
-            'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` (
1081
+            'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` (
1082 1082
             `id` int(12) NOT null AUTO_INCREMENT,
1083 1083
             `current_table` varchar(100) NOT NULL,
1084 1084
             `current_field` varchar(500) NOT NULL,
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
         );
1107 1107
 
1108 1108
         // delete previous backup files
1109
-        $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names
1109
+        $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names
1110 1110
         foreach ($files as $file) { // iterate files
1111 1111
             if (is_file($file)) {
1112 1112
                 $file_parts = pathinfo($file);
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
                 echo prepareExchangedData(
1189 1189
                     array(
1190 1190
                         'error' => true,
1191
-                        'message' => 'Input `' . $objects[0] . '` is not allowed',
1191
+                        'message' => 'Input `'.$objects[0].'` is not allowed',
1192 1192
                         'nbOfItems' => '',
1193 1193
                         'nextAction' => '',
1194 1194
                     ),
@@ -1201,9 +1201,9 @@  discard block
 block discarded – undo
1201 1201
                 //change all encrypted data in Items (passwords)
1202 1202
                 $rows = DB::query(
1203 1203
                     'SELECT id, pw, pw_iv
1204
-                    FROM ' . prefixTable('items') . '
1204
+                    FROM ' . prefixTable('items').'
1205 1205
                     WHERE perso = %s
1206
-                    LIMIT ' . $post_start . ', ' . $post_length,
1206
+                    LIMIT ' . $post_start.', '.$post_length,
1207 1207
                     '0'
1208 1208
                 );
1209 1209
                 foreach ($rows as $record) {
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
                             'current_field' => 'pw',
1216 1216
                             'value_id' => $record['id'],
1217 1217
                             'value' => $record['pw'],
1218
-                            'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';",
1218
+                            'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';",
1219 1219
                             'value2' => 'none',
1220 1220
                             'result' => 'none',
1221 1221
                         )
@@ -1264,9 +1264,9 @@  discard block
 block discarded – undo
1264 1264
                 //change all encrypted data in Logs (passwords)
1265 1265
                 $rows = DB::query(
1266 1266
                     'SELECT raison, increment_id
1267
-                    FROM ' . prefixTable('log_items') . "
1267
+                    FROM ' . prefixTable('log_items')."
1268 1268
                     WHERE action = %s AND raison LIKE 'at_pw :%'
1269
-                    LIMIT " . $post_start . ', ' . $post_length,
1269
+                    LIMIT " . $post_start.', '.$post_length,
1270 1270
                     'at_modification'
1271 1271
                 );
1272 1272
                 foreach ($rows as $record) {
@@ -1278,7 +1278,7 @@  discard block
 block discarded – undo
1278 1278
                             'current_field' => 'raison',
1279 1279
                             'value_id' => $record['increment_id'],
1280 1280
                             'value' => $record['raison'],
1281
-                            'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';",
1281
+                            'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';",
1282 1282
                             'value2' => 'none',
1283 1283
                             'result' => 'none',
1284 1284
                         )
@@ -1306,7 +1306,7 @@  discard block
 block discarded – undo
1306 1306
                         DB::update(
1307 1307
                             prefixTable('log_items'),
1308 1308
                             array(
1309
-                                'raison' => 'at_pw :' . $encrypt['string'],
1309
+                                'raison' => 'at_pw :'.$encrypt['string'],
1310 1310
                                 'encryption_type' => 'defuse',
1311 1311
                             ),
1312 1312
                             'increment_id = %i',
@@ -1331,8 +1331,8 @@  discard block
 block discarded – undo
1331 1331
                 //change all encrypted data in CATEGORIES (passwords)
1332 1332
                 $rows = DB::query(
1333 1333
                     'SELECT id, data
1334
-                    FROM ' . prefixTable('categories_items') . '
1335
-                    LIMIT ' . $post_start . ', ' . $post_length
1334
+                    FROM ' . prefixTable('categories_items').'
1335
+                    LIMIT ' . $post_start.', '.$post_length
1336 1336
                 );
1337 1337
                 foreach ($rows as $record) {
1338 1338
                     // backup data
@@ -1343,7 +1343,7 @@  discard block
 block discarded – undo
1343 1343
                             'current_field' => 'data',
1344 1344
                             'value_id' => $record['id'],
1345 1345
                             'value' => $record['data'],
1346
-                            'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';",
1346
+                            'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';",
1347 1347
                             'value2' => 'none',
1348 1348
                             'result' => 'none',
1349 1349
                         )
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
                 // Change all encrypted data in FILES (passwords)
1392 1392
                 $rows = DB::query(
1393 1393
                     'SELECT id, file, status
1394
-                    FROM ' . prefixTable('files') . "
1394
+                    FROM ' . prefixTable('files')."
1395 1395
                     WHERE status = 'encrypted'
1396
-                    LIMIT " . $post_start . ', ' . $post_length
1396
+                    LIMIT " . $post_start.', '.$post_length
1397 1397
                 );
1398 1398
                 foreach ($rows as $record) {
1399 1399
                     // backup data
@@ -1411,20 +1411,20 @@  discard block
 block discarded – undo
1411 1411
                     );
1412 1412
                     $newID = DB::insertId();
1413 1413
 
1414
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1414
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1415 1415
                         // make a copy of file
1416 1416
                         if (!copy(
1417
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1418
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy'
1417
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1418
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy'
1419 1419
                         )) {
1420 1420
                             $error = 'Copy not possible';
1421 1421
                             exit;
1422 1422
                         } else {
1423 1423
                             // prepare a bck of file (that will not be deleted)
1424
-                            $backup_filename = $record['file'] . '.bck-change-sk.' . time();
1424
+                            $backup_filename = $record['file'].'.bck-change-sk.'.time();
1425 1425
                             copy(
1426
-                                $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1427
-                                $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename
1426
+                                $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1427
+                                $SETTINGS['path_to_upload_folder'].'/'.$backup_filename
1428 1428
                             );
1429 1429
                         }
1430 1430
 
@@ -1432,24 +1432,24 @@  discard block
 block discarded – undo
1432 1432
                         // STEP1 - Do decryption
1433 1433
                         prepareFileWithDefuse(
1434 1434
                             'decrypt',
1435
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1436
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1435
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1436
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1437 1437
                             $SETTINGS
1438 1438
                         );
1439 1439
 
1440 1440
                         // Do cleanup of files
1441
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']);
1441
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']);
1442 1442
 
1443 1443
                         // STEP2 - Do encryption
1444 1444
                         prepareFileWithDefuse(
1445 1445
                             'encryp',
1446
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted',
1447
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['file'],
1446
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted',
1447
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['file'],
1448 1448
                             $SETTINGS
1449 1449
                         );
1450 1450
 
1451 1451
                         // Do cleanup of files
1452
-                        unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted');
1452
+                        unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted');
1453 1453
 
1454 1454
                         // Update backup table
1455 1455
                         DB::update(
@@ -1475,13 +1475,13 @@  discard block
 block discarded – undo
1475 1475
                 // do some things for new object
1476 1476
                 if (isset($objects[0])) {
1477 1477
                     if ($objects[0] === 'logs') {
1478
-                        DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1478
+                        DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1479 1479
                     } elseif ($objects[0] === 'files') {
1480
-                        DB::query('SELECT id FROM ' . prefixTable('files'));
1480
+                        DB::query('SELECT id FROM '.prefixTable('files'));
1481 1481
                     } elseif ($objects[0] === 'categories') {
1482
-                        DB::query('SELECT id FROM ' . prefixTable('categories_items'));
1482
+                        DB::query('SELECT id FROM '.prefixTable('categories_items'));
1483 1483
                     } elseif ($objects[0] === 'custfields') {
1484
-                        DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1484
+                        DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification');
1485 1485
                     }
1486 1486
                     $nb_of_items = DB::count();
1487 1487
                 } else {
@@ -1600,12 +1600,12 @@  discard block
 block discarded – undo
1600 1600
                 );
1601 1601
             } elseif ($record['current_table'] === 'files') {
1602 1602
                 // restore backup file
1603
-                if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) {
1604
-                    unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']);
1605
-                    if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1603
+                if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) {
1604
+                    unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']);
1605
+                    if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1606 1606
                         rename(
1607
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'],
1608
-                            $SETTINGS['path_to_upload_folder'] . '/' . $record['value']
1607
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value2'],
1608
+                            $SETTINGS['path_to_upload_folder'].'/'.$record['value']
1609 1609
                         );
1610 1610
                     }
1611 1611
                 }
@@ -1616,15 +1616,15 @@  discard block
 block discarded – undo
1616 1616
 
1617 1617
         // restore saltkey file
1618 1618
         if (file_exists($previous_saltkey_filename)) {
1619
-            unlink(SECUREPATH . '/teampass-seckey.txt');
1619
+            unlink(SECUREPATH.'/teampass-seckey.txt');
1620 1620
             rename(
1621 1621
                 $previous_saltkey_filename,
1622
-                SECUREPATH . '/teampass-seckey.txt'
1622
+                SECUREPATH.'/teampass-seckey.txt'
1623 1623
             );
1624 1624
         }
1625 1625
 
1626 1626
         // drop table
1627
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1627
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1628 1628
 
1629 1629
         // Send back
1630 1630
         echo prepareExchangedData(
@@ -1667,17 +1667,17 @@  discard block
 block discarded – undo
1667 1667
         // delete files
1668 1668
         $rows = DB::query(
1669 1669
             'SELECT value, value2
1670
-            FROM ' . prefixTable('sk_reencrypt_backup') . "
1670
+            FROM ' . prefixTable('sk_reencrypt_backup')."
1671 1671
             WHERE current_table = 'files'"
1672 1672
         );
1673 1673
         foreach ($rows as $record) {
1674
-            if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) {
1675
-                unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']);
1674
+            if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) {
1675
+                unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']);
1676 1676
             }
1677 1677
         }
1678 1678
 
1679 1679
         // drop table
1680
-        DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup'));
1680
+        DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup'));
1681 1681
 
1682 1682
         echo '[{"status":"done"}]';
1683 1683
         break;
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
             );
1710 1710
             break;
1711 1711
         } else {
1712
-            require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1712
+            require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1713 1713
 
1714 1714
             //send email
1715 1715
             sendEmail(
@@ -1745,11 +1745,11 @@  discard block
 block discarded – undo
1745 1745
             break;
1746 1746
         }
1747 1747
 
1748
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1748
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1749 1749
 
1750 1750
         $rows = DB::query(
1751 1751
             'SELECT *
1752
-            FROM ' . prefixTable('emails') . '
1752
+            FROM ' . prefixTable('emails').'
1753 1753
             WHERE status = %s OR status = %s',
1754 1754
             'not_sent',
1755 1755
             ''
@@ -1834,9 +1834,9 @@  discard block
 block discarded – undo
1834 1834
             break;
1835 1835
         }
1836 1836
 
1837
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1837
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1838 1838
 
1839
-        $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', '');
1839
+        $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', '');
1840 1840
         foreach ($rows as $record) {
1841 1841
             //send email
1842 1842
             $ret = json_decode(
@@ -1904,7 +1904,7 @@  discard block
 block discarded – undo
1904 1904
             break;
1905 1905
         }
1906 1906
 
1907
-        require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1907
+        require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1908 1908
 
1909 1909
         // init
1910 1910
         $filesList = array();
@@ -1917,7 +1917,7 @@  discard block
 block discarded – undo
1917 1917
                 FROM ' . prefixTable('files')
1918 1918
             );
1919 1919
             foreach ($rows as $record) {
1920
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) {
1920
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) {
1921 1921
                     $addFile = false;
1922 1922
                     if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted')
1923 1923
                         || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear')
@@ -1982,8 +1982,8 @@  discard block
 block discarded – undo
1982 1982
         $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING);
1983 1983
         $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT);
1984 1984
 
1985
-        include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php';
1986
-        include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php';
1985
+        include $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
1986
+        include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
1987 1987
 
1988 1988
         $cpt = 0;
1989 1989
         $continu = true;
@@ -1991,15 +1991,15 @@  discard block
 block discarded – undo
1991 1991
         $message = '';
1992 1992
 
1993 1993
         // load PhpEncryption library
1994
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php';
1995
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php';
1996
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php';
1998
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php';
2000
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
-        include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php';
1994
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php';
1995
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php';
1996
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php';
1997
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php';
1998
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php';
1999
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php';
2000
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php';
2001
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php';
2002
+        include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php';
2003 2003
 
2004 2004
         // treat 10 files
2005 2005
         foreach ($post_list as $file) {
@@ -2007,35 +2007,35 @@  discard block
 block discarded – undo
2007 2007
                 // Get file name
2008 2008
                 $file_info = DB::queryfirstrow(
2009 2009
                     'SELECT file
2010
-                    FROM ' . prefixTable('files') . '
2010
+                    FROM ' . prefixTable('files').'
2011 2011
                     WHERE id = %i',
2012 2012
                     $file
2013 2013
                 );
2014 2014
 
2015 2015
                 // skip file is Coherancey not respected
2016
-                if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) {
2016
+                if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) {
2017 2017
                     // Case where we want to decrypt
2018 2018
                     if ($post_option === 'decrypt') {
2019 2019
                         prepareFileWithDefuse(
2020 2020
                             'decrypt',
2021
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2022
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2021
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2022
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2023 2023
                             $SETTINGS
2024 2024
                         );
2025 2025
                         // Case where we want to encrypt
2026 2026
                     } elseif ($post_option === 'encrypt') {
2027 2027
                         prepareFileWithDefuse(
2028 2028
                             'encrypt',
2029
-                            $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'],
2030
-                            $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2029
+                            $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'],
2030
+                            $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2031 2031
                             $SETTINGS
2032 2032
                         );
2033 2033
                     }
2034 2034
                     // Do file cleanup
2035
-                    fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS);
2035
+                    fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS);
2036 2036
                     rename(
2037
-                        $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'],
2038
-                        $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file']
2037
+                        $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'],
2038
+                        $SETTINGS['path_to_upload_folder'].'/'.$file_info['file']
2039 2039
                     );
2040 2040
 
2041 2041
                     // store in DB
@@ -2070,8 +2070,8 @@  discard block
 block discarded – undo
2070 2070
                 $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted'
2071 2071
             );
2072 2072
 
2073
-            $message = langHdl('last_execution') . ' ' .
2074
-                date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) .
2073
+            $message = langHdl('last_execution').' '.
2074
+                date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()).
2075 2075
                 '<i class="fas fa-check text-success ml-2 mr-3"></i>';
2076 2076
         }
2077 2077
 
@@ -2157,7 +2157,7 @@  discard block
 block discarded – undo
2157 2157
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2158 2158
 
2159 2159
             DB::query(
2160
-                'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i',
2160
+                'DELETE FROM '.prefixTable('api').' WHERE id = %i',
2161 2161
                 $post_id
2162 2162
             );
2163 2163
         }
@@ -2249,7 +2249,7 @@  discard block
 block discarded – undo
2249 2249
             // Delete existing key
2250 2250
         } elseif (null !== $post_action && $post_action === 'delete') {
2251 2251
             $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING);
2252
-            DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id);
2252
+            DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id);
2253 2253
         }
2254 2254
 
2255 2255
         echo prepareExchangedData(
@@ -2264,7 +2264,7 @@  discard block
 block discarded – undo
2264 2264
 
2265 2265
     case 'save_api_status':
2266 2266
         // Do query
2267
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api');
2267
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api');
2268 2268
         $counter = DB::count();
2269 2269
         if ($counter === 0) {
2270 2270
             DB::insert(
@@ -2290,7 +2290,7 @@  discard block
 block discarded – undo
2290 2290
         break;
2291 2291
 
2292 2292
     case 'save_duo_status':
2293
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2293
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo');
2294 2294
         $counter = DB::count();
2295 2295
         if ($counter === 0) {
2296 2296
             DB::insert(
@@ -2333,7 +2333,7 @@  discard block
 block discarded – undo
2333 2333
         foreach ($dataReceived as $key => $value) {
2334 2334
             DB::query(
2335 2335
                 'SELECT * 
2336
-                FROM ' . prefixTable('misc') . '
2336
+                FROM ' . prefixTable('misc').'
2337 2337
                 WHERE type = %s AND intitule = %s',
2338 2338
                 'admin',
2339 2339
                 $key
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
         } else {
2402 2402
             $tmp = 1;
2403 2403
         }
2404
-        DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2404
+        DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication');
2405 2405
         $counter = DB::count();
2406 2406
         if ($counter === 0) {
2407 2407
             DB::insert(
@@ -2427,7 +2427,7 @@  discard block
 block discarded – undo
2427 2427
 
2428 2428
         // ga_website_name
2429 2429
         if (is_null($dataReceived['ga_website_name']) === false) {
2430
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2430
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name');
2431 2431
             $counter = DB::count();
2432 2432
             if ($counter === 0) {
2433 2433
                 DB::insert(
@@ -2458,7 +2458,7 @@  discard block
 block discarded – undo
2458 2458
         }
2459 2459
 
2460 2460
         // send data
2461
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2461
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2462 2462
         break;
2463 2463
 
2464 2464
     case 'save_agses_options':
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
 
2482 2482
         // agses_hosted_url
2483 2483
         if (!is_null($dataReceived['agses_hosted_url'])) {
2484
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2484
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url');
2485 2485
             $counter = DB::count();
2486 2486
             if ($counter === 0) {
2487 2487
                 DB::insert(
@@ -2510,7 +2510,7 @@  discard block
 block discarded – undo
2510 2510
 
2511 2511
         // agses_hosted_id
2512 2512
         if (!is_null($dataReceived['agses_hosted_id'])) {
2513
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2513
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id');
2514 2514
             $counter = DB::count();
2515 2515
             if ($counter === 0) {
2516 2516
                 DB::insert(
@@ -2539,7 +2539,7 @@  discard block
 block discarded – undo
2539 2539
 
2540 2540
         // agses_hosted_apikey
2541 2541
         if (!is_null($dataReceived['agses_hosted_apikey'])) {
2542
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2542
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey');
2543 2543
             $counter = DB::count();
2544 2544
             if ($counter === 0) {
2545 2545
                 DB::insert(
@@ -2567,7 +2567,7 @@  discard block
 block discarded – undo
2567 2567
         }
2568 2568
 
2569 2569
         // send data
2570
-        echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]';
2570
+        echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]';
2571 2571
         break;
2572 2572
 
2573 2573
     case 'save_option_change':
@@ -2603,7 +2603,7 @@  discard block
 block discarded – undo
2603 2603
 
2604 2604
         // Check if setting is already in DB. If NO then insert, if YES then update.
2605 2605
         $data = DB::query(
2606
-            'SELECT * FROM ' . prefixTable('misc') . '
2606
+            'SELECT * FROM '.prefixTable('misc').'
2607 2607
             WHERE type = %s AND intitule = %s',
2608 2608
             $type,
2609 2609
             $dataReceived['field']
@@ -2625,7 +2625,7 @@  discard block
 block discarded – undo
2625 2625
                     array(
2626 2626
                         'valeur' => time(),
2627 2627
                         'type' => $type,
2628
-                        'intitule' => $dataReceived['field'] . '_time',
2628
+                        'intitule' => $dataReceived['field'].'_time',
2629 2629
                     )
2630 2630
                 );
2631 2631
             }
@@ -2643,10 +2643,10 @@  discard block
 block discarded – undo
2643 2643
             if ($dataReceived['field'] === 'send_stats') {
2644 2644
                 // Check if previous time exists, if not them insert this value in DB
2645 2645
                 DB::query(
2646
-                    'SELECT * FROM ' . prefixTable('misc') . '
2646
+                    'SELECT * FROM '.prefixTable('misc').'
2647 2647
                     WHERE type = %s AND intitule = %s',
2648 2648
                     $type,
2649
-                    $dataReceived['field'] . '_time'
2649
+                    $dataReceived['field'].'_time'
2650 2650
                 );
2651 2651
                 $counter = DB::count();
2652 2652
                 if ($counter === 0) {
@@ -2655,7 +2655,7 @@  discard block
 block discarded – undo
2655 2655
                         array(
2656 2656
                             'valeur' => 0,
2657 2657
                             'type' => $type,
2658
-                            'intitule' => $dataReceived['field'] . '_time',
2658
+                            'intitule' => $dataReceived['field'].'_time',
2659 2659
                         )
2660 2660
                     );
2661 2661
                 } else {
@@ -2675,13 +2675,13 @@  discard block
 block discarded – undo
2675 2675
         // special Cases
2676 2676
         if ($dataReceived['field'] === 'cpassman_url') {
2677 2677
             // update also jsUrl for CSFP protection
2678
-            $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js';
2678
+            $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js';
2679 2679
             $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php';
2680 2680
             $data = file_get_contents($csrfp_file);
2681 2681
             $posJsUrl = strpos($data, '"jsUrl" => "');
2682 2682
             $posEndLine = strpos($data, '",', $posJsUrl);
2683 2683
             $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2));
2684
-            $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data);
2684
+            $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data);
2685 2685
             file_put_contents($csrfp_file, $newdata);
2686 2686
         } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') {
2687 2687
             DB::update(
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
         echo prepareExchangedData(
2706 2706
             array(
2707 2707
                 'error' => false,
2708
-                'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']],
2708
+                'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']],
2709 2709
             ),
2710 2710
             'encode'
2711 2711
         );
@@ -2747,7 +2747,7 @@  discard block
 block discarded – undo
2747 2747
 
2748 2748
         // send statistics
2749 2749
         if (null !== $post_status) {
2750
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2750
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats');
2751 2751
             $counter = DB::count();
2752 2752
             if ($counter === 0) {
2753 2753
                 DB::insert(
@@ -2779,7 +2779,7 @@  discard block
 block discarded – undo
2779 2779
 
2780 2780
         // send statistics items
2781 2781
         if (null !== $post_list) {
2782
-            DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2782
+            DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items');
2783 2783
             $counter = DB::count();
2784 2784
             if ($counter === 0) {
2785 2785
                 DB::insert(
@@ -2826,7 +2826,7 @@  discard block
 block discarded – undo
2826 2826
             break;
2827 2827
         }
2828 2828
 
2829
-        if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) {
2829
+        if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) {
2830 2830
             if (DB::count() === 1) {
2831 2831
                 echo 1;
2832 2832
             } else {
@@ -2864,7 +2864,7 @@  discard block
 block discarded – undo
2864 2864
 
2865 2865
         $rows = DB::query(
2866 2866
             'SELECT id, title
2867
-                FROM ' . prefixTable('roles_title') . '
2867
+                FROM ' . prefixTable('roles_title').'
2868 2868
                 ORDER BY title ASC'
2869 2869
         );
2870 2870
         foreach ($rows as $record) {
Please login to merge, or discard this patch.