@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ) { |
69 | 69 | // Not allowed page |
70 | 70 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
71 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
71 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
72 | 72 | exit; |
73 | 73 | } |
74 | 74 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | } else { |
116 | 116 | // check if token is expired |
117 | 117 | $data = DB::queryFirstRow( |
118 | - 'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s', |
|
118 | + 'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s', |
|
119 | 119 | $session->get('user-id'), |
120 | 120 | $post_user_token |
121 | 121 | ); |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | |
140 | 140 | // HTTP headers for no cache etc |
141 | 141 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
142 | -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
142 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
143 | 143 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
144 | 144 | header('Cache-Control: post-check=0, pre-check=0', false); |
145 | 145 | |
146 | 146 | if (null !== $post_type_upload && $post_type_upload === 'upload_profile_photo') { |
147 | - $targetDir = $SETTINGS['cpassman_dir'] . '/includes/avatars'; |
|
147 | + $targetDir = $SETTINGS['cpassman_dir'].'/includes/avatars'; |
|
148 | 148 | } else { |
149 | 149 | $targetDir = $SETTINGS['path_to_files_folder']; |
150 | 150 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | // Validate file name (for our purposes we'll just remove invalid characters) |
207 | 207 | $file_name = preg_replace( |
208 | - '/[^' . $valid_chars_regex . '\.]/', |
|
208 | + '/[^'.$valid_chars_regex.'\.]/', |
|
209 | 209 | '', |
210 | 210 | filter_var( |
211 | 211 | strtolower(basename($_FILES['file']['name'])), |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | ) |
214 | 214 | ); |
215 | 215 | if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { |
216 | - handleUploadError('Invalid file name: ' . $file_name . '.'); |
|
216 | + handleUploadError('Invalid file name: '.$file_name.'.'); |
|
217 | 217 | return false; |
218 | 218 | } |
219 | 219 | |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $ext, |
229 | 229 | explode( |
230 | 230 | ',', |
231 | - $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] . |
|
232 | - ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext'] |
|
231 | + $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext']. |
|
232 | + ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext'] |
|
233 | 233 | ) |
234 | 234 | ) === false |
235 | 235 | && $post_type_upload !== 'import_items_from_keepass' |
@@ -242,28 +242,28 @@ discard block |
||
242 | 242 | |
243 | 243 | // is destination folder writable |
244 | 244 | if (is_writable($SETTINGS['path_to_files_folder']) === false) { |
245 | - handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
245 | + handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.'); |
|
246 | 246 | return false; |
247 | 247 | } |
248 | 248 | |
249 | 249 | // Clean the fileName for security reasons |
250 | 250 | $fileName = preg_replace('/[^\w\.]+/', '_', $fileName); |
251 | -$fileName = preg_replace('/[^' . $valid_chars_regex . '\.]/', '', strtolower(basename($fileName))); |
|
251 | +$fileName = preg_replace('/[^'.$valid_chars_regex.'\.]/', '', strtolower(basename($fileName))); |
|
252 | 252 | |
253 | 253 | // Make sure the fileName is unique but only if chunking is disabled |
254 | -if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) { |
|
254 | +if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) { |
|
255 | 255 | $fileNameA = substr($fileName, 0, strlen($ext)); |
256 | 256 | $fileNameB = substr($fileName, strlen($ext)); |
257 | 257 | |
258 | 258 | $count = 1; |
259 | - while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) { |
|
259 | + while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) { |
|
260 | 260 | ++$count; |
261 | 261 | } |
262 | 262 | |
263 | - $fileName = $fileNameA . '_' . $count . $fileNameB; |
|
263 | + $fileName = $fileNameA.'_'.$count.$fileNameB; |
|
264 | 264 | } |
265 | 265 | |
266 | -$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName; |
|
266 | +$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName; |
|
267 | 267 | |
268 | 268 | // Create target dir |
269 | 269 | if (!file_exists($targetDir)) { |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | // Remove old temp files |
278 | 278 | if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) { |
279 | 279 | while (($file = readdir($dir)) !== false) { |
280 | - $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file; |
|
280 | + $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file; |
|
281 | 281 | |
282 | 282 | // Remove temp file if it is older than the max age and is not the current file |
283 | 283 | if ( |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ) { |
374 | 374 | rename( |
375 | 375 | $filePath, |
376 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
376 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
377 | 377 | ); |
378 | 378 | |
379 | 379 | // Add in DB |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | ) { |
403 | 403 | rename( |
404 | 404 | $filePath, |
405 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
405 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
406 | 406 | ); |
407 | 407 | |
408 | 408 | // Add in DB |
@@ -435,13 +435,13 @@ discard block |
||
435 | 435 | // rename the file |
436 | 436 | rename( |
437 | 437 | $filePath, |
438 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext |
|
438 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext |
|
439 | 439 | ); |
440 | 440 | |
441 | 441 | // make thumbnail |
442 | 442 | $ret = makeThumbnail( |
443 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext, |
|
444 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext, |
|
443 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext, |
|
444 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext, |
|
445 | 445 | 40 |
446 | 446 | ); |
447 | 447 | |
@@ -452,21 +452,21 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | // get current avatar and delete it |
455 | - $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $session->get('user-id')); |
|
456 | - fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS); |
|
457 | - fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS); |
|
455 | + $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $session->get('user-id')); |
|
456 | + fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS); |
|
457 | + fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS); |
|
458 | 458 | |
459 | 459 | // store in DB the new avatar |
460 | 460 | DB::query( |
461 | - 'UPDATE ' . prefixTable('users') . " |
|
462 | - SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "' |
|
461 | + 'UPDATE '.prefixTable('users')." |
|
462 | + SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."' |
|
463 | 463 | WHERE id=%i", |
464 | 464 | $session->get('user-id') |
465 | 465 | ); |
466 | 466 | |
467 | 467 | // store in session |
468 | - $session->set('user-avatar', $newFileName . '.' . $ext); |
|
469 | - $session->set('user-avatar_thumb', $newFileName . '_thumb' . '.' . $ext); |
|
468 | + $session->set('user-avatar', $newFileName.'.'.$ext); |
|
469 | + $session->set('user-avatar_thumb', $newFileName.'_thumb'.'.'.$ext); |
|
470 | 470 | |
471 | 471 | // return info |
472 | 472 | echo prepareExchangedData( |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | ) { |
486 | 486 | rename( |
487 | 487 | $filePath, |
488 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
488 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
489 | 489 | ); |
490 | 490 | |
491 | 491 | // Add in DB |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | ); |
82 | 82 | $db_link->set_charset(DB_ENCODING); |
83 | 83 | } else { |
84 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
85 | - echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
84 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
85 | + echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
86 | 86 | mysqli_close($db_link); |
87 | 87 | exit(); |
88 | 88 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | $users = mysqli_query( |
108 | 108 | $db_link, |
109 | 109 | 'SELECT id |
110 | - FROM ' . $pre . 'users |
|
110 | + FROM ' . $pre.'users |
|
111 | 111 | WHERE (public_key = "none" OR public_key = "" OR public_key IS NULL) |
112 | - AND id NOT IN (' . OTV_USER_ID . ',' . SSH_USER_ID . ',' . API_USER_ID . ')' |
|
112 | + AND id NOT IN (' . OTV_USER_ID.','.SSH_USER_ID.','.API_USER_ID.')' |
|
113 | 113 | ); |
114 | 114 | while ($user = mysqli_fetch_array($users)) { |
115 | 115 | array_push($listOfUsers, $user['id']); |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | if ((int) $post_tp_user === 0) { |
128 | 128 | // Create TP USER |
129 | 129 | require_once '../includes/config/include.php'; |
130 | - $tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "users` WHERE id = '" . TP_USER_ID . "'")); |
|
130 | + $tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."users` WHERE id = '".TP_USER_ID."'")); |
|
131 | 131 | if (intval($tmp) === 0) { |
132 | 132 | // generate key for password |
133 | 133 | $pwd = GenerateCryptKey(25, true, true, true, true); |
134 | - $salt = file_get_contents(SECUREPATH . '/' . SECUREFILE); |
|
134 | + $salt = file_get_contents(SECUREPATH.'/'.SECUREFILE); |
|
135 | 135 | $encrypted_pwd = cryption( |
136 | 136 | $pwd, |
137 | 137 | $salt, |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // Store |
145 | 145 | $mysqli_result = mysqli_query( |
146 | 146 | $db_link, |
147 | - "INSERT INTO `" . $pre . "users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`, `fonction_id`, `groupes_interdits`, `last_connexion`, `gestionnaire`, `email`, `favourites`, `latest_items`, `personal_folder`, `public_key`, `private_key`, `is_ready_for_usage`, `otp_provided`) VALUES ('" . TP_USER_ID . "', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', '1', '1')" |
|
147 | + "INSERT INTO `".$pre."users` (`id`, `login`, `pw`, `groupes_visibles`, `derniers`, `key_tempo`, `last_pw_change`, `last_pw`, `admin`, `fonction_id`, `groupes_interdits`, `last_connexion`, `gestionnaire`, `email`, `favourites`, `latest_items`, `personal_folder`, `public_key`, `private_key`, `is_ready_for_usage`, `otp_provided`) VALUES ('".TP_USER_ID."', 'TP', '".$encrypted_pwd."', '', '', '', '', '', '1', '', '', '', '0', '', '', '', '0', '".$userKeys['public_key']."', '".$userKeys['private_key']."', '1', '1')" |
|
148 | 148 | ); |
149 | 149 | } |
150 | 150 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | mysqli_query( |
153 | 153 | $db_link, |
154 | 154 | 'SELECT count(*) |
155 | - FROM ' . $pre . 'sharekeys_items |
|
155 | + FROM ' . $pre.'sharekeys_items |
|
156 | 156 | WHERE user_id = ' . (int) TP_USER_ID |
157 | 157 | ) |
158 | 158 | ); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | mysqli_query( |
163 | 163 | $db_link, |
164 | 164 | 'SELECT pw, public_key, private_key, name, lastname, login |
165 | - FROM ' . $pre . 'users |
|
165 | + FROM ' . $pre.'users |
|
166 | 166 | WHERE id = ' . (int) TP_USER_ID |
167 | 167 | ) |
168 | 168 | ); |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | ); |
179 | 179 | |
180 | 180 | // Return |
181 | - echo '[{"finish":"0" , "next":"step1", "error":"" , "data" : "' . base64_encode(json_encode($usersArray)) . '" , "number":"1" , "loop_finished" : "' . (count($listOfUsers) === 0 ? "true" : "false") . '" , "rest" : "' . base64_encode(json_encode($listOfUsers)) . '"}]'; |
|
181 | + echo '[{"finish":"0" , "next":"step1", "error":"" , "data" : "'.base64_encode(json_encode($usersArray)).'" , "number":"1" , "loop_finished" : "'.(count($listOfUsers) === 0 ? "true" : "false").'" , "rest" : "'.base64_encode(json_encode($listOfUsers)).'"}]'; |
|
182 | 182 | |
183 | 183 | exit(); |
184 | 184 | } |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | mysqli_query( |
192 | 192 | $db_link, |
193 | 193 | 'SELECT pw, public_key, private_key, name, lastname, login |
194 | - FROM ' . $pre . 'users |
|
194 | + FROM ' . $pre.'users |
|
195 | 195 | WHERE id = ' . (int) $post_number |
196 | 196 | ) |
197 | 197 | ); |
@@ -221,9 +221,9 @@ discard block |
||
221 | 221 | // Store |
222 | 222 | mysqli_query( |
223 | 223 | $db_link, |
224 | - 'UPDATE ' . $pre . "users |
|
225 | - SET public_key = '" . $userKeys['public_key'] . "', |
|
226 | - private_key = '" . $userKeys['private_key'] . "', |
|
224 | + 'UPDATE '.$pre."users |
|
225 | + SET public_key = '" . $userKeys['public_key']."', |
|
226 | + private_key = '" . $userKeys['private_key']."', |
|
227 | 227 | upgrade_needed = 1, |
228 | 228 | special = 'otc_is_required_on_next_login' |
229 | 229 | WHERE id = " . $post_number |
@@ -233,31 +233,31 @@ discard block |
||
233 | 233 | mysqli_query( |
234 | 234 | $db_link, |
235 | 235 | 'DELETE |
236 | - FROM ' . $pre . 'sharekeys_items |
|
236 | + FROM ' . $pre.'sharekeys_items |
|
237 | 237 | WHERE user_id = ' . (int) $userInfo['id'] |
238 | 238 | ); |
239 | 239 | mysqli_query( |
240 | 240 | $db_link, |
241 | 241 | 'DELETE |
242 | - FROM ' . $pre . 'sharekeys_logs |
|
242 | + FROM ' . $pre.'sharekeys_logs |
|
243 | 243 | WHERE user_id = ' . (int) $userInfo['id'] |
244 | 244 | ); |
245 | 245 | mysqli_query( |
246 | 246 | $db_link, |
247 | 247 | 'DELETE |
248 | - FROM ' . $pre . 'sharekeys_fields |
|
248 | + FROM ' . $pre.'sharekeys_fields |
|
249 | 249 | WHERE user_id = ' . (int) $userInfo['id'] |
250 | 250 | ); |
251 | 251 | mysqli_query( |
252 | 252 | $db_link, |
253 | 253 | 'DELETE |
254 | - FROM ' . $pre . 'sharekeys_suggestions |
|
254 | + FROM ' . $pre.'sharekeys_suggestions |
|
255 | 255 | WHERE user_id = ' . (int) $userInfo['id'] |
256 | 256 | ); |
257 | 257 | mysqli_query( |
258 | 258 | $db_link, |
259 | 259 | 'DELETE |
260 | - FROM ' . $pre . 'sharekeys_files |
|
260 | + FROM ' . $pre.'sharekeys_files |
|
261 | 261 | WHERE user_id = ' . (int) $userInfo['id'] |
262 | 262 | ); |
263 | 263 | |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | // Return |
276 | - echo '[{"finish":"0" , "next":"step1", "error":"" , "data" : "' . base64_encode(json_encode($usersArray)) . '" , "number":"' . ((int) $post_number + 1) . '" , "loop_finished" : "' . (count($listOfUsers) === 0 ? "true" : "false") . '" , "rest" : "' . base64_encode(json_encode($listOfUsers)) . '"}]'; |
|
276 | + echo '[{"finish":"0" , "next":"step1", "error":"" , "data" : "'.base64_encode(json_encode($usersArray)).'" , "number":"'.((int) $post_number + 1).'" , "loop_finished" : "'.(count($listOfUsers) === 0 ? "true" : "false").'" , "rest" : "'.base64_encode(json_encode($listOfUsers)).'"}]'; |
|
277 | 277 | } else { |
278 | 278 | // No more user to treat |
279 | - echo '[{"finish":"0" , "next":"step2", "error":"" , "data" : "" , "number":"' . (empty($post_number) === true ? 0 : $post_number) . '" , "loop_finished" : "true" , "rest" : ""}]'; |
|
279 | + echo '[{"finish":"0" , "next":"step2", "error":"" , "data" : "" , "number":"'.(empty($post_number) === true ? 0 : $post_number).'" , "loop_finished" : "true" , "rest" : ""}]'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | exit(); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | |
298 | 298 | if ($userInfo['public_key'] === null) { |
299 | 299 | if ($userInfo['id'] !== TP_USER_ID) { |
300 | - echo '[{"finish":"1" , "next":"step3", "error":"Public key is null; provided key is '.$post_user_info.'" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
300 | + echo '[{"finish":"1" , "next":"step3", "error":"Public key is null; provided key is '.$post_user_info.'" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
301 | 301 | exit(); |
302 | 302 | break; |
303 | 303 | } else { |
@@ -306,16 +306,16 @@ discard block |
||
306 | 306 | mysqli_query( |
307 | 307 | $db_link, |
308 | 308 | 'SELECT pw, public_key, private_key, name, lastname, login |
309 | - FROM ' . $pre . 'users |
|
309 | + FROM ' . $pre.'users |
|
310 | 310 | WHERE id = ' . TP_USER_ID |
311 | 311 | ) |
312 | 312 | ); |
313 | 313 | |
314 | - $userInfo['public_key'] == $userQuery['public_key']; |
|
315 | - $userInfo['private_key'] == $userQuery['private_key']; |
|
316 | - $userInfo['login'] == $userQuery['login']; |
|
317 | - $userInfo['name'] == $userQuery['name']; |
|
318 | - $userInfo['lastname'] == $userQuery['lastname']; |
|
314 | + $userInfo['public_key'] == $userQuery['public_key']; |
|
315 | + $userInfo['private_key'] == $userQuery['private_key']; |
|
316 | + $userInfo['login'] == $userQuery['login']; |
|
317 | + $userInfo['name'] == $userQuery['name']; |
|
318 | + $userInfo['lastname'] == $userQuery['lastname']; |
|
319 | 319 | } |
320 | 320 | } |
321 | 321 | |
@@ -327,13 +327,13 @@ discard block |
||
327 | 327 | mysqli_query( |
328 | 328 | $db_link, |
329 | 329 | 'SELECT private_key |
330 | - FROM ' . $pre . 'users |
|
330 | + FROM ' . $pre.'users |
|
331 | 331 | WHERE id = ' . (int) $adminId |
332 | 332 | ) |
333 | 333 | ); |
334 | 334 | $adminPrivateKey = decryptPrivateKey($adminPwd, $adminQuery['private_key']); |
335 | 335 | if ($adminPrivateKey === false) { |
336 | - echo '[{"finish":"1" , "next":"step3", "error":"Admin PWD is null; provided key is '.$post_admin_info[1].'" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
336 | + echo '[{"finish":"1" , "next":"step3", "error":"Admin PWD is null; provided key is '.$post_admin_info[1].'" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
337 | 337 | exit(); |
338 | 338 | break; |
339 | 339 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | mysqli_query( |
344 | 344 | $db_link, |
345 | 345 | 'SELECT count(*) |
346 | - FROM ' . $pre . 'items |
|
346 | + FROM ' . $pre.'items |
|
347 | 347 | WHERE perso = 0' |
348 | 348 | ) |
349 | 349 | ); |
@@ -355,9 +355,9 @@ discard block |
||
355 | 355 | $rows = mysqli_query( |
356 | 356 | $db_link, |
357 | 357 | 'SELECT id, pw, encryption_type |
358 | - FROM ' . $pre . 'items |
|
358 | + FROM ' . $pre.'items |
|
359 | 359 | WHERE perso = 0 |
360 | - LIMIT ' . $post_start . ', ' . $post_count_in_loop |
|
360 | + LIMIT ' . $post_start.', '.$post_count_in_loop |
|
361 | 361 | ); |
362 | 362 | |
363 | 363 | while ($item = mysqli_fetch_array($rows)) { |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | mysqli_query( |
367 | 367 | $db_link, |
368 | 368 | 'SELECT share_key |
369 | - FROM ' . $pre . 'sharekeys_items |
|
370 | - WHERE object_id = ' . (int) $item['id'] . ' AND user_id = ' . (int) $adminId |
|
369 | + FROM ' . $pre.'sharekeys_items |
|
370 | + WHERE object_id = ' . (int) $item['id'].' AND user_id = '.(int) $adminId |
|
371 | 371 | ) |
372 | 372 | ); |
373 | 373 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | mysqli_query( |
382 | 382 | $db_link, |
383 | 383 | 'SELECT public_key |
384 | - FROM ' . $pre . 'users |
|
384 | + FROM ' . $pre.'users |
|
385 | 385 | WHERE id = ' . (int) $userInfo['id'] |
386 | 386 | ) |
387 | 387 | ); |
@@ -394,15 +394,15 @@ discard block |
||
394 | 394 | // Save the key in DB |
395 | 395 | mysqli_query( |
396 | 396 | $db_link, |
397 | - 'INSERT INTO `' . $pre . 'sharekeys_items`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
398 | - VALUES (NULL,' . (int) $item['id'] . ',' . (int) $userInfo['id'] . ",'" . $share_key_for_item . "')" |
|
397 | + 'INSERT INTO `'.$pre.'sharekeys_items`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
398 | + VALUES (NULL,' . (int) $item['id'].','.(int) $userInfo['id'].",'".$share_key_for_item."')" |
|
399 | 399 | ); |
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
403 | - echo '[{"finish":"0" , "next":"step2", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "false"}]'; |
|
403 | + echo '[{"finish":"0" , "next":"step2", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "false"}]'; |
|
404 | 404 | } else { |
405 | - echo '[{"finish":"0" , "next":"step3", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
405 | + echo '[{"finish":"0" , "next":"step3", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | exit(); |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | mysqli_query( |
430 | 430 | $db_link, |
431 | 431 | 'SELECT private_key |
432 | - FROM ' . $pre . 'users |
|
432 | + FROM ' . $pre.'users |
|
433 | 433 | WHERE id = ' . (int) $adminId |
434 | 434 | ) |
435 | 435 | ); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | mysqli_query( |
441 | 441 | $db_link, |
442 | 442 | 'SELECT increment_id |
443 | - FROM ' . $pre . "log_items |
|
443 | + FROM ' . $pre."log_items |
|
444 | 444 | WHERE raison LIKE 'at_pw :%' AND encryption_type = 'teampass_aes'" |
445 | 445 | ) |
446 | 446 | ); |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | $rows = mysqli_query( |
453 | 453 | $db_link, |
454 | 454 | 'SELECT increment_id |
455 | - FROM ' . $pre . "log_items |
|
455 | + FROM ' . $pre."log_items |
|
456 | 456 | WHERE raison LIKE 'at_pw :%' AND encryption_type = 'teampass_aes' |
457 | - LIMIT " . $post_start . ', ' . $post_count_in_loop |
|
457 | + LIMIT " . $post_start.', '.$post_count_in_loop |
|
458 | 458 | ); |
459 | 459 | |
460 | 460 | while ($item = mysqli_fetch_array($rows)) { |
@@ -463,8 +463,8 @@ discard block |
||
463 | 463 | mysqli_query( |
464 | 464 | $db_link, |
465 | 465 | 'SELECT share_key |
466 | - FROM ' . $pre . 'sharekeys_logs |
|
467 | - WHERE object_id = ' . (int) $item['id'] . ' AND user_id = ' . (int) $adminId |
|
466 | + FROM ' . $pre.'sharekeys_logs |
|
467 | + WHERE object_id = ' . (int) $item['id'].' AND user_id = '.(int) $adminId |
|
468 | 468 | ) |
469 | 469 | ); |
470 | 470 | |
@@ -478,15 +478,15 @@ discard block |
||
478 | 478 | // Save the key in DB |
479 | 479 | mysqli_query( |
480 | 480 | $db_link, |
481 | - 'INSERT INTO `' . $pre . 'sharekeys_logs`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
482 | - VALUES (NULL,' . (int) $item['id'] . ',' . (int) $userInfo['id'] . ",'" . $share_key_for_item . "')" |
|
481 | + 'INSERT INTO `'.$pre.'sharekeys_logs`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
482 | + VALUES (NULL,' . (int) $item['id'].','.(int) $userInfo['id'].",'".$share_key_for_item."')" |
|
483 | 483 | ); |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | - echo '[{"finish":"0" , "next":"step3", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "false"}]'; |
|
487 | + echo '[{"finish":"0" , "next":"step3", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "false"}]'; |
|
488 | 488 | } else { |
489 | - echo '[{"finish":"0" , "next":"step4", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
489 | + echo '[{"finish":"0" , "next":"step4", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
490 | 490 | } |
491 | 491 | |
492 | 492 | exit(); |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | mysqli_query( |
514 | 514 | $db_link, |
515 | 515 | 'SELECT private_key |
516 | - FROM ' . $pre . 'users |
|
516 | + FROM ' . $pre.'users |
|
517 | 517 | WHERE id = ' . (int) $adminId |
518 | 518 | ) |
519 | 519 | ); |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | mysqli_query( |
525 | 525 | $db_link, |
526 | 526 | 'SELECT id |
527 | - FROM ' . $pre . 'categories_items' |
|
527 | + FROM ' . $pre.'categories_items' |
|
528 | 528 | ) |
529 | 529 | ); |
530 | 530 | |
@@ -533,9 +533,9 @@ discard block |
||
533 | 533 | $rows = mysqli_query( |
534 | 534 | $db_link, |
535 | 535 | 'SELECT id, data, encryption_type |
536 | - FROM ' . $pre . 'categories_items |
|
537 | - WHERE encryption_type = "' . TP_ENCRYPTION_NAME . '" |
|
538 | - LIMIT ' . $post_start . ', ' . $post_count_in_loop |
|
536 | + FROM ' . $pre.'categories_items |
|
537 | + WHERE encryption_type = "' . TP_ENCRYPTION_NAME.'" |
|
538 | + LIMIT ' . $post_start.', '.$post_count_in_loop |
|
539 | 539 | ); |
540 | 540 | |
541 | 541 | while ($item = mysqli_fetch_array($rows)) { |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | mysqli_query( |
545 | 545 | $db_link, |
546 | 546 | 'SELECT share_key |
547 | - FROM ' . $pre . 'sharekeys_fields |
|
548 | - WHERE object_id = ' . (int) $item['id'] . ' AND user_id = ' . (int) $adminId |
|
547 | + FROM ' . $pre.'sharekeys_fields |
|
548 | + WHERE object_id = ' . (int) $item['id'].' AND user_id = '.(int) $adminId |
|
549 | 549 | ) |
550 | 550 | ); |
551 | 551 | |
@@ -559,15 +559,15 @@ discard block |
||
559 | 559 | // Save the key in DB |
560 | 560 | mysqli_query( |
561 | 561 | $db_link, |
562 | - 'INSERT INTO `' . $pre . 'sharekeys_fields`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
563 | - VALUES (NULL,' . (int) $item['id'] . ',' . (int) $userInfo['id'] . ",'" . $share_key_for_item . "')" |
|
562 | + 'INSERT INTO `'.$pre.'sharekeys_fields`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
563 | + VALUES (NULL,' . (int) $item['id'].','.(int) $userInfo['id'].",'".$share_key_for_item."')" |
|
564 | 564 | ); |
565 | 565 | } |
566 | 566 | } |
567 | 567 | |
568 | - echo '[{"finish":"0" , "next":"step4", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "false"}]'; |
|
568 | + echo '[{"finish":"0" , "next":"step4", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "false"}]'; |
|
569 | 569 | } else { |
570 | - echo '[{"finish":"0" , "next":"step5", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
570 | + echo '[{"finish":"0" , "next":"step5", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | exit(); |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | mysqli_query( |
595 | 595 | $db_link, |
596 | 596 | 'SELECT private_key |
597 | - FROM ' . $pre . 'users |
|
597 | + FROM ' . $pre.'users |
|
598 | 598 | WHERE id = ' . (int) $adminId |
599 | 599 | ) |
600 | 600 | ); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | mysqli_query( |
606 | 606 | $db_link, |
607 | 607 | 'SELECT id |
608 | - FROM ' . $pre . 'suggestion' |
|
608 | + FROM ' . $pre.'suggestion' |
|
609 | 609 | ) |
610 | 610 | ); |
611 | 611 | |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | $rows = mysqli_query( |
617 | 617 | $db_link, |
618 | 618 | 'SELECT id |
619 | - FROM ' . $pre . 'suggestion |
|
620 | - LIMIT ' . $post_start . ', ' . $post_count_in_loop |
|
619 | + FROM ' . $pre.'suggestion |
|
620 | + LIMIT ' . $post_start.', '.$post_count_in_loop |
|
621 | 621 | ); |
622 | 622 | |
623 | 623 | while ($item = mysqli_fetch_array($rows)) { |
@@ -626,8 +626,8 @@ discard block |
||
626 | 626 | mysqli_query( |
627 | 627 | $db_link, |
628 | 628 | 'SELECT share_key |
629 | - FROM ' . $pre . 'sharekeys_suggestions |
|
630 | - WHERE object_id = ' . (int) $item['id'] . ' AND user_id = ' . (int) $adminId |
|
629 | + FROM ' . $pre.'sharekeys_suggestions |
|
630 | + WHERE object_id = ' . (int) $item['id'].' AND user_id = '.(int) $adminId |
|
631 | 631 | ) |
632 | 632 | ); |
633 | 633 | |
@@ -647,15 +647,15 @@ discard block |
||
647 | 647 | // Save the key in DB |
648 | 648 | mysqli_query( |
649 | 649 | $db_link, |
650 | - 'INSERT INTO `' . $pre . 'sharekeys_suggestions`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
651 | - VALUES (NULL,' . (int) $item['id'] . ',' . (int) $userInfo['id'] . ",'" . $share_key_for_item . "')" |
|
650 | + 'INSERT INTO `'.$pre.'sharekeys_suggestions`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
651 | + VALUES (NULL,' . (int) $item['id'].','.(int) $userInfo['id'].",'".$share_key_for_item."')" |
|
652 | 652 | ); |
653 | 653 | } |
654 | 654 | } |
655 | 655 | |
656 | - echo '[{"finish":"0" , "next":"step5", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "false"}]'; |
|
656 | + echo '[{"finish":"0" , "next":"step5", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "false"}]'; |
|
657 | 657 | } else { |
658 | - echo '[{"finish":"0" , "next":"step6", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
658 | + echo '[{"finish":"0" , "next":"step6", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
659 | 659 | } |
660 | 660 | |
661 | 661 | exit(); |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | mysqli_query( |
683 | 683 | $db_link, |
684 | 684 | 'SELECT private_key |
685 | - FROM ' . $pre . 'users |
|
685 | + FROM ' . $pre.'users |
|
686 | 686 | WHERE id = ' . (int) $adminId |
687 | 687 | ) |
688 | 688 | ); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | mysqli_query( |
694 | 694 | $db_link, |
695 | 695 | 'SELECT id |
696 | - FROM ' . $pre . 'files' |
|
696 | + FROM ' . $pre.'files' |
|
697 | 697 | ) |
698 | 698 | ); |
699 | 699 | |
@@ -702,9 +702,9 @@ discard block |
||
702 | 702 | $rows = mysqli_query( |
703 | 703 | $db_link, |
704 | 704 | 'SELECT id |
705 | - FROM ' . $pre . 'files |
|
706 | - WHERE status = "' . TP_ENCRYPTION_NAME . '" |
|
707 | - LIMIT ' . $post_start . ', ' . $post_count_in_loop |
|
705 | + FROM ' . $pre.'files |
|
706 | + WHERE status = "' . TP_ENCRYPTION_NAME.'" |
|
707 | + LIMIT ' . $post_start.', '.$post_count_in_loop |
|
708 | 708 | ); |
709 | 709 | |
710 | 710 | while ($item = mysqli_fetch_array($rows)) { |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | mysqli_query( |
714 | 714 | $db_link, |
715 | 715 | 'SELECT share_key |
716 | - FROM ' . $pre . 'sharekeys_files |
|
717 | - WHERE object_id = ' . (int) $item['id'] . ' AND user_id = ' . (int) $adminId |
|
716 | + FROM ' . $pre.'sharekeys_files |
|
717 | + WHERE object_id = ' . (int) $item['id'].' AND user_id = '.(int) $adminId |
|
718 | 718 | ) |
719 | 719 | ); |
720 | 720 | |
@@ -734,15 +734,15 @@ discard block |
||
734 | 734 | // Save the key in DB |
735 | 735 | mysqli_query( |
736 | 736 | $db_link, |
737 | - 'INSERT INTO `' . $pre . 'sharekeys_files`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
738 | - VALUES (NULL,' . (int) $item['id'] . ',' . (int) $userInfo['id'] . ",'" . $share_key_for_item . "')" |
|
737 | + 'INSERT INTO `'.$pre.'sharekeys_files`(`increment_id`, `object_id`, `user_id`, `share_key`) |
|
738 | + VALUES (NULL,' . (int) $item['id'].','.(int) $userInfo['id'].",'".$share_key_for_item."')" |
|
739 | 739 | ); |
740 | 740 | } |
741 | 741 | } |
742 | 742 | |
743 | - echo '[{"finish":"0" , "next":"step6", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "false"}]'; |
|
743 | + echo '[{"finish":"0" , "next":"step6", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "false"}]'; |
|
744 | 744 | } else { |
745 | - echo '[{"finish":"0" , "next":"nextUser", "error":"" , "data" : "" , "number":"' . $post_number . '" , "loop_finished" : "true"}]'; |
|
745 | + echo '[{"finish":"0" , "next":"nextUser", "error":"" , "data" : "" , "number":"'.$post_number.'" , "loop_finished" : "true"}]'; |
|
746 | 746 | } |
747 | 747 | |
748 | 748 | exit(); |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | mysqli_query( |
773 | 773 | $db_link, |
774 | 774 | 'SELECT email, name as userName |
775 | - FROM ' . $pre . 'users |
|
775 | + FROM ' . $pre.'users |
|
776 | 776 | WHERE id = ' . (int) $userInfo['id'] |
777 | 777 | ) |
778 | 778 | ); |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | true |
793 | 793 | ); |
794 | 794 | } catch (Exception $e) { |
795 | - console . log(e); |
|
795 | + console.log(e); |
|
796 | 796 | } |
797 | 797 | } |
798 | 798 | |
@@ -800,4 +800,4 @@ discard block |
||
800 | 800 | } |
801 | 801 | } |
802 | 802 | |
803 | -echo '[{"finish":"1" , "next":"' . $next . '", "error":""}]'; |
|
803 | +echo '[{"finish":"1" , "next":"'.$next.'", "error":""}]'; |
@@ -78,7 +78,7 @@ |
||
78 | 78 | $database, |
79 | 79 | $port |
80 | 80 | ); |
81 | - $db_link->set_charset(DB_ENCODING); |
|
81 | + $db_link->set_charset(DB_ENCODING); |
|
82 | 82 | } else { |
83 | 83 | $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
84 | 84 | echo '[{"finish":"1", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | $port |
69 | 69 | ); |
70 | 70 | } else { |
71 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
72 | - echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
71 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
72 | + echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
73 | 73 | mysqli_close($db_link); |
74 | 74 | exit(); |
75 | 75 | } |
@@ -85,11 +85,11 @@ discard block |
||
85 | 85 | |
86 | 86 | // |
87 | 87 | // Add new setting 'enable_refresh_task_last_execution' |
88 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_refresh_task_last_execution'")); |
|
88 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_refresh_task_last_execution'")); |
|
89 | 89 | if (intval($tmp) === 0) { |
90 | 90 | mysqli_query( |
91 | 91 | $db_link, |
92 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_refresh_task_last_execution', '1')" |
|
92 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'enable_refresh_task_last_execution', '1')" |
|
93 | 93 | ); |
94 | 94 | } |
95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | // Add new table ITEMS_OTP |
101 | 101 | mysqli_query( |
102 | 102 | $db_link, |
103 | - 'CREATE TABLE IF NOT EXISTS `' . $pre . 'items_otp` ( |
|
103 | + 'CREATE TABLE IF NOT EXISTS `'.$pre.'items_otp` ( |
|
104 | 104 | `increment_id` int(12) NOT NULL, |
105 | 105 | `item_id` int(12) NOT NULL, |
106 | 106 | `secret` text NOT NULL, |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | // Alter table TOKENS |
116 | 116 | mysqli_query( |
117 | 117 | $db_link, |
118 | - 'ALTER TABLE `' . $pre . 'tokens` CHANGE `end_timestamp` `end_timestamp` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;' |
|
118 | + 'ALTER TABLE `'.$pre.'tokens` CHANGE `end_timestamp` `end_timestamp` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;' |
|
119 | 119 | ); |
120 | 120 | |
121 | 121 | |
122 | 122 | // Alter table ldap_groups_roles |
123 | 123 | mysqli_query( |
124 | 124 | $db_link, |
125 | - 'ALTER TABLE `' . $pre . 'ldap_groups_roles` CHANGE `ldap_group_id` `ldap_group_id` VARCHAR(500) NOT NULL;' |
|
125 | + 'ALTER TABLE `'.$pre.'ldap_groups_roles` CHANGE `ldap_group_id` `ldap_group_id` VARCHAR(500) NOT NULL;' |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | //---<END 3.1.1 |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | $port |
71 | 71 | ); |
72 | 72 | } else { |
73 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
74 | - echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
73 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
74 | + echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
75 | 75 | mysqli_close($db_link); |
76 | 76 | exit(); |
77 | 77 | } |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | |
102 | 102 | // Add the INDEX process_id_idx to the processes_tasks table |
103 | 103 | $res = checkIndexExist( |
104 | - $pre . 'processes_tasks', |
|
104 | + $pre.'processes_tasks', |
|
105 | 105 | 'process_id_idx', |
106 | 106 | "ADD KEY `process_id_idx` (`process_id`)" |
107 | 107 | ); |
108 | 108 | if (!$res) { |
109 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX process_id_idx to the processes_tasks table! ' . mysqli_error($db_link) . '!"}]'; |
|
109 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding the INDEX process_id_idx to the processes_tasks table! '.mysqli_error($db_link).'!"}]'; |
|
110 | 110 | mysqli_close($db_link); |
111 | 111 | exit(); |
112 | 112 | } |
@@ -117,38 +117,38 @@ discard block |
||
117 | 117 | |
118 | 118 | //--->BEGIN 3.0.6 |
119 | 119 | // Add new setting 'sending_emails_job_frequency' |
120 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'sending_emails_job_frequency'")); |
|
120 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'sending_emails_job_frequency'")); |
|
121 | 121 | if (intval($tmp) === 0) { |
122 | 122 | mysqli_query( |
123 | 123 | $db_link, |
124 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'sending_emails_job_frequency', '2')" |
|
124 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'sending_emails_job_frequency', '2')" |
|
125 | 125 | ); |
126 | 126 | } |
127 | 127 | // Add new setting 'user_keys_job_frequency' |
128 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'user_keys_job_frequency'")); |
|
128 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'user_keys_job_frequency'")); |
|
129 | 129 | if (intval($tmp) === 0) { |
130 | 130 | mysqli_query( |
131 | 131 | $db_link, |
132 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'user_keys_job_frequency', '1')" |
|
132 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'user_keys_job_frequency', '1')" |
|
133 | 133 | ); |
134 | 134 | } |
135 | 135 | // Add new setting 'items_statistics_job_frequency' |
136 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'enable_tasks_items_statistics_job_frequencymanager'")); |
|
136 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'enable_tasks_items_statistics_job_frequencymanager'")); |
|
137 | 137 | if (intval($tmp) === 0) { |
138 | 138 | mysqli_query( |
139 | 139 | $db_link, |
140 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_statistics_job_frequency', '5')" |
|
140 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_statistics_job_frequency', '5')" |
|
141 | 141 | ); |
142 | 142 | } |
143 | 143 | |
144 | 144 | // Add field ongoing_process_id to USERS table |
145 | 145 | $res = addColumnIfNotExist( |
146 | - $pre . 'users', |
|
146 | + $pre.'users', |
|
147 | 147 | 'ongoing_process_id', |
148 | 148 | "varchar(100) NULL;" |
149 | 149 | ); |
150 | 150 | if ($res === false) { |
151 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field ongoing_process_id to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
151 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field ongoing_process_id to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
152 | 152 | mysqli_close($db_link); |
153 | 153 | exit(); |
154 | 154 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | mysqli_query( |
163 | 163 | $db_link, |
164 | - 'ALTER TABLE `' . $pre . 'cache_tree` CHANGE `data` `data` LONGTEXT DEFAULT NULL;' |
|
164 | + 'ALTER TABLE `'.$pre.'cache_tree` CHANGE `data` `data` LONGTEXT DEFAULT NULL;' |
|
165 | 165 | ); |
166 | 166 | } catch (Exception $e) { |
167 | 167 | // Do nothing |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // Fix for #3679 |
171 | 171 | mysqli_query( |
172 | 172 | $db_link, |
173 | - "UPDATE `" . $pre . "users` SET `treeloadstrategy` = 'full' WHERE treeloadstrategy NOT IN ('full','sequential');" |
|
173 | + "UPDATE `".$pre."users` SET `treeloadstrategy` = 'full' WHERE treeloadstrategy NOT IN ('full','sequential');" |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | //---<END 3.0.7 |
@@ -180,12 +180,12 @@ discard block |
||
180 | 180 | //--->BEGIN 3.0.8 |
181 | 181 | // Add field mfa_disabled to USERS table |
182 | 182 | $res = addColumnIfNotExist( |
183 | - $pre . 'users', |
|
183 | + $pre.'users', |
|
184 | 184 | 'mfa_enabled', |
185 | 185 | "tinyint(1) NOT null DEFAULT '1';" |
186 | 186 | ); |
187 | 187 | if ($res === false) { |
188 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field mfa_disabled to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
188 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field mfa_disabled to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
189 | 189 | mysqli_close($db_link); |
190 | 190 | exit(); |
191 | 191 | } |
@@ -196,124 +196,124 @@ discard block |
||
196 | 196 | |
197 | 197 | //--->BEGIN 3.0.9 |
198 | 198 | // Add new setting 'reload_cache_table_task' |
199 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'reload_cache_table_task'")); |
|
199 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'reload_cache_table_task'")); |
|
200 | 200 | if (intval($tmp) === 0) { |
201 | 201 | mysqli_query( |
202 | 202 | $db_link, |
203 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'reload_cache_table_task', '')" |
|
203 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'reload_cache_table_task', '')" |
|
204 | 204 | ); |
205 | 205 | } |
206 | 206 | // Add new setting 'rebuild_config_file' |
207 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'rebuild_config_file'")); |
|
207 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'rebuild_config_file'")); |
|
208 | 208 | if (intval($tmp) === 0) { |
209 | 209 | mysqli_query( |
210 | 210 | $db_link, |
211 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'rebuild_config_file', '')" |
|
211 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'rebuild_config_file', '')" |
|
212 | 212 | ); |
213 | 213 | }// Add new setting 'purge_temporary_files_task' |
214 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'purge_temporary_files_task'")); |
|
214 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'purge_temporary_files_task'")); |
|
215 | 215 | if (intval($tmp) === 0) { |
216 | 216 | mysqli_query( |
217 | 217 | $db_link, |
218 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'purge_temporary_files_task', '')" |
|
218 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'purge_temporary_files_task', '')" |
|
219 | 219 | ); |
220 | 220 | } |
221 | 221 | // Add new setting 'clean_orphan_objects_task' |
222 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'clean_orphan_objects_task'")); |
|
222 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'clean_orphan_objects_task'")); |
|
223 | 223 | if (intval($tmp) === 0) { |
224 | 224 | mysqli_query( |
225 | 225 | $db_link, |
226 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clean_orphan_objects_task', '')" |
|
226 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'clean_orphan_objects_task', '')" |
|
227 | 227 | ); |
228 | 228 | } |
229 | 229 | // Add new setting 'users_personal_folder_task' |
230 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'users_personal_folder_task'")); |
|
230 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'users_personal_folder_task'")); |
|
231 | 231 | if (intval($tmp) === 0) { |
232 | 232 | mysqli_query( |
233 | 233 | $db_link, |
234 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'users_personal_folder_task', '')" |
|
234 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'users_personal_folder_task', '')" |
|
235 | 235 | ); |
236 | 236 | } |
237 | 237 | |
238 | 238 | // Remove unused settings |
239 | 239 | mysqli_query( |
240 | 240 | $db_link, |
241 | - "DELETE FROM `" . $pre . "misc` WHERE `intitule`='maintenance_job_tasks';" |
|
241 | + "DELETE FROM `".$pre."misc` WHERE `intitule`='maintenance_job_tasks';" |
|
242 | 242 | ); |
243 | 243 | mysqli_query( |
244 | 244 | $db_link, |
245 | - "DELETE FROM `" . $pre . "misc` WHERE `intitule`='maintenance_job_frequency';" |
|
245 | + "DELETE FROM `".$pre."misc` WHERE `intitule`='maintenance_job_frequency';" |
|
246 | 246 | ); |
247 | 247 | |
248 | 248 | // Add field item_key to ITEMS table |
249 | 249 | $res = addColumnIfNotExist( |
250 | - $pre . 'items', |
|
250 | + $pre.'items', |
|
251 | 251 | 'item_key', |
252 | 252 | "varchar(500) NOT NULL DEFAULT '-1';" |
253 | 253 | ); |
254 | 254 | if ($res === false) { |
255 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_key to table ITEMS! ' . mysqli_error($db_link) . '!"}]'; |
|
255 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_key to table ITEMS! '.mysqli_error($db_link).'!"}]'; |
|
256 | 256 | mysqli_close($db_link); |
257 | 257 | exit(); |
258 | 258 | } |
259 | 259 | |
260 | 260 | // Remove column unique from ITEMS table |
261 | 261 | $res = removeColumnIfNotExist( |
262 | - $pre . 'items', |
|
262 | + $pre.'items', |
|
263 | 263 | 'unique' |
264 | 264 | ); |
265 | 265 | |
266 | 266 | // Add field export_tag to EXPORT table |
267 | 267 | $res = addColumnIfNotExist( |
268 | - $pre . 'export', |
|
268 | + $pre.'export', |
|
269 | 269 | 'export_tag', |
270 | 270 | "varchar(20) NOT NULL;" |
271 | 271 | ); |
272 | 272 | if ($res === false) { |
273 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field export_tag to table EXPORT! ' . mysqli_error($db_link) . '!"}]'; |
|
273 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field export_tag to table EXPORT! '.mysqli_error($db_link).'!"}]'; |
|
274 | 274 | mysqli_close($db_link); |
275 | 275 | exit(); |
276 | 276 | } |
277 | 277 | |
278 | 278 | // Add field folder_id to EXPORT table |
279 | 279 | $res = addColumnIfNotExist( |
280 | - $pre . 'export', |
|
280 | + $pre.'export', |
|
281 | 281 | 'folder_id', |
282 | 282 | "varchar(10) NOT NULL;" |
283 | 283 | ); |
284 | 284 | if ($res === false) { |
285 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field folder_id to table EXPORT! ' . mysqli_error($db_link) . '!"}]'; |
|
285 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field folder_id to table EXPORT! '.mysqli_error($db_link).'!"}]'; |
|
286 | 286 | mysqli_close($db_link); |
287 | 287 | exit(); |
288 | 288 | } |
289 | 289 | |
290 | 290 | // Add field perso to EXPORT table |
291 | 291 | $res = addColumnIfNotExist( |
292 | - $pre . 'export', |
|
292 | + $pre.'export', |
|
293 | 293 | 'perso', |
294 | 294 | "tinyint(1) NOT NULL default '0';" |
295 | 295 | ); |
296 | 296 | if ($res === false) { |
297 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field perso to table EXPORT! ' . mysqli_error($db_link) . '!"}]'; |
|
297 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field perso to table EXPORT! '.mysqli_error($db_link).'!"}]'; |
|
298 | 298 | mysqli_close($db_link); |
299 | 299 | exit(); |
300 | 300 | } |
301 | 301 | |
302 | 302 | // Add field restricted_to to EXPORT table |
303 | 303 | $res = addColumnIfNotExist( |
304 | - $pre . 'export', |
|
304 | + $pre.'export', |
|
305 | 305 | 'restricted_to', |
306 | 306 | "varchar(200) DEFAULT NULL;" |
307 | 307 | ); |
308 | 308 | if ($res === false) { |
309 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field restricted_to to table EXPORT! ' . mysqli_error($db_link) . '!"}]'; |
|
309 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field restricted_to to table EXPORT! '.mysqli_error($db_link).'!"}]'; |
|
310 | 310 | mysqli_close($db_link); |
311 | 311 | exit(); |
312 | 312 | } |
313 | 313 | |
314 | 314 | // Rename column id to item_id in EXPORT table |
315 | 315 | changeColumnName( |
316 | - $pre . 'export', |
|
316 | + $pre.'export', |
|
317 | 317 | 'id', |
318 | 318 | 'item_id', |
319 | 319 | "int(12) NOT NULL" |
@@ -321,42 +321,42 @@ discard block |
||
321 | 321 | |
322 | 322 | // Add field created_at to USERS table |
323 | 323 | $res = addColumnIfNotExist( |
324 | - $pre . 'users', |
|
324 | + $pre.'users', |
|
325 | 325 | 'created_at', |
326 | 326 | "varchar(30) NULL;" |
327 | 327 | ); |
328 | 328 | if ($res === false) { |
329 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
329 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
330 | 330 | mysqli_close($db_link); |
331 | 331 | exit(); |
332 | 332 | } |
333 | 333 | |
334 | 334 | // Add field updated_at to USERS table |
335 | 335 | $res = addColumnIfNotExist( |
336 | - $pre . 'users', |
|
336 | + $pre.'users', |
|
337 | 337 | 'updated_at', |
338 | 338 | "varchar(30) NULL;" |
339 | 339 | ); |
340 | 340 | if ($res === false) { |
341 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
341 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
342 | 342 | mysqli_close($db_link); |
343 | 343 | exit(); |
344 | 344 | } |
345 | 345 | |
346 | 346 | // Add field deleted_at to USERS table |
347 | 347 | $res = addColumnIfNotExist( |
348 | - $pre . 'users', |
|
348 | + $pre.'users', |
|
349 | 349 | 'deleted_at', |
350 | 350 | "varchar(30) NULL;" |
351 | 351 | ); |
352 | 352 | if ($res === false) { |
353 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table USERS! ' . mysqli_error($db_link) . '!"}]'; |
|
353 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table USERS! '.mysqli_error($db_link).'!"}]'; |
|
354 | 354 | mysqli_close($db_link); |
355 | 355 | exit(); |
356 | 356 | } |
357 | 357 | |
358 | 358 | // populate created_at, updated_at and deleted_at fields in USERS table |
359 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "users` WHERE created_at IS NOT NULL")); |
|
359 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."users` WHERE created_at IS NOT NULL")); |
|
360 | 360 | if (intval($tmp) === 0) { |
361 | 361 | populateUsersTable($pre); |
362 | 362 | } |
@@ -368,36 +368,36 @@ discard block |
||
368 | 368 | |
369 | 369 | // Add field created_at to ITEMS table |
370 | 370 | $res = addColumnIfNotExist( |
371 | - $pre . 'items', |
|
371 | + $pre.'items', |
|
372 | 372 | 'created_at', |
373 | 373 | "varchar(30) NULL;" |
374 | 374 | ); |
375 | 375 | if ($res === false) { |
376 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]'; |
|
376 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field created_at to table ITEMS! '.mysqli_error($db_link).'!"}]'; |
|
377 | 377 | mysqli_close($db_link); |
378 | 378 | exit(); |
379 | 379 | } |
380 | 380 | |
381 | 381 | // Add field updated_at to ITEMS table |
382 | 382 | $res = addColumnIfNotExist( |
383 | - $pre . 'items', |
|
383 | + $pre.'items', |
|
384 | 384 | 'updated_at', |
385 | 385 | "varchar(30) NULL;" |
386 | 386 | ); |
387 | 387 | if ($res === false) { |
388 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]'; |
|
388 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field updated_at to table ITEMS! '.mysqli_error($db_link).'!"}]'; |
|
389 | 389 | mysqli_close($db_link); |
390 | 390 | exit(); |
391 | 391 | } |
392 | 392 | |
393 | 393 | // Add field deleted_at to ITEMS table |
394 | 394 | $res = addColumnIfNotExist( |
395 | - $pre . 'items', |
|
395 | + $pre.'items', |
|
396 | 396 | 'deleted_at', |
397 | 397 | "varchar(30) NULL;" |
398 | 398 | ); |
399 | 399 | if ($res === false) { |
400 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table ITEMS! ' . mysqli_error($db_link) . '!"}]'; |
|
400 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field deleted_at to table ITEMS! '.mysqli_error($db_link).'!"}]'; |
|
401 | 401 | mysqli_close($db_link); |
402 | 402 | exit(); |
403 | 403 | } |
@@ -406,29 +406,29 @@ discard block |
||
406 | 406 | try { |
407 | 407 | mysqli_query( |
408 | 408 | $db_link, |
409 | - 'ALTER TABLE `' . $pre . 'processes` CHANGE `process_type` `process_type` VARCHAR(100) NOT NULL;' |
|
409 | + 'ALTER TABLE `'.$pre.'processes` CHANGE `process_type` `process_type` VARCHAR(100) NOT NULL;' |
|
410 | 410 | ); |
411 | 411 | } catch (Exception $e) { |
412 | 412 | // Do nothing |
413 | 413 | } |
414 | 414 | |
415 | 415 | // Add new setting 'maximum_session_expiration_time' |
416 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'maximum_session_expiration_time'")); |
|
416 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'maximum_session_expiration_time'")); |
|
417 | 417 | if (intval($tmp) === 0) { |
418 | 418 | mysqli_query( |
419 | 419 | $db_link, |
420 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_session_expiration_time', '60')" |
|
420 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'maximum_session_expiration_time', '60')" |
|
421 | 421 | ); |
422 | 422 | } |
423 | 423 | |
424 | 424 | // Add field treated_objects to processes_logs table |
425 | 425 | $res = addColumnIfNotExist( |
426 | - $pre . 'processes_logs', |
|
426 | + $pre.'processes_logs', |
|
427 | 427 | 'treated_objects', |
428 | 428 | "varchar(20) NULL;" |
429 | 429 | ); |
430 | 430 | if ($res === false) { |
431 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field treated_objects to table processes_logs! ' . mysqli_error($db_link) . '!"}]'; |
|
431 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field treated_objects to table processes_logs! '.mysqli_error($db_link).'!"}]'; |
|
432 | 432 | mysqli_close($db_link); |
433 | 433 | exit(); |
434 | 434 | } |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | $resAdmin = mysqli_query( |
438 | 438 | $db_link, |
439 | 439 | "select name, lastname |
440 | - from `" . $pre . "users` |
|
440 | + from `" . $pre."users` |
|
441 | 441 | WHERE id = 1" |
442 | 442 | ); |
443 | 443 | $admin = mysqli_fetch_array($resAdmin); |
@@ -445,54 +445,54 @@ discard block |
||
445 | 445 | // update created_at field |
446 | 446 | mysqli_query( |
447 | 447 | $db_link, |
448 | - "UPDATE `" . $pre . "users` SET name = 'Change me', lastname = 'Change me' WHERE id = 1" |
|
448 | + "UPDATE `".$pre."users` SET name = 'Change me', lastname = 'Change me' WHERE id = 1" |
|
449 | 449 | ); |
450 | 450 | } |
451 | 451 | |
452 | 452 | // Add field started_at to processes table |
453 | 453 | $res = addColumnIfNotExist( |
454 | - $pre . 'processes', |
|
454 | + $pre.'processes', |
|
455 | 455 | 'started_at', |
456 | 456 | "varchar(50) NULL;" |
457 | 457 | ); |
458 | 458 | if ($res === false) { |
459 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field started_at to table processes! ' . mysqli_error($db_link) . '!"}]'; |
|
459 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field started_at to table processes! '.mysqli_error($db_link).'!"}]'; |
|
460 | 460 | mysqli_close($db_link); |
461 | 461 | exit(); |
462 | 462 | } |
463 | 463 | |
464 | 464 | // Add field views to otv table |
465 | 465 | $res = addColumnIfNotExist( |
466 | - $pre . 'otv', |
|
466 | + $pre.'otv', |
|
467 | 467 | 'views', |
468 | 468 | "INT(10) NOT NULL DEFAULT '0';" |
469 | 469 | ); |
470 | 470 | if ($res === false) { |
471 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field views to table otv! ' . mysqli_error($db_link) . '!"}]'; |
|
471 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field views to table otv! '.mysqli_error($db_link).'!"}]'; |
|
472 | 472 | mysqli_close($db_link); |
473 | 473 | exit(); |
474 | 474 | } |
475 | 475 | |
476 | 476 | // Add field max_views to otv table |
477 | 477 | $res = addColumnIfNotExist( |
478 | - $pre . 'otv', |
|
478 | + $pre.'otv', |
|
479 | 479 | 'max_views', |
480 | 480 | "INT(10) NULL DEFAULT NULL;" |
481 | 481 | ); |
482 | 482 | if ($res === false) { |
483 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field max_views to table otv! ' . mysqli_error($db_link) . '!"}]'; |
|
483 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field max_views to table otv! '.mysqli_error($db_link).'!"}]'; |
|
484 | 484 | mysqli_close($db_link); |
485 | 485 | exit(); |
486 | 486 | } |
487 | 487 | |
488 | 488 | // Add field time_limit to otv table |
489 | 489 | $res = addColumnIfNotExist( |
490 | - $pre . 'otv', |
|
490 | + $pre.'otv', |
|
491 | 491 | 'time_limit', |
492 | 492 | "varchar(100) DEFAULT NULL;" |
493 | 493 | ); |
494 | 494 | if ($res === false) { |
495 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field time_limit to table otv! ' . mysqli_error($db_link) . '!"}]'; |
|
495 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field time_limit to table otv! '.mysqli_error($db_link).'!"}]'; |
|
496 | 496 | mysqli_close($db_link); |
497 | 497 | exit(); |
498 | 498 | } |
@@ -500,14 +500,14 @@ discard block |
||
500 | 500 | // delete old otv |
501 | 501 | mysqli_query( |
502 | 502 | $db_link, |
503 | - "DELETE FROM `" . $pre . "otv` WHERE max_views IS NULL;" |
|
503 | + "DELETE FROM `".$pre."otv` WHERE max_views IS NULL;" |
|
504 | 504 | ); |
505 | 505 | |
506 | 506 | // Alter encrypted_psk in Users |
507 | 507 | try { |
508 | 508 | mysqli_query( |
509 | 509 | $db_link, |
510 | - 'ALTER TABLE `' . $pre . 'users` CHANGE `encrypted_psk` `encrypted_psk` text NULL DEFAULT NULL;' |
|
510 | + 'ALTER TABLE `'.$pre.'users` CHANGE `encrypted_psk` `encrypted_psk` text NULL DEFAULT NULL;' |
|
511 | 511 | ); |
512 | 512 | } catch (Exception $e) { |
513 | 513 | // Do nothing |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | try { |
518 | 518 | mysqli_query( |
519 | 519 | $db_link, |
520 | - 'ALTER TABLE `' . $pre . 'items` CHANGE `url` `url` TEXT NULL DEFAULT NULL;' |
|
520 | + 'ALTER TABLE `'.$pre.'items` CHANGE `url` `url` TEXT NULL DEFAULT NULL;' |
|
521 | 521 | ); |
522 | 522 | } catch (Exception $e) { |
523 | 523 | // Do nothing |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | mysqli_query( |
529 | 529 | $db_link, |
530 | - 'ALTER TABLE `' . $pre . 'cache` CHANGE `url` `url` TEXT NULL DEFAULT NULL;' |
|
530 | + 'ALTER TABLE `'.$pre.'cache` CHANGE `url` `url` TEXT NULL DEFAULT NULL;' |
|
531 | 531 | ); |
532 | 532 | } catch (Exception $e) { |
533 | 533 | // Do nothing |
@@ -535,12 +535,12 @@ discard block |
||
535 | 535 | |
536 | 536 | // Add field item_id to processes table |
537 | 537 | $res = addColumnIfNotExist( |
538 | - $pre . 'processes', |
|
538 | + $pre.'processes', |
|
539 | 539 | 'item_id', |
540 | 540 | "INT(12) NULL;" |
541 | 541 | ); |
542 | 542 | if ($res === false) { |
543 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_id to table processes! ' . mysqli_error($db_link) . '!"}]'; |
|
543 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field item_id to table processes! '.mysqli_error($db_link).'!"}]'; |
|
544 | 544 | mysqli_close($db_link); |
545 | 545 | exit(); |
546 | 546 | } |
@@ -549,18 +549,18 @@ discard block |
||
549 | 549 | try { |
550 | 550 | mysqli_query( |
551 | 551 | $db_link, |
552 | - 'ALTER TABLE `' . $pre . 'users` CHANGE `login` `login` VARCHAR(500) NOT NULL;' |
|
552 | + 'ALTER TABLE `'.$pre.'users` CHANGE `login` `login` VARCHAR(500) NOT NULL;' |
|
553 | 553 | ); |
554 | 554 | } catch (Exception $e) { |
555 | 555 | // Do nothing |
556 | 556 | } |
557 | 557 | |
558 | 558 | // Add new setting 'items_ops_job_frequency' |
559 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'items_ops_job_frequency'")); |
|
559 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'items_ops_job_frequency'")); |
|
560 | 560 | if (intval($tmp) === 0) { |
561 | 561 | mysqli_query( |
562 | 562 | $db_link, |
563 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_ops_job_frequency', '1')" |
|
563 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'items_ops_job_frequency', '1')" |
|
564 | 564 | ); |
565 | 565 | } |
566 | 566 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | try { |
569 | 569 | mysqli_query( |
570 | 570 | $db_link, |
571 | - 'ALTER TABLE `' . $pre . 'log_items` CHANGE `raison_iv` `old_value` MEDIUMTEXT NULL DEFAULT NULL;' |
|
571 | + 'ALTER TABLE `'.$pre.'log_items` CHANGE `raison_iv` `old_value` MEDIUMTEXT NULL DEFAULT NULL;' |
|
572 | 572 | ); |
573 | 573 | } catch (Exception $e) { |
574 | 574 | // Do nothing |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | try { |
579 | 579 | mysqli_query( |
580 | 580 | $db_link, |
581 | - 'ALTER TABLE `' . $pre . 'cache` CHANGE `description` `description` MEDIUMTEXT NULL DEFAULT NULL;' |
|
581 | + 'ALTER TABLE `'.$pre.'cache` CHANGE `description` `description` MEDIUMTEXT NULL DEFAULT NULL;' |
|
582 | 582 | ); |
583 | 583 | } catch (Exception $e) { |
584 | 584 | // Do nothing |
@@ -586,24 +586,24 @@ discard block |
||
586 | 586 | |
587 | 587 | // Add field shared_globaly to otv table |
588 | 588 | $res = addColumnIfNotExist( |
589 | - $pre . 'otv', |
|
589 | + $pre.'otv', |
|
590 | 590 | 'shared_globaly', |
591 | 591 | "INT(1) NOT NULL DEFAULT '0';" |
592 | 592 | ); |
593 | 593 | if ($res === false) { |
594 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field shared_globaly to table otv! ' . mysqli_error($db_link) . '!"}]'; |
|
594 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field shared_globaly to table otv! '.mysqli_error($db_link).'!"}]'; |
|
595 | 595 | mysqli_close($db_link); |
596 | 596 | exit(); |
597 | 597 | } |
598 | 598 | |
599 | 599 | // Add field keys_recovery_time to users table |
600 | 600 | $res = addColumnIfNotExist( |
601 | - $pre . 'users', |
|
601 | + $pre.'users', |
|
602 | 602 | 'keys_recovery_time', |
603 | 603 | "VARCHAR(500) NULL DEFAULT NULL;" |
604 | 604 | ); |
605 | 605 | if ($res === false) { |
606 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field keys_recovery_time to table users! ' . mysqli_error($db_link) . '!"}]'; |
|
606 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field keys_recovery_time to table users! '.mysqli_error($db_link).'!"}]'; |
|
607 | 607 | mysqli_close($db_link); |
608 | 608 | exit(); |
609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | try { |
613 | 613 | mysqli_query( |
614 | 614 | $db_link, |
615 | - 'ALTER TABLE `' . $pre . 'users` CHANGE `favourites` `favourites` varchar(1000) NULL DEFAULT NULL;' |
|
615 | + 'ALTER TABLE `'.$pre.'users` CHANGE `favourites` `favourites` varchar(1000) NULL DEFAULT NULL;' |
|
616 | 616 | ); |
617 | 617 | } catch (Exception $e) { |
618 | 618 | // Do nothing |
@@ -620,12 +620,12 @@ discard block |
||
620 | 620 | |
621 | 621 | // Add field aes_iv to users table |
622 | 622 | $res = addColumnIfNotExist( |
623 | - $pre . 'users', |
|
623 | + $pre.'users', |
|
624 | 624 | 'aes_iv', |
625 | 625 | "TEXT NULL DEFAULT NULL;" |
626 | 626 | ); |
627 | 627 | if ($res === false) { |
628 | - echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field aes_iv to table users! ' . mysqli_error($db_link) . '!"}]'; |
|
628 | + echo '[{"finish":"1", "msg":"", "error":"An error appears when adding field aes_iv to table users! '.mysqli_error($db_link).'!"}]'; |
|
629 | 629 | mysqli_close($db_link); |
630 | 630 | exit(); |
631 | 631 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | try { |
635 | 635 | mysqli_query( |
636 | 636 | $db_link, |
637 | - 'ALTER TABLE `' . $pre . 'users` CHANGE `psk` `psk` VARCHAR(400) NULL DEFAULT NULL;' |
|
637 | + 'ALTER TABLE `'.$pre.'users` CHANGE `psk` `psk` VARCHAR(400) NULL DEFAULT NULL;' |
|
638 | 638 | ); |
639 | 639 | } catch (Exception $e) { |
640 | 640 | // Do nothing |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | // Now removing all old libraries |
644 | 644 | deleteAll([ |
645 | - "Illuminate","Encryption","Tightenco","portable-ascii-master","Pdf","ForceUTF8","portable-utf8-master","GO","Symfony","Elegant","Firebase","Database","anti-xss-master","LdapRecord","misc","PasswordGenerator","Authentication","Goodby","Plupload","PHPMailer","TiBeN","protect","Cron","PasswordLib","Fork","Carbon","Tree","Webmozart" |
|
645 | + "Illuminate", "Encryption", "Tightenco", "portable-ascii-master", "Pdf", "ForceUTF8", "portable-utf8-master", "GO", "Symfony", "Elegant", "Firebase", "Database", "anti-xss-master", "LdapRecord", "misc", "PasswordGenerator", "Authentication", "Goodby", "Plupload", "PHPMailer", "TiBeN", "protect", "Cron", "PasswordLib", "Fork", "Carbon", "Tree", "Webmozart" |
|
646 | 646 | ]); |
647 | 647 | |
648 | 648 | //---<END 3.0.10 |
@@ -650,16 +650,16 @@ discard block |
||
650 | 650 | //--------------------------------------------------------------------- |
651 | 651 | |
652 | 652 | // Save timestamp |
653 | -$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `" . $pre . "misc` WHERE type = 'admin' AND intitule = 'upgrade_timestamp'")); |
|
653 | +$tmp = mysqli_num_rows(mysqli_query($db_link, "SELECT * FROM `".$pre."misc` WHERE type = 'admin' AND intitule = 'upgrade_timestamp'")); |
|
654 | 654 | if (intval($tmp) === 0) { |
655 | 655 | mysqli_query( |
656 | 656 | $db_link, |
657 | - "INSERT INTO `" . $pre . "misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'upgrade_timestamp', ".time().")" |
|
657 | + "INSERT INTO `".$pre."misc` (`type`, `intitule`, `valeur`) VALUES ('admin', 'upgrade_timestamp', ".time().")" |
|
658 | 658 | ); |
659 | 659 | } else { |
660 | 660 | mysqli_query( |
661 | 661 | $db_link, |
662 | - "UPDATE `" . $pre . "misc` SET valeur = ".time()." WHERE type = 'admin' AND intitule = 'upgrade_timestamp'" |
|
662 | + "UPDATE `".$pre."misc` SET valeur = ".time()." WHERE type = 'admin' AND intitule = 'upgrade_timestamp'" |
|
663 | 663 | ); |
664 | 664 | } |
665 | 665 | |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | $users = mysqli_query( |
682 | 682 | $db_link, |
683 | 683 | "select u.id as uid, ls.date as datetime |
684 | - from `" . $pre . "users` as u |
|
685 | - inner join `" . $pre . "log_system` as ls on ls.field_1 = u.id |
|
684 | + from `" . $pre."users` as u |
|
685 | + inner join `" . $pre."log_system` as ls on ls.field_1 = u.id |
|
686 | 686 | WHERE ls.type = 'user_mngt' AND ls.label = 'at_user_added'" |
687 | 687 | ); |
688 | 688 | while ($user = mysqli_fetch_assoc($users)) { |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | // update created_at field |
691 | 691 | mysqli_query( |
692 | 692 | $db_link, |
693 | - "UPDATE `" . $pre . "users` SET created_at = '".$user['datetime']."' WHERE id = ".$user['uid'] |
|
693 | + "UPDATE `".$pre."users` SET created_at = '".$user['datetime']."' WHERE id = ".$user['uid'] |
|
694 | 694 | ); |
695 | 695 | } |
696 | 696 | } |
@@ -698,14 +698,14 @@ discard block |
||
698 | 698 | // loop on users - updated_at |
699 | 699 | $users = mysqli_query( |
700 | 700 | $db_link, |
701 | - "select u.id as uid, (select date from " . $pre . "log_system where type = 'user_mngt' and field_1=uid order by date DESC limit 1) as datetime from `" . $pre . "users` as u;" |
|
701 | + "select u.id as uid, (select date from ".$pre."log_system where type = 'user_mngt' and field_1=uid order by date DESC limit 1) as datetime from `".$pre."users` as u;" |
|
702 | 702 | ); |
703 | 703 | while ($user = mysqli_fetch_assoc($users)) { |
704 | 704 | if (empty((string) $user['datetime']) === false && is_null($user['datetime']) === false) { |
705 | 705 | // update updated_at field |
706 | 706 | mysqli_query( |
707 | 707 | $db_link, |
708 | - "UPDATE `" . $pre . "users` SET updated_at = '".$user['datetime']."' WHERE id = ".$user['uid'] |
|
708 | + "UPDATE `".$pre."users` SET updated_at = '".$user['datetime']."' WHERE id = ".$user['uid'] |
|
709 | 709 | ); |
710 | 710 | } |
711 | 711 | } |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | */ |
26 | 26 | public function __construct() |
27 | 27 | { |
28 | - if (! extension_loaded('openssl')) { |
|
28 | + if (!extension_loaded('openssl')) { |
|
29 | 29 | throw new \RuntimeException(sprintf( |
30 | 30 | "You need the OpenSSL extension to use %s", |
31 | 31 | __CLASS__ |
32 | 32 | )); |
33 | 33 | } |
34 | - if (! extension_loaded('mbstring')) { |
|
34 | + if (!extension_loaded('mbstring')) { |
|
35 | 35 | throw new \RuntimeException(sprintf( |
36 | 36 | "You need the Multibytes extension to use %s", |
37 | 37 | __CLASS__ |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function open($save_path, $session_name): bool |
49 | 49 | { |
50 | - $this->key = $this->getKey('KEY_' . $session_name); |
|
50 | + $this->key = $this->getKey('KEY_'.$session_name); |
|
51 | 51 | return parent::open($save_path, $session_name); |
52 | 52 | } |
53 | 53 | |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | // Authentication |
95 | 95 | $hmac = hash_hmac( |
96 | 96 | 'SHA256', |
97 | - $iv . $ciphertext, |
|
97 | + $iv.$ciphertext, |
|
98 | 98 | mb_substr($key, 32, null, '8bit'), |
99 | 99 | true |
100 | 100 | ); |
101 | - return $hmac . $iv . $ciphertext; |
|
101 | + return $hmac.$iv.$ciphertext; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | /** |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | // Authentication |
117 | 117 | $hmacNew = hash_hmac( |
118 | 118 | 'SHA256', |
119 | - $iv . $ciphertext, |
|
119 | + $iv.$ciphertext, |
|
120 | 120 | mb_substr($key, 32, null, '8bit'), |
121 | 121 | true |
122 | 122 | ); |
123 | - if (! hash_equals($hmac, $hmacNew)) { |
|
123 | + if (!hash_equals($hmac, $hmacNew)) { |
|
124 | 124 | throw new Exception\AuthenticationFailedException('Authentication failed'); |
125 | 125 | } |
126 | 126 | // Decrypt |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | // if session cookie lifetime > 0 then add to current time |
149 | 149 | // otherwise leave it as zero, honoring zero's special meaning |
150 | 150 | // expire at browser close. |
151 | - $arr_cookie_options = array ( |
|
151 | + $arr_cookie_options = array( |
|
152 | 152 | 'expires' => ($cookieParam['lifetime'] > 0) ? time() + $cookieParam['lifetime'] : 0, |
153 | 153 | 'path' => '/', |
154 | 154 | 'secure' => true, |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | // Do we need to rewrite the settings.php file? |
68 | 68 | if (defined("DB_PASSWD") === false) { |
69 | - $settingsFile = '../includes/config/settings.php'; |
|
69 | + $settingsFile = '../includes/config/settings.php'; |
|
70 | 70 | if (null !== SECUREPATH) { //3.0.0.23 |
71 | 71 | //Do a copy of the existing file |
72 | 72 | if (!copy( |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");'; |
192 | 192 | define("SECUREFILE", "' . SECUREFILE. '"); |
193 | 193 | |
194 | - if (defined('IKEY') === true) $settingsTxt .= ' |
|
194 | + if (defined('IKEY') === true) $settingsTxt .= ' |
|
195 | 195 | define("IKEY", "' . IKEY . '");'; |
196 | - else $settingsTxt .= ' |
|
196 | + else $settingsTxt .= ' |
|
197 | 197 | define("IKEY", "");'; |
198 | - if (defined('SKEY') === true) $settingsTxt .= ' |
|
198 | + if (defined('SKEY') === true) $settingsTxt .= ' |
|
199 | 199 | define("SKEY", "' . SKEY . '");'; |
200 | - else $settingsTxt .= ' |
|
200 | + else $settingsTxt .= ' |
|
201 | 201 | define("SKEY", "");'; |
202 | - if (defined('HOST') === true) $settingsTxt .= ' |
|
202 | + if (defined('HOST') === true) $settingsTxt .= ' |
|
203 | 203 | define("HOST", "' . HOST . '");'; |
204 | - else $settingsTxt .= ' |
|
204 | + else $settingsTxt .= ' |
|
205 | 205 | define("HOST", "");'; |
206 | 206 | |
207 | 207 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | //Do a copy of the existing file |
72 | 72 | if (!copy( |
73 | 73 | $settingsFile, |
74 | - $settingsFile . '.' . date( |
|
74 | + $settingsFile.'.'.date( |
|
75 | 75 | 'Y_m_d_H_i_s', |
76 | 76 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
77 | 77 | ) |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | // CHeck if old sk.php exists. |
89 | 89 | // If yes then get keys to database and delete it |
90 | 90 | if (empty($post_sk_path) === false || defined('SECUREPATH') === true) { |
91 | - $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php'; |
|
91 | + $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php'; |
|
92 | 92 | if (file_exists($filename)) { |
93 | 93 | include_once $filename; |
94 | 94 | unlink($filename); |
@@ -97,63 +97,63 @@ discard block |
||
97 | 97 | // SKEY |
98 | 98 | $tmp = mysqli_query( |
99 | 99 | $db_link, |
100 | - "SELECT INTO `" . $pre . "misc` |
|
100 | + "SELECT INTO `".$pre."misc` |
|
101 | 101 | WHERE type = 'admin' AND intitule = 'duo_skey'" |
102 | 102 | ); |
103 | 103 | if ($tmp) { |
104 | 104 | mysqli_query( |
105 | 105 | $db_link, |
106 | - "UPDATE `" . $pre . "misc` |
|
107 | - set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'" |
|
106 | + "UPDATE `".$pre."misc` |
|
107 | + set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'" |
|
108 | 108 | ); |
109 | 109 | } else { |
110 | 110 | mysqli_query( |
111 | 111 | $db_link, |
112 | - "INSERT INTO `" . $pre . "misc` |
|
112 | + "INSERT INTO `".$pre."misc` |
|
113 | 113 | (`valeur`, `type`, `intitule`) |
114 | - VALUES ('" . SKEY . "', 'admin', 'duo_skey')" |
|
114 | + VALUES ('" . SKEY."', 'admin', 'duo_skey')" |
|
115 | 115 | ); |
116 | 116 | } |
117 | 117 | |
118 | 118 | // IKEY |
119 | 119 | $tmp = mysqli_query( |
120 | 120 | $db_link, |
121 | - "SELECT INTO `" . $pre . "misc` |
|
121 | + "SELECT INTO `".$pre."misc` |
|
122 | 122 | WHERE type = 'admin' AND intitule = 'duo_ikey'" |
123 | 123 | ); |
124 | 124 | if ($tmp) { |
125 | 125 | mysqli_query( |
126 | 126 | $db_link, |
127 | - "UPDATE `" . $pre . "misc` |
|
128 | - set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'" |
|
127 | + "UPDATE `".$pre."misc` |
|
128 | + set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'" |
|
129 | 129 | ); |
130 | 130 | } else { |
131 | 131 | mysqli_query( |
132 | 132 | $db_link, |
133 | - "INSERT INTO `" . $pre . "misc` |
|
133 | + "INSERT INTO `".$pre."misc` |
|
134 | 134 | (`valeur`, `type`, `intitule`) |
135 | - VALUES ('" . IKEY . "', 'admin', 'duo_ikey')" |
|
135 | + VALUES ('" . IKEY."', 'admin', 'duo_ikey')" |
|
136 | 136 | ); |
137 | 137 | } |
138 | 138 | |
139 | 139 | // HOST |
140 | 140 | $tmp = mysqli_query( |
141 | 141 | $db_link, |
142 | - "SELECT INTO `" . $pre . "misc` |
|
142 | + "SELECT INTO `".$pre."misc` |
|
143 | 143 | WHERE type = 'admin' AND intitule = 'duo_host'" |
144 | 144 | ); |
145 | 145 | if ($tmp) { |
146 | 146 | mysqli_query( |
147 | 147 | $db_link, |
148 | - "UPDATE `" . $pre . "misc` |
|
149 | - set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'" |
|
148 | + "UPDATE `".$pre."misc` |
|
149 | + set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'" |
|
150 | 150 | ); |
151 | 151 | } else { |
152 | 152 | mysqli_query( |
153 | 153 | $db_link, |
154 | - "INSERT INTO `" . $pre . "misc` |
|
154 | + "INSERT INTO `".$pre."misc` |
|
155 | 155 | (`valeur`, `type`, `intitule`) |
156 | - VALUES ('" . HOST . "', 'admin', 'duo_host')" |
|
156 | + VALUES ('" . HOST."', 'admin', 'duo_host')" |
|
157 | 157 | ); |
158 | 158 | } |
159 | 159 | } |
@@ -169,13 +169,13 @@ discard block |
||
169 | 169 | |
170 | 170 | $settingsTxt = '<?php |
171 | 171 | // DATABASE connexion parameters |
172 | -define("DB_HOST", "' . $server . '"); |
|
173 | -define("DB_USER", "' . $user . '"); |
|
174 | -define("DB_PASSWD", "' . $pass . '"); |
|
175 | -define("DB_NAME", "' . $database . '"); |
|
176 | -define("DB_PREFIX", "' . $pre . '"); |
|
177 | -define("DB_PORT", "' . $port . '"); |
|
178 | -define("DB_ENCODING", "' . $encoding . '"); |
|
172 | +define("DB_HOST", "' . $server.'"); |
|
173 | +define("DB_USER", "' . $user.'"); |
|
174 | +define("DB_PASSWD", "' . $pass.'"); |
|
175 | +define("DB_NAME", "' . $database.'"); |
|
176 | +define("DB_PREFIX", "' . $pre.'"); |
|
177 | +define("DB_PORT", "' . $port.'"); |
|
178 | +define("DB_ENCODING", "' . $encoding.'"); |
|
179 | 179 | define("DB_SSL", false); // if DB over SSL then comment this line |
180 | 180 | // if DB over SSL then uncomment the following lines |
181 | 181 | //define("DB_SSL", array( |
@@ -188,19 +188,19 @@ discard block |
||
188 | 188 | define("DB_CONNECT_OPTIONS", array( |
189 | 189 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
190 | 190 | )); |
191 | -define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");'; |
|
191 | +define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH).'");'; |
|
192 | 192 | define("SECUREFILE", "' . SECUREFILE. '"); |
193 | 193 | |
194 | 194 | if (defined('IKEY') === true) $settingsTxt .= ' |
195 | -define("IKEY", "' . IKEY . '");'; |
|
195 | +define("IKEY", "' . IKEY.'");'; |
|
196 | 196 | else $settingsTxt .= ' |
197 | 197 | define("IKEY", "");'; |
198 | 198 | if (defined('SKEY') === true) $settingsTxt .= ' |
199 | -define("SKEY", "' . SKEY . '");'; |
|
199 | +define("SKEY", "' . SKEY.'");'; |
|
200 | 200 | else $settingsTxt .= ' |
201 | 201 | define("SKEY", "");'; |
202 | 202 | if (defined('HOST') === true) $settingsTxt .= ' |
203 | -define("HOST", "' . HOST . '");'; |
|
203 | +define("HOST", "' . HOST.'");'; |
|
204 | 204 | else $settingsTxt .= ' |
205 | 205 | define("HOST", "");'; |
206 | 206 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | '}]'; |
297 | 297 | break; |
298 | 298 | } |
299 | - if (!file_exists(SECUREPATH . '/sk.php')) { |
|
299 | + if (!file_exists(SECUREPATH.'/sk.php')) { |
|
300 | 300 | echo '[{'. |
301 | 301 | '"error" : "Error in settings.php file!<br>Check correctness of path indicated in file `includes/config/settings.php`.<br>Reload this page and retry.",'. |
302 | 302 | '"index" : ""'. |
@@ -312,8 +312,8 @@ discard block |
||
312 | 312 | $user_info = mysqli_fetch_array( |
313 | 313 | mysqli_query( |
314 | 314 | $db_link, |
315 | - 'SELECT id, pw, admin FROM ' . $pre . "users |
|
316 | - WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login)) . "'" |
|
315 | + 'SELECT id, pw, admin FROM '.$pre."users |
|
316 | + WHERE login='" . mysqli_escape_string($db_link, stripslashes($post_login))."'" |
|
317 | 317 | ) |
318 | 318 | ); |
319 | 319 | |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | echo '[{'. |
333 | 333 | '"error" : "",'. |
334 | 334 | '"index" : 1,'. |
335 | - '"info" : "' . base64_encode(json_encode( |
|
335 | + '"info" : "'.base64_encode(json_encode( |
|
336 | 336 | array(mysqli_escape_string($db_link, stripslashes($post_login)), $post_pwd, $user_info['id']) |
337 | - )) . '"'. |
|
337 | + )).'"'. |
|
338 | 338 | '}]'; |
339 | 339 | } else { |
340 | 340 | $superGlobal->put('user_granted', false, 'SESSION'); |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | $txt = ''; |
368 | 368 | $var_x = 1; |
369 | 369 | $tab = array( |
370 | - $abspath . '/includes/config/settings.php', |
|
371 | - $abspath . '/includes/libraries/csrfp/libs/', |
|
372 | - $abspath . '/install/', |
|
373 | - $abspath . '/includes/', |
|
374 | - $abspath . '/includes/config/', |
|
375 | - $abspath . '/includes/avatars/', |
|
376 | - $abspath . '/files/', |
|
377 | - $abspath . '/upload/', |
|
370 | + $abspath.'/includes/config/settings.php', |
|
371 | + $abspath.'/includes/libraries/csrfp/libs/', |
|
372 | + $abspath.'/install/', |
|
373 | + $abspath.'/includes/', |
|
374 | + $abspath.'/includes/config/', |
|
375 | + $abspath.'/includes/avatars/', |
|
376 | + $abspath.'/files/', |
|
377 | + $abspath.'/upload/', |
|
378 | 378 | ); |
379 | 379 | foreach ($tab as $elem) { |
380 | 380 | // try to create it if not existing |
@@ -383,11 +383,11 @@ discard block |
||
383 | 383 | } |
384 | 384 | // check if writable |
385 | 385 | if (is_writable($elem)) { |
386 | - $txt .= '<span>' . |
|
387 | - $elem . '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
|
386 | + $txt .= '<span>'. |
|
387 | + $elem.'<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
|
388 | 388 | } else { |
389 | - $txt .= '<span>' . |
|
390 | - $elem . '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
|
389 | + $txt .= '<span>'. |
|
390 | + $elem.'<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
|
391 | 391 | $okWritable = false; |
392 | 392 | } |
393 | 393 | ++$var_x; |
@@ -395,105 +395,105 @@ discard block |
||
395 | 395 | |
396 | 396 | if (!extension_loaded('openssl')) { |
397 | 397 | //$okExtensions = false; |
398 | - $txt .= '<span>PHP extension \"openssl\"' . |
|
398 | + $txt .= '<span>PHP extension \"openssl\"'. |
|
399 | 399 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
400 | 400 | } else { |
401 | - $txt .= '<span>PHP extension \"openssl\"' . |
|
401 | + $txt .= '<span>PHP extension \"openssl\"'. |
|
402 | 402 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
403 | 403 | } |
404 | 404 | if (!extension_loaded('gd')) { |
405 | 405 | //$okExtensions = false; |
406 | - $txt .= '<span>PHP extension \"gd\"' . |
|
406 | + $txt .= '<span>PHP extension \"gd\"'. |
|
407 | 407 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
408 | 408 | } else { |
409 | - $txt .= '<span>PHP extension \"gd\"' . |
|
409 | + $txt .= '<span>PHP extension \"gd\"'. |
|
410 | 410 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
411 | 411 | } |
412 | 412 | if (!extension_loaded('mbstring')) { |
413 | 413 | //$okExtensions = false; |
414 | - $txt .= '<span>PHP extension \"mbstring\"' . |
|
414 | + $txt .= '<span>PHP extension \"mbstring\"'. |
|
415 | 415 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
416 | 416 | } else { |
417 | - $txt .= '<span>PHP extension \"mbstring\"' . |
|
417 | + $txt .= '<span>PHP extension \"mbstring\"'. |
|
418 | 418 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
419 | 419 | } |
420 | 420 | if (!extension_loaded('bcmath')) { |
421 | 421 | //$okExtensions = false; |
422 | - $txt .= '<span>PHP extension \"bcmath\"' . |
|
422 | + $txt .= '<span>PHP extension \"bcmath\"'. |
|
423 | 423 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
424 | 424 | } else { |
425 | - $txt .= '<span>PHP extension \"bcmath\"' . |
|
425 | + $txt .= '<span>PHP extension \"bcmath\"'. |
|
426 | 426 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
427 | 427 | } |
428 | 428 | if (!extension_loaded('iconv')) { |
429 | 429 | //$okExtensions = false; |
430 | - $txt .= '<span>PHP extension \"iconv\"' . |
|
430 | + $txt .= '<span>PHP extension \"iconv\"'. |
|
431 | 431 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
432 | 432 | } else { |
433 | - $txt .= '<span>PHP extension \"iconv\"' . |
|
433 | + $txt .= '<span>PHP extension \"iconv\"'. |
|
434 | 434 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
435 | 435 | } |
436 | 436 | if (!extension_loaded('xml')) { |
437 | 437 | //$okExtensions = false; |
438 | - $txt .= '<span>PHP extension \"xml\"' . |
|
438 | + $txt .= '<span>PHP extension \"xml\"'. |
|
439 | 439 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
440 | 440 | } else { |
441 | - $txt .= '<span>PHP extension \"xml\"' . |
|
441 | + $txt .= '<span>PHP extension \"xml\"'. |
|
442 | 442 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
443 | 443 | } |
444 | 444 | if (!extension_loaded('curl')) { |
445 | - $txt .= '<span>PHP extension \"curl\"' . |
|
445 | + $txt .= '<span>PHP extension \"curl\"'. |
|
446 | 446 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
447 | 447 | } else { |
448 | - $txt .= '<span>PHP extension \"curl\"' . |
|
448 | + $txt .= '<span>PHP extension \"curl\"'. |
|
449 | 449 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
450 | 450 | } |
451 | 451 | if (!extension_loaded('gmp')) { |
452 | - $txt .= '<span>PHP extension \"gmp\"' . |
|
452 | + $txt .= '<span>PHP extension \"gmp\"'. |
|
453 | 453 | '<i class=\"fa-solid fa-circle-minus text-danger ml-2\"></i></span><br />'; |
454 | 454 | } else { |
455 | - $txt .= '<span>PHP extension \"gmp\"' . |
|
455 | + $txt .= '<span>PHP extension \"gmp\"'. |
|
456 | 456 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
457 | 457 | } |
458 | 458 | if (ini_get('max_execution_time') < 30) { |
459 | - $txt .= '<span>PHP \"Maximum ' . |
|
460 | - 'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds.' . |
|
461 | - ' Please try to set to 60s at least until Upgrade is finished. ' . |
|
459 | + $txt .= '<span>PHP \"Maximum '. |
|
460 | + 'execution time\" is set to '.ini_get('max_execution_time').' seconds.'. |
|
461 | + ' Please try to set to 60s at least until Upgrade is finished. '. |
|
462 | 462 | ' <img src=\"images/minus-circle.png\"></span> <br />'; |
463 | 463 | } else { |
464 | - $txt .= '<span>PHP \"Maximum ' . |
|
465 | - 'execution time\" is set to ' . ini_get('max_execution_time') . ' seconds' . |
|
464 | + $txt .= '<span>PHP \"Maximum '. |
|
465 | + 'execution time\" is set to '.ini_get('max_execution_time').' seconds'. |
|
466 | 466 | '<i class=\"fa-solid fa-circle-check text-success ml-2\"></i></span><br />'; |
467 | 467 | } |
468 | 468 | if (version_compare(phpversion(), MIN_PHP_VERSION, '<')) { |
469 | - $txt .= '<span>PHP version ' . |
|
470 | - phpversion() . ' is not OK (minimum is '.MIN_PHP_VERSION.') ' . |
|
469 | + $txt .= '<span>PHP version '. |
|
470 | + phpversion().' is not OK (minimum is '.MIN_PHP_VERSION.') '. |
|
471 | 471 | '<img src=\"images/minus-circle.png\"></span><br />'; |
472 | 472 | } else { |
473 | - $txt .= '<span>PHP version ' . |
|
474 | - phpversion() . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
473 | + $txt .= '<span>PHP version '. |
|
474 | + phpversion().' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
475 | 475 | '</span><br />'; |
476 | 476 | } |
477 | - $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<') ; |
|
478 | - $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<') ; |
|
477 | + $mysqlVersion = version_compare($db_link -> server_version, MIN_MYSQL_VERSION, '<'); |
|
478 | + $mariadbVersion = version_compare($db_link -> server_version, MIN_MARIADB_VERSION, '<'); |
|
479 | 479 | if ($mysqlVersion && $mariadbVersion) { |
480 | 480 | if ($mariadbVersion === '') { |
481 | - $txt .= '<span>MySQL version ' . |
|
482 | - $db_link -> server_version . ' is not OK (minimum is '.MIN_MYSQL_VERSION.') ' . |
|
481 | + $txt .= '<span>MySQL version '. |
|
482 | + $db_link -> server_version.' is not OK (minimum is '.MIN_MYSQL_VERSION.') '. |
|
483 | 483 | '<img src=\"images/minus-circle.png\"></span><br />'; |
484 | 484 | } else { |
485 | - $txt .= '<span>MySQL version ' . |
|
486 | - $db_link -> server_version . ' is not OK (minimum is '.MIN_MARIADB_VERSION.') ' . |
|
485 | + $txt .= '<span>MySQL version '. |
|
486 | + $db_link -> server_version.' is not OK (minimum is '.MIN_MARIADB_VERSION.') '. |
|
487 | 487 | '<img src=\"images/minus-circle.png\"></span><br />'; |
488 | 488 | } |
489 | 489 | } else { |
490 | 490 | if ($mariadbVersion === '') { |
491 | - $txt .= '<span>MySQL version ' . |
|
492 | - $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
491 | + $txt .= '<span>MySQL version '. |
|
492 | + $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
493 | 493 | '</span><br />'; |
494 | 494 | } else { |
495 | - $txt .= '<span>MySQL version ' . |
|
496 | - $db_link -> server_info . ' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
495 | + $txt .= '<span>MySQL version '. |
|
496 | + $db_link -> server_info.' is OK<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
497 | 497 | '</span><br />'; |
498 | 498 | } |
499 | 499 | |
@@ -503,22 +503,22 @@ discard block |
||
503 | 503 | // check if 2.1.27 already installed |
504 | 504 | if (defined(SECUREPATH) === true) { |
505 | 505 | $okEncryptKey = false; |
506 | - $defuse_file = SECUREPATH . '/teampass-seckey.txt'; |
|
506 | + $defuse_file = SECUREPATH.'/teampass-seckey.txt'; |
|
507 | 507 | if (file_exists($defuse_file)) { |
508 | 508 | $okEncryptKey = true; |
509 | 509 | $superGlobal->put('tp_defuse_installed', true, 'SESSION'); |
510 | - $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
510 | + $txt .= '<span>Defuse encryption key is defined<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
511 | 511 | '</span><br />'; |
512 | 512 | } |
513 | 513 | |
514 | 514 | if ($okEncryptKey === false) { |
515 | 515 | $superGlobal->put('tp_defuse_installed', false, 'SESSION'); |
516 | - $txt .= '<span>Encryption Key (SALT) ' . |
|
517 | - ' could not be recovered from ' . $defuse_file . ' ' . |
|
516 | + $txt .= '<span>Encryption Key (SALT) '. |
|
517 | + ' could not be recovered from '.$defuse_file.' '. |
|
518 | 518 | '<img src=\"images/minus-circle.png\"></span><br />'; |
519 | 519 | } else { |
520 | 520 | $okEncryptKey = true; |
521 | - $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>' . |
|
521 | + $txt .= '<span>Encryption Key (SALT) is available<i class=\"fa-solid fa-circle-check text-success ml-2\"></i>'. |
|
522 | 522 | '</span><br />'; |
523 | 523 | } |
524 | 524 | } else { |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | } |
535 | 535 | |
536 | 536 | echo '[{'. |
537 | - '"error" : "' . $error . '",'. |
|
538 | - '"info" : "' . $txt . '",'. |
|
537 | + '"error" : "'.$error.'",'. |
|
538 | + '"info" : "'.$txt.'",'. |
|
539 | 539 | '"index" : "'.($error === "" ? "" : $nextStep).'",'. |
540 | - '"infos" : "' . $okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; " . '"'. |
|
540 | + '"infos" : "'.$okWritable." ; ".$okExtensions." ; ".$okEncryptKey." ; ".'"'. |
|
541 | 541 | '}]'; |
542 | 542 | break; |
543 | 543 | |
@@ -562,14 +562,14 @@ discard block |
||
562 | 562 | if (@mysqli_fetch_row( |
563 | 563 | mysqli_query( |
564 | 564 | $db_link, |
565 | - 'SELECT valeur FROM ' . $pre . "misc |
|
565 | + 'SELECT valeur FROM '.$pre."misc |
|
566 | 566 | WHERE type='admin' AND intitule = 'utf8_enabled'" |
567 | 567 | ) |
568 | 568 | )) { |
569 | 569 | $cpmIsUTF8 = mysqli_fetch_row( |
570 | 570 | mysqli_query( |
571 | 571 | $db_link, |
572 | - 'SELECT valeur FROM ' . $pre . "misc |
|
572 | + 'SELECT valeur FROM '.$pre."misc |
|
573 | 573 | WHERE type='admin' AND intitule = 'utf8_enabled'" |
574 | 574 | ) |
575 | 575 | ); |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | // put TP in maintenance mode or not |
580 | 580 | @mysqli_query( |
581 | 581 | $db_link, |
582 | - "UPDATE `" . $pre . "misc` |
|
582 | + "UPDATE `".$pre."misc` |
|
583 | 583 | SET `valeur` = 'maintenance_mode' |
584 | - WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode . "'" |
|
584 | + WHERE type = 'admin' AND intitule = '" . $post_no_maintenance_mode."'" |
|
585 | 585 | ); |
586 | 586 | |
587 | 587 | echo '[{'. |
@@ -608,9 +608,9 @@ discard block |
||
608 | 608 | if (isset($post_prefix_before_convert) && $post_prefix_before_convert == 'true') { |
609 | 609 | $tables = mysqli_query($db_link, 'SHOW TABLES'); |
610 | 610 | while ($table = mysqli_fetch_row($tables)) { |
611 | - if (tableExists('old_' . $table[0]) != 1 && substr($table[0], 0, 4) != 'old_') { |
|
612 | - mysqli_query($db_link, 'CREATE TABLE old_' . $table[0] . ' LIKE ' . $table[0]); |
|
613 | - mysqli_query($db_link, 'INSERT INTO old_' . $table[0] . ' SELECT * FROM ' . $table[0]); |
|
611 | + if (tableExists('old_'.$table[0]) != 1 && substr($table[0], 0, 4) != 'old_') { |
|
612 | + mysqli_query($db_link, 'CREATE TABLE old_'.$table[0].' LIKE '.$table[0]); |
|
613 | + mysqli_query($db_link, 'INSERT INTO old_'.$table[0].' SELECT * FROM '.$table[0]); |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | } |
@@ -618,22 +618,22 @@ discard block |
||
618 | 618 | //convert database |
619 | 619 | mysqli_query( |
620 | 620 | $db_link, |
621 | - 'ALTER DATABASE `' . $database . '` |
|
621 | + 'ALTER DATABASE `'.$database.'` |
|
622 | 622 | DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' |
623 | 623 | ); |
624 | 624 | |
625 | 625 | //convert tables |
626 | - $res = mysqli_query($db_link, 'SHOW TABLES FROM `' . $database . '`'); |
|
626 | + $res = mysqli_query($db_link, 'SHOW TABLES FROM `'.$database.'`'); |
|
627 | 627 | while ($table = mysqli_fetch_row($res)) { |
628 | 628 | if (substr($table[0], 0, 4) != 'old_') { |
629 | 629 | mysqli_query( |
630 | 630 | $db_link, |
631 | - 'ALTER TABLE ' . $database . '.`{$table[0]}` |
|
631 | + 'ALTER TABLE '.$database.'.`{$table[0]}` |
|
632 | 632 | CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci' |
633 | 633 | ); |
634 | 634 | mysqli_query( |
635 | 635 | $db_link, |
636 | - 'ALTER TABLE' . $database . '.`{$table[0]}` |
|
636 | + 'ALTER TABLE'.$database.'.`{$table[0]}` |
|
637 | 637 | DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci' |
638 | 638 | ); |
639 | 639 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | //Do a copy of the existing file |
671 | 671 | if (!copy( |
672 | 672 | $settingsFile, |
673 | - $settingsFile . '.' . date( |
|
673 | + $settingsFile.'.'.date( |
|
674 | 674 | 'Y_m_d_H_i_s', |
675 | 675 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
676 | 676 | ) |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | // CHeck if old sk.php exists. |
688 | 688 | // If yes then get keys to database and delete it |
689 | 689 | if (empty($post_sk_path) === false || defined('SECUREPATH') === true) { |
690 | - $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH) . '/sk.php'; |
|
690 | + $filename = (empty($post_sk_path) === false ? $post_sk_path : SECUREPATH).'/sk.php'; |
|
691 | 691 | if (file_exists($filename)) { |
692 | 692 | include_once $filename; |
693 | 693 | unlink($filename); |
@@ -696,63 +696,63 @@ discard block |
||
696 | 696 | // SKEY |
697 | 697 | $tmp = mysqli_query( |
698 | 698 | $db_link, |
699 | - "SELECT INTO `" . $pre . "misc` |
|
699 | + "SELECT INTO `".$pre."misc` |
|
700 | 700 | WHERE type = 'admin' AND intitule = 'duo_skey'" |
701 | 701 | ); |
702 | 702 | if ($tmp) { |
703 | 703 | mysqli_query( |
704 | 704 | $db_link, |
705 | - "UPDATE `" . $pre . "misc` |
|
706 | - set valeur = '" . SKEY . "', type = 'admin', intitule = 'duo_skey'" |
|
705 | + "UPDATE `".$pre."misc` |
|
706 | + set valeur = '" . SKEY."', type = 'admin', intitule = 'duo_skey'" |
|
707 | 707 | ); |
708 | 708 | } else { |
709 | 709 | mysqli_query( |
710 | 710 | $db_link, |
711 | - "INSERT INTO `" . $pre . "misc` |
|
711 | + "INSERT INTO `".$pre."misc` |
|
712 | 712 | (`valeur`, `type`, `intitule`) |
713 | - VALUES ('" . SKEY . "', 'admin', 'duo_skey')" |
|
713 | + VALUES ('" . SKEY."', 'admin', 'duo_skey')" |
|
714 | 714 | ); |
715 | 715 | } |
716 | 716 | |
717 | 717 | // IKEY |
718 | 718 | $tmp = mysqli_query( |
719 | 719 | $db_link, |
720 | - "SELECT INTO `" . $pre . "misc` |
|
720 | + "SELECT INTO `".$pre."misc` |
|
721 | 721 | WHERE type = 'admin' AND intitule = 'duo_ikey'" |
722 | 722 | ); |
723 | 723 | if ($tmp) { |
724 | 724 | mysqli_query( |
725 | 725 | $db_link, |
726 | - "UPDATE `" . $pre . "misc` |
|
727 | - set valeur = '" . IKEY . "', type = 'admin', intitule = 'duo_ikey'" |
|
726 | + "UPDATE `".$pre."misc` |
|
727 | + set valeur = '" . IKEY."', type = 'admin', intitule = 'duo_ikey'" |
|
728 | 728 | ); |
729 | 729 | } else { |
730 | 730 | mysqli_query( |
731 | 731 | $db_link, |
732 | - "INSERT INTO `" . $pre . "misc` |
|
732 | + "INSERT INTO `".$pre."misc` |
|
733 | 733 | (`valeur`, `type`, `intitule`) |
734 | - VALUES ('" . IKEY . "', 'admin', 'duo_ikey')" |
|
734 | + VALUES ('" . IKEY."', 'admin', 'duo_ikey')" |
|
735 | 735 | ); |
736 | 736 | } |
737 | 737 | |
738 | 738 | // HOST |
739 | 739 | $tmp = mysqli_query( |
740 | 740 | $db_link, |
741 | - "SELECT INTO `" . $pre . "misc` |
|
741 | + "SELECT INTO `".$pre."misc` |
|
742 | 742 | WHERE type = 'admin' AND intitule = 'duo_host'" |
743 | 743 | ); |
744 | 744 | if ($tmp) { |
745 | 745 | mysqli_query( |
746 | 746 | $db_link, |
747 | - "UPDATE `" . $pre . "misc` |
|
748 | - set valeur = '" . HOST . "', type = 'admin', intitule = 'duo_host'" |
|
747 | + "UPDATE `".$pre."misc` |
|
748 | + set valeur = '" . HOST."', type = 'admin', intitule = 'duo_host'" |
|
749 | 749 | ); |
750 | 750 | } else { |
751 | 751 | mysqli_query( |
752 | 752 | $db_link, |
753 | - "INSERT INTO `" . $pre . "misc` |
|
753 | + "INSERT INTO `".$pre."misc` |
|
754 | 754 | (`valeur`, `type`, `intitule`) |
755 | - VALUES ('" . HOST . "', 'admin', 'duo_host')" |
|
755 | + VALUES ('" . HOST."', 'admin', 'duo_host')" |
|
756 | 756 | ); |
757 | 757 | } |
758 | 758 | } |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | utf8_encode( |
772 | 772 | '<?php |
773 | 773 | // DATABASE connexion parameters |
774 | - define("DB_HOST", "' . DB_HOST . '"); |
|
775 | - define("DB_USER", "' . DB_USER . '"); |
|
776 | - define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD) . '"); |
|
777 | - define("DB_NAME", "' . DB_NAME . '"); |
|
778 | - define("DB_PREFIX", "' . DB_PREFIX . '"); |
|
779 | - define("DB_PORT", "' . DB_PORT . '"); |
|
780 | - define("DB_ENCODING", "' . DB_ENCODING . '"); |
|
774 | + define("DB_HOST", "' . DB_HOST.'"); |
|
775 | + define("DB_USER", "' . DB_USER.'"); |
|
776 | + define("DB_PASSWD", "' . defuse_return_decrypted(DB_PASSWD).'"); |
|
777 | + define("DB_NAME", "' . DB_NAME.'"); |
|
778 | + define("DB_PREFIX", "' . DB_PREFIX.'"); |
|
779 | + define("DB_PORT", "' . DB_PORT.'"); |
|
780 | + define("DB_ENCODING", "' . DB_ENCODING.'"); |
|
781 | 781 | define("DB_SSL", false); // if DB over SSL then comment this line |
782 | 782 | // if DB over SSL then uncomment the following lines |
783 | 783 | //define("DB_SSL", array( |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | define("DB_CONNECT_OPTIONS", array( |
791 | 791 | MYSQLI_OPT_CONNECT_TIMEOUT => 10 |
792 | 792 | )); |
793 | - define("SECUREPATH", "' . SECUREPATH. '"); |
|
793 | + define("SECUREPATH", "' . SECUREPATH.'"); |
|
794 | 794 | |
795 | 795 | if (isset($_SESSION[\'settings\'][\'timezone\']) === true) { |
796 | 796 | date_default_timezone_set($_SESSION[\'settings\'][\'timezone\']); |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | if ( |
886 | 886 | copy( |
887 | 887 | $csrfp_file, |
888 | - $csrfp_file . '.' . date( |
|
888 | + $csrfp_file.'.'.date( |
|
889 | 889 | 'Y_m_d_H_i_s', |
890 | 890 | mktime((int) date('H'), (int) date('i'), (int) date('s'), (int) date('m'), (int) date('d'), (int) date('y')) |
891 | 891 | ) |
@@ -904,17 +904,17 @@ discard block |
||
904 | 904 | unlink($csrfp_file); // delete existing csrfp.config file |
905 | 905 | copy($csrfp_file_sample, $csrfp_file); // make a copy of csrfp.config.sample file |
906 | 906 | $data = file_get_contents('../includes/libraries/csrfp/libs/csrfp.config.php'); |
907 | - $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "' . bin2hex(openssl_random_pseudo_bytes(25)) . '"', $data); |
|
907 | + $newdata = str_replace('"CSRFP_TOKEN" => ""', '"CSRFP_TOKEN" => "'.bin2hex(openssl_random_pseudo_bytes(25)).'"', $data); |
|
908 | 908 | $newdata = str_replace('"tokenLength" => "25"', '"tokenLength" => "50"', $newdata); |
909 | - $jsUrl = $post_url_path . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
910 | - $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "' . $jsUrl . '"', $newdata); |
|
909 | + $jsUrl = $post_url_path.'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
910 | + $newdata = str_replace('"jsUrl" => ""', '"jsUrl" => "'.$jsUrl.'"', $newdata); |
|
911 | 911 | $newdata = str_replace('"verifyGetFor" => array()', '"verifyGetFor" => array("*page=items&type=duo_check*")', $newdata); |
912 | 912 | file_put_contents('../includes/libraries/csrfp/libs/csrfp.config.php', $newdata); |
913 | 913 | |
914 | 914 | // Mark a tag to force Install stuff (folders, files and table) to be cleanup while first login |
915 | 915 | mysqli_query( |
916 | 916 | $db_link, |
917 | - 'INSERT INTO `' . $pre . 'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")' |
|
917 | + 'INSERT INTO `'.$pre.'misc` (`type`, `intitule`, `valeur`) VALUES ("install", "clear_install_folder", "true")' |
|
918 | 918 | ); |
919 | 919 | |
920 | 920 | array_push( |
@@ -936,19 +936,19 @@ discard block |
||
936 | 936 | |
937 | 937 | // update with correct version |
938 | 938 | // 1st - check if teampass_version exists |
939 | - $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre . "misc WHERE type = 'admin' AND intitule = 'teampass_version';")); |
|
939 | + $data = mysqli_fetch_row(mysqli_query($db_link, "SELECT COUNT(*) FROM ".$pre."misc WHERE type = 'admin' AND intitule = 'teampass_version';")); |
|
940 | 940 | if ((int) $data[0] === 0) { |
941 | 941 | // change variable name and put version |
942 | 942 | mysqli_query( |
943 | 943 | $db_link, |
944 | - "UPDATE `" . $pre . "misc` |
|
944 | + "UPDATE `".$pre."misc` |
|
945 | 945 | SET `valeur` = '".TP_VERSION."', `intitule` = 'teampass_version' |
946 | 946 | WHERE intitule = 'cpassman_version' AND type = 'admin';" |
947 | 947 | ); |
948 | 948 | } else { |
949 | 949 | mysqli_query( |
950 | 950 | $db_link, |
951 | - "UPDATE `" . $pre . "misc` |
|
951 | + "UPDATE `".$pre."misc` |
|
952 | 952 | SET `valeur` = '".TP_VERSION."' |
953 | 953 | WHERE intitule = 'teampass_version' AND type = 'admin';" |
954 | 954 | ); |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | ->setDayOfMonth('*') |
979 | 979 | ->setMonths('*') |
980 | 980 | ->setDayOfWeek('*') |
981 | - ->setTaskCommandLine($phpLocation['path'] . ' ' . $SETTINGS['cpassman_dir'] . '/sources/scheduler.php') |
|
981 | + ->setTaskCommandLine($phpLocation['path'].' '.$SETTINGS['cpassman_dir'].'/sources/scheduler.php') |
|
982 | 982 | ->setComments('Teampass scheduler'); |
983 | 983 | |
984 | 984 | $crontabRepository->addJob($crontabJob); |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | $mysqli = new mysqli($server, $user, $pass, $database, $port); |
1036 | 1036 | if ($mysqli->connect_error) { |
1037 | - die('Error : (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error); |
|
1037 | + die('Error : ('.$mysqli->connect_errno.') '.$mysqli->connect_error); |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | $results = $mysqli->query('SHOW TABLES'); |
@@ -1044,11 +1044,11 @@ discard block |
||
1044 | 1044 | } |
1045 | 1045 | |
1046 | 1046 | // Prepare file |
1047 | - $backup_file_name = 'sql-backup-' . date('d-m-Y--h-i-s') . '.sql'; |
|
1048 | - $fp = fopen('../files/' . $backup_file_name, 'a'); |
|
1047 | + $backup_file_name = 'sql-backup-'.date('d-m-Y--h-i-s').'.sql'; |
|
1048 | + $fp = fopen('../files/'.$backup_file_name, 'a'); |
|
1049 | 1049 | |
1050 | 1050 | foreach ($mtables as $table) { |
1051 | - $contents = '-- Table `' . $table . "` --\n"; |
|
1051 | + $contents = '-- Table `'.$table."` --\n"; |
|
1052 | 1052 | if (fwrite($fp, $contents) === false) { |
1053 | 1053 | echo '[{'. |
1054 | 1054 | '"error" : "Backup fails - please do it manually",'. |
@@ -1058,9 +1058,9 @@ discard block |
||
1058 | 1058 | return false; |
1059 | 1059 | } |
1060 | 1060 | |
1061 | - $results = $mysqli->query('SHOW CREATE TABLE ' . $table); |
|
1061 | + $results = $mysqli->query('SHOW CREATE TABLE '.$table); |
|
1062 | 1062 | while ($row = $results->fetch_array()) { |
1063 | - $contents = $row[1] . ";\n\n"; |
|
1063 | + $contents = $row[1].";\n\n"; |
|
1064 | 1064 | if (fwrite($fp, $contents) === false) { |
1065 | 1065 | echo '[{'. |
1066 | 1066 | '"error" : "Backup fails - please do it manually",'. |
@@ -1071,14 +1071,14 @@ discard block |
||
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | |
1074 | - $results = $mysqli->query('SELECT * FROM ' . $table); |
|
1074 | + $results = $mysqli->query('SELECT * FROM '.$table); |
|
1075 | 1075 | $row_count = $results->num_rows; |
1076 | 1076 | $fields = $results->fetch_fields(); |
1077 | 1077 | $fields_count = count($fields); |
1078 | 1078 | |
1079 | - $insert_head = 'INSERT INTO `' . $table . '` ('; |
|
1079 | + $insert_head = 'INSERT INTO `'.$table.'` ('; |
|
1080 | 1080 | for ($i = 0; $i < $fields_count; ++$i) { |
1081 | - $insert_head .= '`' . $fields[$i]->name . '`'; |
|
1081 | + $insert_head .= '`'.$fields[$i]->name.'`'; |
|
1082 | 1082 | if ($i < $fields_count - 1) { |
1083 | 1083 | $insert_head .= ', '; |
1084 | 1084 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | break; |
1128 | 1128 | default: |
1129 | 1129 | //$contents .= "'".$row_content."'"; |
1130 | - if (fwrite($fp, "'" . $row_content . "'") === false) { |
|
1130 | + if (fwrite($fp, "'".$row_content."'") === false) { |
|
1131 | 1131 | echo '[{'. |
1132 | 1132 | '"error" : "Backup fails - please do it manually",'. |
1133 | 1133 | '"index" : ""'. |
@@ -191,18 +191,27 @@ |
||
191 | 191 | define("SECUREPATH", "' . str_replace('\\', '\\\\', SECUREPATH) . '");'; |
192 | 192 | define("SECUREFILE", "' . SECUREFILE. '"); |
193 | 193 | |
194 | - if (defined('IKEY') === true) $settingsTxt .= ' |
|
194 | + if (defined('IKEY') === true) { |
|
195 | + $settingsTxt .= ' |
|
195 | 196 | define("IKEY", "' . IKEY . '");'; |
196 | - else $settingsTxt .= ' |
|
197 | + } else { |
|
198 | + $settingsTxt .= ' |
|
197 | 199 | define("IKEY", "");'; |
198 | - if (defined('SKEY') === true) $settingsTxt .= ' |
|
200 | + } |
|
201 | + if (defined('SKEY') === true) { |
|
202 | + $settingsTxt .= ' |
|
199 | 203 | define("SKEY", "' . SKEY . '");'; |
200 | - else $settingsTxt .= ' |
|
204 | + } else { |
|
205 | + $settingsTxt .= ' |
|
201 | 206 | define("SKEY", "");'; |
202 | - if (defined('HOST') === true) $settingsTxt .= ' |
|
207 | + } |
|
208 | + if (defined('HOST') === true) { |
|
209 | + $settingsTxt .= ' |
|
203 | 210 | define("HOST", "' . HOST . '");'; |
204 | - else $settingsTxt .= ' |
|
211 | + } else { |
|
212 | + $settingsTxt .= ' |
|
205 | 213 | define("HOST", "");'; |
214 | + } |
|
206 | 215 | |
207 | 216 | |
208 | 217 | $settingsTxt .= ' |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | $port |
82 | 82 | ); |
83 | 83 | } else { |
84 | - $res = 'Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()); |
|
85 | - echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: ' . addslashes(mysqli_connect_error()) . '!"}]'; |
|
84 | + $res = 'Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()); |
|
85 | + echo '[{"finish":"1", "msg":"", "error":"Impossible to get connected to server. Error is: '.addslashes(mysqli_connect_error()).'!"}]'; |
|
86 | 86 | mysqli_close($db_link); |
87 | 87 | exit(); |
88 | 88 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // OPERATION - 20231017_1 - remove all existing keys |
148 | 148 | // if item is personal and user is not owner |
149 | 149 | |
150 | - installPurgeUnnecessaryKeys(true, 0,$pre); |
|
150 | + installPurgeUnnecessaryKeys(true, 0, $pre); |
|
151 | 151 | } |
152 | 152 | // Return back |
153 | 153 | echo '[{"finish":"'.$finish.'" , "next":"", "error":"", "total":"'.$total.'"}]'; |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | $items = mysqli_query( |
162 | 162 | $db_link, |
163 | 163 | "select i.id as id, ls.date as datetime |
164 | - from `" . $pre . "items` as i |
|
165 | - inner join `" . $pre . "log_items` as ls on ls.id_item = i.id |
|
164 | + from `" . $pre."items` as i |
|
165 | + inner join `" . $pre."log_items` as ls on ls.id_item = i.id |
|
166 | 166 | WHERE ls.action = 'at_creation' AND i.created_at IS NULL |
167 | 167 | LIMIT " . $post_nb.";" |
168 | 168 | ); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // update created_at field |
172 | 172 | mysqli_query( |
173 | 173 | $db_link, |
174 | - "UPDATE `" . $pre . "items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
174 | + "UPDATE `".$pre."items` SET created_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $remainingItems = mysqli_num_rows( |
181 | 181 | mysqli_query( |
182 | 182 | $db_link, |
183 | - "SELECT * FROM `" . $pre . "items` WHERE created_at IS NULL" |
|
183 | + "SELECT * FROM `".$pre."items` WHERE created_at IS NULL" |
|
184 | 184 | ) |
185 | 185 | ); |
186 | 186 | return $remainingItems > 0 ? 0 : 1; |
@@ -192,15 +192,15 @@ discard block |
||
192 | 192 | // loop on items - updated_at |
193 | 193 | $items = mysqli_query( |
194 | 194 | $db_link, |
195 | - "select i.id as id, (select date from " . $pre . "log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime |
|
196 | - from `" . $pre . "items` as i;" |
|
195 | + "select i.id as id, (select date from ".$pre."log_items where action = 'at_modification' and id_item=id order by date DESC limit 1) as datetime |
|
196 | + from `" . $pre."items` as i;" |
|
197 | 197 | ); |
198 | 198 | while ($item = mysqli_fetch_assoc($items)) { |
199 | 199 | if (is_null($item['datetime']) === false) { |
200 | 200 | // update updated_at field |
201 | 201 | mysqli_query( |
202 | 202 | $db_link, |
203 | - "UPDATE `" . $pre . "items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
203 | + "UPDATE `".$pre."items` SET updated_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
204 | 204 | ); |
205 | 205 | } |
206 | 206 | } |
@@ -214,15 +214,15 @@ discard block |
||
214 | 214 | // loop on items - deleted_at |
215 | 215 | $items = mysqli_query( |
216 | 216 | $db_link, |
217 | - "select i.id as id, (select date from " . $pre . "log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime |
|
218 | - from `" . $pre . "items` as i;" |
|
217 | + "select i.id as id, (select date from ".$pre."log_items where action = 'at_deleted' and id_item=id order by date DESC limit 1) as datetime |
|
218 | + from `" . $pre."items` as i;" |
|
219 | 219 | ); |
220 | 220 | while ($item = mysqli_fetch_assoc($items)) { |
221 | 221 | if (is_null($item['datetime']) === false) { |
222 | 222 | // update updated_at field |
223 | 223 | mysqli_query( |
224 | 224 | $db_link, |
225 | - "UPDATE `" . $pre . "items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
225 | + "UPDATE `".$pre."items` SET deleted_at = '".$item['datetime']."' WHERE id = ".$item['id'] |
|
226 | 226 | ); |
227 | 227 | } |
228 | 228 | } |
@@ -238,14 +238,14 @@ discard block |
||
238 | 238 | * @param integer $user_id |
239 | 239 | * @return void |
240 | 240 | */ |
241 | -function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id=0, string $pre) |
|
241 | +function installPurgeUnnecessaryKeys(bool $allUsers = true, int $user_id = 0, string $pre) |
|
242 | 242 | { |
243 | 243 | global $db_link; |
244 | 244 | if ($allUsers === true) { |
245 | 245 | $users = mysqli_query( |
246 | 246 | $db_link, |
247 | 247 | 'SELECT id |
248 | - FROM ' . $pre . 'users |
|
248 | + FROM ' . $pre.'users |
|
249 | 249 | WHERE id NOT IN ('.OTV_USER_ID.', '.TP_USER_ID.', '.SSH_USER_ID.', '.API_USER_ID.') |
250 | 250 | ORDER BY login ASC' |
251 | 251 | ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * @param integer $user_id |
264 | 264 | * @return void |
265 | 265 | */ |
266 | -function installPurgeUnnecessaryKeysForUser(int $user_id=0, string $pre) |
|
266 | +function installPurgeUnnecessaryKeysForUser(int $user_id = 0, string $pre) |
|
267 | 267 | { |
268 | 268 | global $db_link; |
269 | 269 | if ($user_id === 0) { |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | $result = mysqli_query( |
274 | 274 | $db_link, |
275 | 275 | 'SELECT id |
276 | - FROM ' . $pre . 'items AS i |
|
277 | - INNER JOIN ' . $pre . 'log_items AS li ON li.id_item = i.id |
|
276 | + FROM ' . $pre.'items AS i |
|
277 | + INNER JOIN ' . $pre.'log_items AS li ON li.id_item = i.id |
|
278 | 278 | WHERE i.perso = 1 AND li.action = "at_creation" AND li.id_user IN ('.TP_USER_ID.', '.$user_id.')', |
279 | 279 | ); |
280 | 280 | $rowcount = mysqli_num_rows($result); |
@@ -290,25 +290,25 @@ discard block |
||
290 | 290 | // Item keys |
291 | 291 | mysqli_query( |
292 | 292 | $db_link, |
293 | - 'DELETE FROM ' . $pre . 'sharekeys_items |
|
293 | + 'DELETE FROM '.$pre.'sharekeys_items |
|
294 | 294 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
295 | 295 | ); |
296 | 296 | // Files keys |
297 | 297 | mysqli_query( |
298 | 298 | $db_link, |
299 | - 'DELETE FROM ' . $pre . 'sharekeys_files |
|
299 | + 'DELETE FROM '.$pre.'sharekeys_files |
|
300 | 300 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
301 | 301 | ); |
302 | 302 | // Fields keys |
303 | 303 | mysqli_query( |
304 | 304 | $db_link, |
305 | - 'DELETE FROM ' . $pre . 'sharekeys_fields |
|
305 | + 'DELETE FROM '.$pre.'sharekeys_fields |
|
306 | 306 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
307 | 307 | ); |
308 | 308 | // Logs keys |
309 | 309 | mysqli_query( |
310 | 310 | $db_link, |
311 | - 'DELETE FROM ' . $pre . 'sharekeys_logs |
|
311 | + 'DELETE FROM '.$pre.'sharekeys_logs |
|
312 | 312 | WHERE object_id IN ('.$pfItemsList.') AND user_id NOT IN ('.TP_USER_ID.', '.$user_id.')' |
313 | 313 | ); |
314 | 314 | } |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | // force full list of folders |
341 | 341 | if (count($folderIds) === 0) { |
342 | 342 | $result = $mysqli2->query('SELECT id |
343 | - FROM ' . $pre . 'nested_tree |
|
343 | + FROM ' . $pre.'nested_tree |
|
344 | 344 | WHERE personal_folder = 0', |
345 | 345 | ); |
346 | 346 | $rowcount = $result->num_rows; |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | $arrCatList = array(); |
362 | 362 | $result = $mysqli2->query('SELECT c.id, c.title, c.level, c.type, c.masked, c.order, c.encrypted_data, c.role_visibility, c.is_mandatory, |
363 | 363 | f.id_category AS category_id |
364 | - FROM ' . $pre . 'categories_folders AS f |
|
365 | - INNER JOIN ' . $pre . 'categories AS c ON (f.id_category = c.parent_id) |
|
364 | + FROM ' . $pre.'categories_folders AS f |
|
365 | + INNER JOIN ' . $pre.'categories AS c ON (f.id_category = c.parent_id) |
|
366 | 366 | WHERE id_folder = '.$folder |
367 | 367 | ); |
368 | 368 | $rowcount = $result->num_rows; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // Now get complexity |
388 | 388 | $valTemp = ''; |
389 | 389 | $result = $mysqli2->query('SELECT valeur |
390 | - FROM ' . $pre . 'misc |
|
390 | + FROM ' . $pre.'misc |
|
391 | 391 | WHERE type = "complex" AND intitule = '.$folder |
392 | 392 | ); |
393 | 393 | $rowcount = $result->num_rows; |
@@ -404,21 +404,21 @@ discard block |
||
404 | 404 | // Now get Roles |
405 | 405 | $valTemp = ''; |
406 | 406 | $result = $mysqli2->query('SELECT t.title |
407 | - FROM ' . $pre . 'roles_values as v |
|
408 | - INNER JOIN ' . $pre . 'roles_title as t ON (v.role_id = t.id) |
|
407 | + FROM ' . $pre.'roles_values as v |
|
408 | + INNER JOIN ' . $pre.'roles_title as t ON (v.role_id = t.id) |
|
409 | 409 | WHERE v.folder_id = '.$folder.' |
410 | 410 | GROUP BY title' |
411 | 411 | ); |
412 | 412 | $rowcount = $result->num_rows; |
413 | 413 | if ($rowcount > 0) { |
414 | 414 | while ($row = $result->fetch_assoc()) { |
415 | - $valTemp .= (empty($valTemp) === true ? '' : ' - ') . $row['title']; |
|
415 | + $valTemp .= (empty($valTemp) === true ? '' : ' - ').$row['title']; |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | $arr_data['visibilityRoles'] = $valTemp; |
419 | 419 | |
420 | 420 | // now save in DB |
421 | - $mysqli2->query("UPDATE " . $pre . "nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder); |
|
421 | + $mysqli2->query("UPDATE ".$pre."nested_tree SET categories = '".json_encode($arr_data)."' WHERE id = ".$folder); |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | mysqli_close($mysqli2); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | function installHandleConfigFile($action, $SETTINGS, $field = null, $value = null) |
439 | 439 | { |
440 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
440 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
441 | 441 | $filename = '../includes/config/settings.php'; |
442 | 442 | include_once '../sources/main.functions.php'; |
443 | 443 | $pass = defuse_return_decrypted(DB_PASSWD); |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
453 | 453 | // perform a copy |
454 | 454 | if (file_exists($tp_config_file)) { |
455 | - if (! copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
456 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
455 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
456 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
457 | 457 | } |
458 | 458 | } |
459 | 459 | |
@@ -464,13 +464,13 @@ discard block |
||
464 | 464 | $data[2] = "\$SETTINGS = array (\n"; |
465 | 465 | |
466 | 466 | $result = $mysqli2->query('SELECT * |
467 | - FROM ' . $pre . 'misc |
|
467 | + FROM ' . $pre.'misc |
|
468 | 468 | WHERE type = "admin"' |
469 | 469 | ); |
470 | 470 | $rowcount = $result->num_rows; |
471 | 471 | if ($rowcount > 0) { |
472 | 472 | while ($row = $result->fetch_assoc()) { |
473 | - array_push($data, " '" . $row['intitule'] . "' => '" . htmlspecialchars_decode($row['valeur'], ENT_COMPAT) . "',\n"); |
|
473 | + array_push($data, " '".$row['intitule']."' => '".htmlspecialchars_decode($row['valeur'], ENT_COMPAT)."',\n"); |
|
474 | 474 | } |
475 | 475 | } |
476 | 476 | array_push($data, ");\n"); |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | break; |
486 | 486 | } |
487 | 487 | |
488 | - if (stristr($line, "'" . $field . "' => '")) { |
|
489 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT) . "',\n"; |
|
488 | + if (stristr($line, "'".$field."' => '")) { |
|
489 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n"; |
|
490 | 490 | $bFound = true; |
491 | 491 | break; |
492 | 492 | } |
493 | 493 | ++$inc; |
494 | 494 | } |
495 | 495 | if ($bFound === false) { |
496 | - $data[$inc] = " '" . $field . "' => '" . htmlspecialchars_decode($value ?? '', ENT_COMPAT). "',\n);\n"; |
|
496 | + $data[$inc] = " '".$field."' => '".htmlspecialchars_decode($value ?? '', ENT_COMPAT)."',\n);\n"; |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | mysqli_close($mysqli2); |
@@ -41,4 +41,4 @@ |
||
41 | 41 | } else { |
42 | 42 | $finished = 0; |
43 | 43 | } |
44 | -echo '[{"finish":"' . $finished . '", "scriptname":"' . $scripts_list[$post_file_number][0] . '", "parameter":"' . $scripts_list[$post_file_number][1] . '"}]'; |
|
44 | +echo '[{"finish":"'.$finished.'", "scriptname":"'.$scripts_list[$post_file_number][0].'", "parameter":"'.$scripts_list[$post_file_number][1].'"}]'; |