@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ) { |
75 | 75 | // Not allowed page |
76 | 76 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
77 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
77 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
78 | 78 | exit; |
79 | 79 | } |
80 | 80 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | $post_isNewItem = $request->request->filter('isNewItem', null, FILTER_SANITIZE_NUMBER_INT); |
108 | 108 | $post_randomId = $request->request->filter('randomId', null, FILTER_SANITIZE_NUMBER_INT); |
109 | 109 | $post_isPersonal = $request->request->filter('isPersonal', null, FILTER_SANITIZE_NUMBER_INT); |
110 | -$post_fileSize= $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT); |
|
110 | +$post_fileSize = $request->request->filter('file_size', null, FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | $chunk = $request->request->filter('chunk', 0, FILTER_SANITIZE_NUMBER_INT); |
112 | 112 | $chunks = $request->request->filter('chunks', 0, FILTER_SANITIZE_NUMBER_INT); |
113 | 113 | $fileName = $request->request->filter('name', '', FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
@@ -122,10 +122,10 @@ discard block |
||
122 | 122 | $unit = strtoupper(substr(trim($POST_MAX_SIZE), -1)); // Assurez-vous de bien gérer les espaces éventuels |
123 | 123 | $units = ['G' => 1073741824, 'M' => 1048576, 'K' => 1024]; |
124 | 124 | $multiplier = $units[$unit] ?? 1; // Vérifie si l'unité est dans le tableau, sinon 1 |
125 | - $maxSize = (int)$POST_MAX_SIZE * $multiplier; |
|
125 | + $maxSize = (int) $POST_MAX_SIZE * $multiplier; |
|
126 | 126 | |
127 | 127 | // CHeck if the POST is too big |
128 | - if (!empty($_SERVER['CONTENT_LENGTH']) && (int)$_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) { |
|
128 | + if (!empty($_SERVER['CONTENT_LENGTH']) && (int) $_SERVER['CONTENT_LENGTH'] > $maxSize && $maxSize > 0) { |
|
129 | 129 | handleAttachmentError('POST exceeded maximum allowed size.', 111, 413); |
130 | 130 | } |
131 | 131 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | handleAttachmentError('File exceeds the maximum allowed size', 120, 413); |
135 | 135 | die(); |
136 | 136 | } |
137 | - if (WIP === true) error_log('POST_MAX_SIZE: ' . $POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
137 | + if (WIP === true) error_log('POST_MAX_SIZE: '.$POST_MAX_SIZE." - CONTENT_LENGTH: ".$_SERVER['CONTENT_LENGTH']." - UNIT: ".$unit." - MAX: ".$maxSize." - MULTIPLIER: ".$multiplier." - FILE_SIZE: ".$post_fileSize); |
|
138 | 138 | |
139 | 139 | // delete expired tokens |
140 | 140 | DB::delete(prefixTable('tokens'), 'end_timestamp < %i', time()); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | // check if token is expired |
186 | 186 | $data = DB::queryFirstRow( |
187 | 187 | 'SELECT end_timestamp |
188 | - FROM ' . prefixTable('tokens') . ' |
|
188 | + FROM ' . prefixTable('tokens').' |
|
189 | 189 | WHERE user_id = %i AND token = %s', |
190 | 190 | $session->get('user-id'), |
191 | 191 | $post_user_token |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | |
219 | 219 | // HTTP headers for no cache etc |
220 | 220 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
221 | -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
221 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
222 | 222 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
223 | 223 | header('Cache-Control: post-check=0, pre-check=0', false); |
224 | 224 | |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | // Validate file name (for our purposes we'll just remove invalid characters) |
257 | 257 | $file_name = preg_replace('[^A-Za-z0-9]', '', strtolower(basename($_FILES['file']['name']))); |
258 | 258 | if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { |
259 | - handleAttachmentError('Invalid file name: ' . $file_name . '.', 114); |
|
259 | + handleAttachmentError('Invalid file name: '.$file_name.'.', 114); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | // Validate file extension |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | $ext, |
270 | 270 | explode( |
271 | 271 | ',', |
272 | - $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] . |
|
273 | - ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext'] |
|
272 | + $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext']. |
|
273 | + ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext'] |
|
274 | 274 | ) |
275 | 275 | ) === false |
276 | 276 | ) { |
@@ -283,24 +283,24 @@ discard block |
||
283 | 283 | |
284 | 284 | // Clean the fileName for security reasons |
285 | 285 | $fileInfo = pathinfo($fileName); |
286 | -$fileName = base64_encode($fileInfo['filename']) . '.' . $fileInfo['extension']; |
|
286 | +$fileName = base64_encode($fileInfo['filename']).'.'.$fileInfo['extension']; |
|
287 | 287 | $fileFullSize = 0; |
288 | 288 | |
289 | 289 | // Make sure the fileName is unique but only if chunking is disabled |
290 | -if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) { |
|
290 | +if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) { |
|
291 | 291 | $ext = strrpos($fileName, '.'); |
292 | 292 | $fileNameA = substr($fileName, 0, $ext); |
293 | 293 | $fileNameB = substr($fileName, $ext); |
294 | 294 | |
295 | 295 | $count = 1; |
296 | - while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) { |
|
296 | + while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) { |
|
297 | 297 | ++$count; |
298 | 298 | } |
299 | 299 | |
300 | - $fileName = $fileNameA . '_' . $count . $fileNameB; |
|
300 | + $fileName = $fileNameA.'_'.$count.$fileNameB; |
|
301 | 301 | } |
302 | 302 | |
303 | -$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName; |
|
303 | +$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName; |
|
304 | 304 | |
305 | 305 | // Create target dir |
306 | 306 | if (file_exists($targetDir) === false) { |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | // Remove old temp files |
315 | 315 | if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) { |
316 | 316 | while (($file = readdir($dir)) !== false) { |
317 | - $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file; |
|
317 | + $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$file; |
|
318 | 318 | |
319 | 319 | // Remove temp file if it is older than the max age and is not the current file |
320 | 320 | if ( |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | prefixTable('files'), |
417 | 417 | array( |
418 | 418 | 'id_item' => $post_itemId, |
419 | - 'name' => 'b64:' . $fileName, // add "b64:" prefix to indicate that the file name is base64 encoded |
|
419 | + 'name' => 'b64:'.$fileName, // add "b64:" prefix to indicate that the file name is base64 encoded |
|
420 | 420 | 'size' => $post_fileSize, |
421 | 421 | 'extension' => $fileInfo['extension'], |
422 | 422 | 'type' => $_FILES['file']['type'], |
@@ -433,8 +433,8 @@ discard block |
||
433 | 433 | // This is a public object |
434 | 434 | $users = DB::query( |
435 | 435 | 'SELECT id, public_key |
436 | - FROM ' . prefixTable('users') . ' |
|
437 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
436 | + FROM ' . prefixTable('users').' |
|
437 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
438 | 438 | AND public_key != ""' |
439 | 439 | ); |
440 | 440 | foreach ($users as $user) { |
@@ -468,14 +468,14 @@ discard block |
||
468 | 468 | 'date' => time(), |
469 | 469 | 'id_user' => $session->get('user-id'), |
470 | 470 | 'action' => 'at_modification', |
471 | - 'raison' => 'at_add_file : ' . $fileName . ':' . $newID, |
|
471 | + 'raison' => 'at_add_file : '.$fileName.':'.$newID, |
|
472 | 472 | ) |
473 | 473 | ); |
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | 477 | // Return JSON-RPC response |
478 | -die('{"jsonrpc" : "2.0", "result" : null, "id" : "' . $newID . '"}'); |
|
478 | +die('{"jsonrpc" : "2.0", "result" : null, "id" : "'.$newID.'"}'); |
|
479 | 479 | |
480 | 480 | /** |
481 | 481 | * Handle errors and kill script. |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | ) { |
77 | 77 | // Not allowed page |
78 | 78 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
79 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
79 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
80 | 80 | exit; |
81 | 81 | } |
82 | 82 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } else { |
131 | 131 | // check if token is expired |
132 | 132 | $data = DB::queryFirstRow( |
133 | - 'SELECT end_timestamp FROM ' . prefixTable('tokens') . ' WHERE user_id = %i AND token = %s', |
|
133 | + 'SELECT end_timestamp FROM '.prefixTable('tokens').' WHERE user_id = %i AND token = %s', |
|
134 | 134 | $session->get('user-id'), |
135 | 135 | $post_user_token |
136 | 136 | ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | // HTTP headers for no cache etc |
156 | 156 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
157 | -header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
157 | +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
158 | 158 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
159 | 159 | header('Cache-Control: post-check=0, pre-check=0', false); |
160 | 160 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | // Set directory used to store file |
169 | - $targetDir = realpath($SETTINGS['cpassman_dir'] . '/includes/avatars'); |
|
169 | + $targetDir = realpath($SETTINGS['cpassman_dir'].'/includes/avatars'); |
|
170 | 170 | } else { |
171 | 171 | $targetDir = realpath($SETTINGS['path_to_files_folder']); |
172 | 172 | } |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $file_name = preg_replace('/[^a-zA-Z0-9-_\.]/', '', strtolower(basename($file->getClientOriginalName()))); |
220 | 220 | |
221 | 221 | if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) { |
222 | - error_log('Invalid file name: ' . $file_name . '.'); |
|
222 | + error_log('Invalid file name: '.$file_name.'.'); |
|
223 | 223 | echo handleUploadError('Invalid file name provided.'); |
224 | 224 | return false; |
225 | 225 | } |
@@ -233,13 +233,13 @@ discard block |
||
233 | 233 | $ext = strtolower($ext); |
234 | 234 | } else { |
235 | 235 | // Case where the file extension is not a string |
236 | - error_log('Invalid file name: ' . $file_name . '.'); |
|
236 | + error_log('Invalid file name: '.$file_name.'.'); |
|
237 | 237 | echo handleUploadError('Invalid file extension.'); |
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | } else { |
241 | 241 | // Case where the file name is not a string |
242 | - error_log('Invalid file name: ' . $file_name . '.'); |
|
242 | + error_log('Invalid file name: '.$file_name.'.'); |
|
243 | 243 | echo handleUploadError('Invalid file.'); |
244 | 244 | return false; |
245 | 245 | } |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | // Validate against a list of allowed extensions |
248 | 248 | $allowed_extensions = explode( |
249 | 249 | ',', |
250 | - $SETTINGS['upload_docext'] . ',' . $SETTINGS['upload_imagesext'] . |
|
251 | - ',' . $SETTINGS['upload_pkgext'] . ',' . $SETTINGS['upload_otherext'] |
|
250 | + $SETTINGS['upload_docext'].','.$SETTINGS['upload_imagesext']. |
|
251 | + ','.$SETTINGS['upload_pkgext'].','.$SETTINGS['upload_otherext'] |
|
252 | 252 | ); |
253 | 253 | |
254 | 254 | // Check if we should enforce extensions |
@@ -271,25 +271,25 @@ discard block |
||
271 | 271 | |
272 | 272 | // is destination folder writable |
273 | 273 | if (is_writable($SETTINGS['path_to_files_folder']) === false) { |
274 | - echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
274 | + echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.'); |
|
275 | 275 | return false; |
276 | 276 | } |
277 | 277 | |
278 | 278 | // Make sure the fileName is unique but only if chunking is disabled |
279 | -if ($chunks < 2 && file_exists($targetDir . DIRECTORY_SEPARATOR . $fileName)) { |
|
279 | +if ($chunks < 2 && file_exists($targetDir.DIRECTORY_SEPARATOR.$fileName)) { |
|
280 | 280 | // $ext is guaranteed to be a string due to prior checks |
281 | 281 | $fileNameA = substr($fileName, 0, strlen(/** @scrutinizer ignore-type */$ext)); |
282 | 282 | $fileNameB = substr($fileName, strlen(/** @scrutinizer ignore-type */$ext)); |
283 | 283 | |
284 | 284 | $count = 1; |
285 | - while (file_exists($targetDir . DIRECTORY_SEPARATOR . $fileNameA . '_' . $count . $fileNameB)) { |
|
285 | + while (file_exists($targetDir.DIRECTORY_SEPARATOR.$fileNameA.'_'.$count.$fileNameB)) { |
|
286 | 286 | ++$count; |
287 | 287 | } |
288 | 288 | |
289 | - $fileName = $fileNameA . '_' . $count . $fileNameB; |
|
289 | + $fileName = $fileNameA.'_'.$count.$fileNameB; |
|
290 | 290 | } |
291 | 291 | |
292 | -$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName; |
|
292 | +$filePath = $targetDir.DIRECTORY_SEPARATOR.$fileName; |
|
293 | 293 | |
294 | 294 | // Create target dir |
295 | 295 | if (!file_exists($targetDir)) { |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | // Remove old temp files |
304 | 304 | if ($cleanupTargetDir && is_dir($targetDir) && ($dir = opendir($targetDir))) { |
305 | 305 | while (($fileClean = readdir($dir)) !== false) { |
306 | - $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $fileClean; |
|
306 | + $tmpfilePath = $targetDir.DIRECTORY_SEPARATOR.$fileClean; |
|
307 | 307 | |
308 | 308 | // Remove temp file if it is older than the max age and is not the current file |
309 | 309 | if ( |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | closedir($dir); |
319 | 319 | } else { |
320 | - echo handleUploadError('Not enough permissions on folder ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
320 | + echo handleUploadError('Not enough permissions on folder '.$SETTINGS['path_to_files_folder'].'.'); |
|
321 | 321 | return false; |
322 | 322 | } |
323 | 323 | |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | // Safe destination folder |
355 | 355 | $uploadDir = realpath($SETTINGS['path_to_upload_folder']); |
356 | - $destinationPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName; |
|
356 | + $destinationPath = $uploadDir.DIRECTORY_SEPARATOR.$fileName; |
|
357 | 357 | |
358 | 358 | if (move_uploaded_file($tmpFilePath, $destinationPath)) { |
359 | 359 | // Open the moved file in read mode |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | return false; |
395 | 395 | } |
396 | 396 | } else { |
397 | - echo handleUploadError('Failed to move uploaded file to ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
397 | + echo handleUploadError('Failed to move uploaded file to '.$SETTINGS['path_to_files_folder'].'.'); |
|
398 | 398 | return false; |
399 | 399 | } |
400 | 400 | } else { |
@@ -410,14 +410,14 @@ discard block |
||
410 | 410 | fwrite($out, $buff); |
411 | 411 | } |
412 | 412 | } else { |
413 | - echo handleUploadError('Failed to open input stream ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
413 | + echo handleUploadError('Failed to open input stream '.$SETTINGS['path_to_files_folder'].'.'); |
|
414 | 414 | return false; |
415 | 415 | } |
416 | 416 | |
417 | 417 | fclose($in); |
418 | 418 | fclose($out); |
419 | 419 | } else { |
420 | - echo handleUploadError('Failed to open output stream ' . $SETTINGS['path_to_files_folder'] . '.'); |
|
420 | + echo handleUploadError('Failed to open output stream '.$SETTINGS['path_to_files_folder'].'.'); |
|
421 | 421 | return false; |
422 | 422 | } |
423 | 423 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | ) { |
451 | 451 | rename( |
452 | 452 | $filePath, |
453 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
453 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
454 | 454 | ); |
455 | 455 | |
456 | 456 | // Add in DB |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | ) { |
480 | 480 | rename( |
481 | 481 | $filePath, |
482 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
482 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
483 | 483 | ); |
484 | 484 | |
485 | 485 | // Add in DB |
@@ -512,13 +512,13 @@ discard block |
||
512 | 512 | // rename the file |
513 | 513 | rename( |
514 | 514 | $filePath, |
515 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext |
|
515 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext |
|
516 | 516 | ); |
517 | 517 | |
518 | 518 | // make thumbnail |
519 | 519 | $ret = makeThumbnail( |
520 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '.' . $ext, |
|
521 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName . '_thumb' . '.' . $ext, |
|
520 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'.'.$ext, |
|
521 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName.'_thumb'.'.'.$ext, |
|
522 | 522 | 40 |
523 | 523 | ); |
524 | 524 | |
@@ -530,21 +530,21 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | // get current avatar and delete it |
533 | - $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM ' . prefixTable('users') . ' WHERE id=%i', $session->get('user-id')); |
|
534 | - fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar'], $SETTINGS); |
|
535 | - fileDelete($targetDir . DIRECTORY_SEPARATOR . $data['avatar_thumb'], $SETTINGS); |
|
533 | + $data = DB::queryFirstRow('SELECT avatar, avatar_thumb FROM '.prefixTable('users').' WHERE id=%i', $session->get('user-id')); |
|
534 | + fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar'], $SETTINGS); |
|
535 | + fileDelete($targetDir.DIRECTORY_SEPARATOR.$data['avatar_thumb'], $SETTINGS); |
|
536 | 536 | |
537 | 537 | // store in DB the new avatar |
538 | 538 | DB::query( |
539 | - 'UPDATE ' . prefixTable('users') . " |
|
540 | - SET avatar='" . $newFileName . '.' . $ext . "', avatar_thumb='" . $newFileName . '_thumb' . '.' . $ext . "' |
|
539 | + 'UPDATE '.prefixTable('users')." |
|
540 | + SET avatar='" . $newFileName.'.'.$ext."', avatar_thumb='".$newFileName.'_thumb'.'.'.$ext."' |
|
541 | 541 | WHERE id=%i", |
542 | 542 | $session->get('user-id') |
543 | 543 | ); |
544 | 544 | |
545 | 545 | // store in session |
546 | - $session->set('user-avatar', $newFileName . '.' . $ext); |
|
547 | - $session->set('user-avatar_thumb', $newFileName . '_thumb' . '.' . $ext); |
|
546 | + $session->set('user-avatar', $newFileName.'.'.$ext); |
|
547 | + $session->set('user-avatar_thumb', $newFileName.'_thumb'.'.'.$ext); |
|
548 | 548 | |
549 | 549 | // return info |
550 | 550 | echo prepareExchangedData( |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | ) { |
564 | 564 | rename( |
565 | 565 | $filePath, |
566 | - $targetDir . DIRECTORY_SEPARATOR . $newFileName |
|
566 | + $targetDir.DIRECTORY_SEPARATOR.$newFileName |
|
567 | 567 | ); |
568 | 568 | |
569 | 569 | // Add in DB |
@@ -28,8 +28,8 @@ |
||
28 | 28 | * @see https://www.teampass.net |
29 | 29 | */ |
30 | 30 | |
31 | - // TO REMOVE |
|
32 | - // - selected_items_to_be_imported |
|
31 | + // TO REMOVE |
|
32 | + // - selected_items_to_be_imported |
|
33 | 33 | |
34 | 34 | return array( |
35 | 35 | 'files_are_not_expected_ones' => 'files are not expected ones', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($checkUserAccess->checkSession() === false || $checkUserAccess->userAccessPage('admin') === false) { |
73 | 73 | // Not allowed page |
74 | 74 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
75 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
75 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
76 | 76 | exit; |
77 | 77 | } |
78 | 78 | |
@@ -133,14 +133,14 @@ discard block |
||
133 | 133 | break; |
134 | 134 | } |
135 | 135 | |
136 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
136 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
137 | 137 | $return = ''; |
138 | 138 | |
139 | 139 | //Get all tables |
140 | 140 | $tables = array(); |
141 | 141 | $result = DB::query('SHOW TABLES'); |
142 | 142 | foreach ($result as $row) { |
143 | - $tables[] = $row['Tables_in_' . DB_NAME]; |
|
143 | + $tables[] = $row['Tables_in_'.DB_NAME]; |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | //cycle through |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
149 | 149 | $table = (is_string($table) ? $table : strval($table)); |
150 | 150 | // Do query |
151 | - $result = DB::query('SELECT * FROM ' . $table); |
|
151 | + $result = DB::query('SELECT * FROM '.$table); |
|
152 | 152 | DB::query( |
153 | 153 | 'SELECT * |
154 | 154 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -160,20 +160,20 @@ discard block |
||
160 | 160 | $numFields = DB::count(); |
161 | 161 | |
162 | 162 | // prepare a drop table |
163 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
164 | - $row2 = DB::queryFirstRow('SHOW CREATE TABLE ' . $table); |
|
165 | - $return .= "\n\n" . strval($row2['Create Table']) . ";\n\n"; |
|
163 | + $return .= 'DROP TABLE '.$table.';'; |
|
164 | + $row2 = DB::queryFirstRow('SHOW CREATE TABLE '.$table); |
|
165 | + $return .= "\n\n".strval($row2['Create Table']).";\n\n"; |
|
166 | 166 | |
167 | 167 | //prepare all fields and datas |
168 | 168 | for ($i = 0; $i < $numFields; ++$i) { |
169 | 169 | if (is_object($result)) { |
170 | 170 | while ($row = $result->fetch_row()) { |
171 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
171 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
172 | 172 | for ($j = 0; $j < $numFields; ++$j) { |
173 | 173 | $row[$j] = addslashes($row[$j]); |
174 | 174 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
175 | 175 | if (isset($row[$j])) { |
176 | - $return .= '"' . $row[$j] . '"'; |
|
176 | + $return .= '"'.$row[$j].'"'; |
|
177 | 177 | } else { |
178 | 178 | $return .= 'NULL'; |
179 | 179 | } |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | $token = GenerateCryptKey(20, false, true, true, false, true); |
195 | 195 | |
196 | 196 | //save file |
197 | - $filename = time() . '-' . $token . '.sql'; |
|
198 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
197 | + $filename = time().'-'.$token.'.sql'; |
|
198 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
199 | 199 | if ($handle !== false) { |
200 | 200 | //write file |
201 | 201 | fwrite($handle, $return); |
@@ -207,16 +207,16 @@ discard block |
||
207 | 207 | // Encrypt the file |
208 | 208 | prepareFileWithDefuse( |
209 | 209 | 'encrypt', |
210 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
211 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
210 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
211 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
212 | 212 | $post_option |
213 | 213 | ); |
214 | 214 | |
215 | 215 | // Do clean |
216 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
216 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
217 | 217 | rename( |
218 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
219 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
218 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
219 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
220 | 220 | ); |
221 | 221 | } |
222 | 222 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | //update LOG |
227 | 227 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $session->get('user-id'), $session->get('user-login')); |
228 | 228 | |
229 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $session->get('key') . '&key_tmp=' . $session->get('user-key_tmp') . '&pathIsFiles=1"}]'; |
|
229 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$session->get('key').'&key_tmp='.$session->get('user-key_tmp').'&pathIsFiles=1"}]'; |
|
230 | 230 | } |
231 | 231 | break; |
232 | 232 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ); |
256 | 256 | break; |
257 | 257 | } |
258 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
258 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
259 | 259 | |
260 | 260 | $dataPost = explode('&', $post_option); |
261 | 261 | $file = htmlspecialchars($dataPost[0]); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // Get filename from database |
265 | 265 | $data = DB::queryFirstRow( |
266 | 266 | 'SELECT valeur |
267 | - FROM ' . prefixTable('misc') . ' |
|
267 | + FROM ' . prefixTable('misc').' |
|
268 | 268 | WHERE increment_id = %i', |
269 | 269 | $file |
270 | 270 | ); |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | // Decrypt the file |
284 | 284 | $ret = prepareFileWithDefuse( |
285 | 285 | 'decrypt', |
286 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
287 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
286 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
287 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
288 | 288 | $key |
289 | 289 | ); |
290 | 290 | |
@@ -295,10 +295,10 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | // Do clean |
298 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
299 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
298 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
299 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
300 | 300 | } else { |
301 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
301 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | //read sql file |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | fclose($handle); |
316 | 316 | |
317 | 317 | //delete file |
318 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
318 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
319 | 319 | |
320 | 320 | //Show done |
321 | 321 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | $tablename = (is_string($tablename) ? $tablename : strval($tablename)); |
355 | 355 | if (substr_count($tablename, DB_PREFIX) > 0) { |
356 | 356 | // launch optimization quieries |
357 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
358 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
357 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
358 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
359 | 359 | } |
360 | 360 | } |
361 | 361 | } |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | //Clean up LOG_ITEMS table |
364 | 364 | $rows = DB::query( |
365 | 365 | 'SELECT id |
366 | - FROM ' . prefixTable('items') . ' |
|
366 | + FROM ' . prefixTable('items').' |
|
367 | 367 | ORDER BY id ASC' |
368 | 368 | ); |
369 | 369 | foreach ($rows as $item) { |
370 | 370 | DB::query( |
371 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
371 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
372 | 372 | $item['id'], |
373 | 373 | 'at_creation' |
374 | 374 | ); |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if ($counter === 0) { |
377 | 377 | //Create new at_creation entry |
378 | 378 | $rowTmp = DB::queryFirstRow( |
379 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
379 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
380 | 380 | $item['id'] |
381 | 381 | ); |
382 | 382 | DB::insert( |
@@ -406,8 +406,8 @@ discard block |
||
406 | 406 | echo prepareExchangedData( |
407 | 407 | array( |
408 | 408 | 'error' => false, |
409 | - 'message' => $lang->get('last_execution') . ' ' . |
|
410 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
409 | + 'message' => $lang->get('last_execution').' '. |
|
410 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
411 | 411 | '<i class="fas fa-check text-success ml-2"></i>', |
412 | 412 | ), |
413 | 413 | 'encode' |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | break; |
444 | 444 | } |
445 | 445 | |
446 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
446 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
447 | 447 | updateCacheTable('reload', NULL); |
448 | 448 | |
449 | 449 | // Log |
@@ -459,8 +459,8 @@ discard block |
||
459 | 459 | echo prepareExchangedData( |
460 | 460 | [ |
461 | 461 | 'error' => false, |
462 | - 'message' => $lang->get('last_execution') . ' ' . |
|
463 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
462 | + 'message' => $lang->get('last_execution').' '. |
|
463 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
464 | 464 | '<i class="fas fa-check text-success mr-2"></i>', |
465 | 465 | ], |
466 | 466 | 'encode' |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | $session->set('user-reencrypt_old_salt', file_get_contents(SECUREPATH.'/'.SECUREFILE)); |
503 | 503 | |
504 | 504 | // generate new saltkey |
505 | - $old_sk_filename = SECUREPATH.'/'.SECUREFILE . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
505 | + $old_sk_filename = SECUREPATH.'/'.SECUREFILE.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
506 | 506 | copy( |
507 | 507 | SECUREPATH.'/'.SECUREFILE, |
508 | 508 | $old_sk_filename |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $session->get('user-id'), $session->get('user-login')); |
532 | 532 | |
533 | 533 | // get number of items to change |
534 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
534 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
535 | 535 | $nb_of_items = DB::count(); |
536 | 536 | |
537 | 537 | // create backup table |
538 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
538 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
539 | 539 | DB::query( |
540 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
540 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
541 | 541 | `id` int(12) NOT null AUTO_INCREMENT, |
542 | 542 | `current_table` varchar(100) NOT NULL, |
543 | 543 | `current_field` varchar(500) NOT NULL, |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ); |
566 | 566 | |
567 | 567 | // delete previous backup files |
568 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
568 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
569 | 569 | foreach ($files as $file) { // iterate files |
570 | 570 | if (is_file($file)) { |
571 | 571 | $file_parts = pathinfo($file); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | echo prepareExchangedData( |
653 | 653 | array( |
654 | 654 | 'error' => true, |
655 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
655 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
656 | 656 | 'nbOfItems' => '', |
657 | 657 | 'nextAction' => '', |
658 | 658 | ), |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | //change all encrypted data in Items (passwords) |
666 | 666 | $rows = DB::query( |
667 | 667 | 'SELECT id, pw, pw_iv |
668 | - FROM ' . prefixTable('items') . ' |
|
668 | + FROM ' . prefixTable('items').' |
|
669 | 669 | WHERE perso = %s |
670 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
670 | + LIMIT ' . $post_start.', '.$post_length, |
|
671 | 671 | '0' |
672 | 672 | ); |
673 | 673 | foreach ($rows as $record) { |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | 'current_field' => 'pw', |
680 | 680 | 'value_id' => $record['id'], |
681 | 681 | 'value' => $record['pw'], |
682 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
682 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
683 | 683 | 'value2' => 'none', |
684 | 684 | 'result' => 'none', |
685 | 685 | ) |
@@ -728,9 +728,9 @@ discard block |
||
728 | 728 | //change all encrypted data in Logs (passwords) |
729 | 729 | $rows = DB::query( |
730 | 730 | 'SELECT raison, increment_id |
731 | - FROM ' . prefixTable('log_items') . " |
|
731 | + FROM ' . prefixTable('log_items')." |
|
732 | 732 | WHERE action = %s AND raison LIKE 'at_pw :%' |
733 | - LIMIT " . $post_start . ', ' . $post_length, |
|
733 | + LIMIT " . $post_start.', '.$post_length, |
|
734 | 734 | 'at_modification' |
735 | 735 | ); |
736 | 736 | foreach ($rows as $record) { |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | 'current_field' => 'raison', |
743 | 743 | 'value_id' => $record['increment_id'], |
744 | 744 | 'value' => $record['raison'], |
745 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
745 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
746 | 746 | 'value2' => 'none', |
747 | 747 | 'result' => 'none', |
748 | 748 | ) |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | DB::update( |
771 | 771 | prefixTable('log_items'), |
772 | 772 | array( |
773 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
773 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
774 | 774 | 'encryption_type' => 'defuse', |
775 | 775 | ), |
776 | 776 | 'increment_id = %i', |
@@ -795,8 +795,8 @@ discard block |
||
795 | 795 | //change all encrypted data in CATEGORIES (passwords) |
796 | 796 | $rows = DB::query( |
797 | 797 | 'SELECT id, data |
798 | - FROM ' . prefixTable('categories_items') . ' |
|
799 | - LIMIT ' . $post_start . ', ' . $post_length |
|
798 | + FROM ' . prefixTable('categories_items').' |
|
799 | + LIMIT ' . $post_start.', '.$post_length |
|
800 | 800 | ); |
801 | 801 | foreach ($rows as $record) { |
802 | 802 | // backup data |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | 'current_field' => 'data', |
808 | 808 | 'value_id' => $record['id'], |
809 | 809 | 'value' => $record['data'], |
810 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
810 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
811 | 811 | 'value2' => 'none', |
812 | 812 | 'result' => 'none', |
813 | 813 | ) |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | // Change all encrypted data in FILES (passwords) |
856 | 856 | $rows = DB::query( |
857 | 857 | 'SELECT id, file, status |
858 | - FROM ' . prefixTable('files') . " |
|
858 | + FROM ' . prefixTable('files')." |
|
859 | 859 | WHERE status = 'encrypted' |
860 | - LIMIT " . $post_start . ', ' . $post_length |
|
860 | + LIMIT " . $post_start.', '.$post_length |
|
861 | 861 | ); |
862 | 862 | foreach ($rows as $record) { |
863 | 863 | // backup data |
@@ -875,20 +875,20 @@ discard block |
||
875 | 875 | ); |
876 | 876 | $newID = DB::insertId(); |
877 | 877 | |
878 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
878 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
879 | 879 | // make a copy of file |
880 | 880 | if (!copy( |
881 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
882 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
881 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
882 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
883 | 883 | )) { |
884 | 884 | $error = 'Copy not possible'; |
885 | 885 | exit; |
886 | 886 | } else { |
887 | 887 | // prepare a bck of file (that will not be deleted) |
888 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
888 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
889 | 889 | copy( |
890 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
891 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
890 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
891 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
892 | 892 | ); |
893 | 893 | } |
894 | 894 | |
@@ -896,22 +896,22 @@ discard block |
||
896 | 896 | // STEP1 - Do decryption |
897 | 897 | prepareFileWithDefuse( |
898 | 898 | 'decrypt', |
899 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
900 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted' |
|
899 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
900 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted' |
|
901 | 901 | ); |
902 | 902 | |
903 | 903 | // Do cleanup of files |
904 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
904 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
905 | 905 | |
906 | 906 | // STEP2 - Do encryption |
907 | 907 | prepareFileWithDefuse( |
908 | 908 | 'encryp', |
909 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
910 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] |
|
909 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
910 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'] |
|
911 | 911 | ); |
912 | 912 | |
913 | 913 | // Do cleanup of files |
914 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
914 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
915 | 915 | |
916 | 916 | // Update backup table |
917 | 917 | DB::update( |
@@ -937,13 +937,13 @@ discard block |
||
937 | 937 | // do some things for new object |
938 | 938 | if (isset($objects[0])) { |
939 | 939 | if ($objects[0] === 'logs') { |
940 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
940 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
941 | 941 | } elseif ($objects[0] === 'files') { |
942 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
942 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
943 | 943 | } elseif ($objects[0] === 'categories') { |
944 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
944 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
945 | 945 | } elseif ($objects[0] === 'custfields') { |
946 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
946 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
947 | 947 | } |
948 | 948 | $nb_of_items = DB::count(); |
949 | 949 | } else { |
@@ -1063,12 +1063,12 @@ discard block |
||
1063 | 1063 | ); |
1064 | 1064 | } elseif ($record['current_table'] === 'files') { |
1065 | 1065 | // restore backup file |
1066 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
1067 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
1068 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1066 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
1067 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
1068 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1069 | 1069 | rename( |
1070 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
1071 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
1070 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
1071 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
1072 | 1072 | ); |
1073 | 1073 | } |
1074 | 1074 | } |
@@ -1087,7 +1087,7 @@ discard block |
||
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | // drop table |
1090 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1090 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1091 | 1091 | |
1092 | 1092 | // Send back |
1093 | 1093 | echo prepareExchangedData( |
@@ -1130,17 +1130,17 @@ discard block |
||
1130 | 1130 | // delete files |
1131 | 1131 | $rows = DB::query( |
1132 | 1132 | 'SELECT value, value2 |
1133 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
1133 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
1134 | 1134 | WHERE current_table = 'files'" |
1135 | 1135 | ); |
1136 | 1136 | foreach ($rows as $record) { |
1137 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
1138 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
1137 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
1138 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | // drop table |
1143 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
1143 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
1144 | 1144 | |
1145 | 1145 | echo '[{"status":"done"}]'; |
1146 | 1146 | break; |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | 'encode' |
1172 | 1172 | ); |
1173 | 1173 | } else { |
1174 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1174 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1175 | 1175 | |
1176 | 1176 | //send email |
1177 | 1177 | $emailSettings = new EmailSettings($SETTINGS); |
@@ -1209,13 +1209,13 @@ discard block |
||
1209 | 1209 | break; |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1212 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1213 | 1213 | $emailSettings = new EmailSettings($SETTINGS); |
1214 | 1214 | $emailService = new EmailService(); |
1215 | 1215 | |
1216 | 1216 | $rows = DB::query( |
1217 | 1217 | 'SELECT * |
1218 | - FROM ' . prefixTable('emails') . ' |
|
1218 | + FROM ' . prefixTable('emails').' |
|
1219 | 1219 | WHERE status = %s OR status = %s', |
1220 | 1220 | 'not_sent', |
1221 | 1221 | '' |
@@ -1301,13 +1301,13 @@ discard block |
||
1301 | 1301 | break; |
1302 | 1302 | } |
1303 | 1303 | |
1304 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1304 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1305 | 1305 | |
1306 | 1306 | // Instatiate email settings and service |
1307 | 1307 | $emailSettings = new EmailSettings($SETTINGS); |
1308 | 1308 | $emailService = new EmailService(); |
1309 | 1309 | |
1310 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1310 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
1311 | 1311 | foreach ($rows as $record) { |
1312 | 1312 | //send email |
1313 | 1313 | $email = $emailService->sendMail( |
@@ -1376,7 +1376,7 @@ discard block |
||
1376 | 1376 | break; |
1377 | 1377 | } |
1378 | 1378 | |
1379 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1379 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1380 | 1380 | |
1381 | 1381 | // init |
1382 | 1382 | $filesList = array(); |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | FROM ' . prefixTable('files') |
1390 | 1390 | ); |
1391 | 1391 | foreach ($rows as $record) { |
1392 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
1392 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
1393 | 1393 | $addFile = false; |
1394 | 1394 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
1395 | 1395 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -1454,8 +1454,8 @@ discard block |
||
1454 | 1454 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
1455 | 1455 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
1456 | 1456 | |
1457 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
1458 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1457 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
1458 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1459 | 1459 | |
1460 | 1460 | $cpt = 0; |
1461 | 1461 | $continu = true; |
@@ -1468,33 +1468,33 @@ discard block |
||
1468 | 1468 | // Get file name |
1469 | 1469 | $file_info = DB::queryFirstRow( |
1470 | 1470 | 'SELECT file |
1471 | - FROM ' . prefixTable('files') . ' |
|
1471 | + FROM ' . prefixTable('files').' |
|
1472 | 1472 | WHERE id = %i', |
1473 | 1473 | $file |
1474 | 1474 | ); |
1475 | 1475 | |
1476 | 1476 | // skip file is Coherancey not respected |
1477 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
1477 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
1478 | 1478 | // Case where we want to decrypt |
1479 | 1479 | if ($post_option === 'decrypt') { |
1480 | 1480 | prepareFileWithDefuse( |
1481 | 1481 | 'decrypt', |
1482 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
1483 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1482 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
1483 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1484 | 1484 | ); |
1485 | 1485 | // Case where we want to encrypt |
1486 | 1486 | } elseif ($post_option === 'encrypt') { |
1487 | 1487 | prepareFileWithDefuse( |
1488 | 1488 | 'encrypt', |
1489 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
1490 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1489 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
1490 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1491 | 1491 | ); |
1492 | 1492 | } |
1493 | 1493 | // Do file cleanup |
1494 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
1494 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
1495 | 1495 | rename( |
1496 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
1497 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
1496 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
1497 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
1498 | 1498 | ); |
1499 | 1499 | |
1500 | 1500 | // store in DB |
@@ -1529,8 +1529,8 @@ discard block |
||
1529 | 1529 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
1530 | 1530 | ); |
1531 | 1531 | |
1532 | - $message = $lang->get('last_execution') . ' ' . |
|
1533 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
1532 | + $message = $lang->get('last_execution').' '. |
|
1533 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
1534 | 1534 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
1535 | 1535 | } |
1536 | 1536 | |
@@ -1624,7 +1624,7 @@ discard block |
||
1624 | 1624 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
1625 | 1625 | |
1626 | 1626 | DB::query( |
1627 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE increment_id = %i', |
|
1627 | + 'DELETE FROM '.prefixTable('api').' WHERE increment_id = %i', |
|
1628 | 1628 | $post_id |
1629 | 1629 | ); |
1630 | 1630 | } |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | // Delete existing key |
1720 | 1720 | } elseif (null !== $post_action && $post_action === 'delete') { |
1721 | 1721 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
1722 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE increment_id=%i', $post_id); |
|
1722 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE increment_id=%i', $post_id); |
|
1723 | 1723 | } |
1724 | 1724 | |
1725 | 1725 | echo prepareExchangedData( |
@@ -1734,7 +1734,7 @@ discard block |
||
1734 | 1734 | |
1735 | 1735 | case 'save_api_status': |
1736 | 1736 | // Do query |
1737 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
1737 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
1738 | 1738 | $counter = DB::count(); |
1739 | 1739 | if ($counter === 0) { |
1740 | 1740 | DB::insert( |
@@ -1763,7 +1763,7 @@ discard block |
||
1763 | 1763 | |
1764 | 1764 | case 'run_duo_config_check': |
1765 | 1765 | //Libraries call |
1766 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
1766 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
1767 | 1767 | // Check KEY |
1768 | 1768 | if ($post_key !== $session->get('key')) { |
1769 | 1769 | echo prepareExchangedData( |
@@ -1869,7 +1869,7 @@ discard block |
||
1869 | 1869 | } else { |
1870 | 1870 | $tmp = 1; |
1871 | 1871 | } |
1872 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
1872 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
1873 | 1873 | $counter = DB::count(); |
1874 | 1874 | if ($counter === 0) { |
1875 | 1875 | DB::insert( |
@@ -1897,7 +1897,7 @@ discard block |
||
1897 | 1897 | |
1898 | 1898 | // ga_website_name |
1899 | 1899 | if (is_null($dataReceived['ga_website_name']) === false) { |
1900 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
1900 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
1901 | 1901 | $counter = DB::count(); |
1902 | 1902 | if ($counter === 0) { |
1903 | 1903 | DB::insert( |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | } |
1928 | 1928 | |
1929 | 1929 | // send data |
1930 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
1930 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
1931 | 1931 | break; |
1932 | 1932 | |
1933 | 1933 | case 'save_agses_options': |
@@ -1950,7 +1950,7 @@ discard block |
||
1950 | 1950 | |
1951 | 1951 | // agses_hosted_url |
1952 | 1952 | if (!is_null($dataReceived['agses_hosted_url'])) { |
1953 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
1953 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
1954 | 1954 | $counter = DB::count(); |
1955 | 1955 | if ($counter === 0) { |
1956 | 1956 | DB::insert( |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | |
1982 | 1982 | // agses_hosted_id |
1983 | 1983 | if (!is_null($dataReceived['agses_hosted_id'])) { |
1984 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
1984 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
1985 | 1985 | $counter = DB::count(); |
1986 | 1986 | if ($counter === 0) { |
1987 | 1987 | DB::insert( |
@@ -2012,7 +2012,7 @@ discard block |
||
2012 | 2012 | |
2013 | 2013 | // agses_hosted_apikey |
2014 | 2014 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
2015 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2015 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
2016 | 2016 | $counter = DB::count(); |
2017 | 2017 | if ($counter === 0) { |
2018 | 2018 | DB::insert( |
@@ -2042,7 +2042,7 @@ discard block |
||
2042 | 2042 | } |
2043 | 2043 | |
2044 | 2044 | // send data |
2045 | - echo '[{"result" : "' . addslashes($lang['done']) . '" , "error" : ""}]'; |
|
2045 | + echo '[{"result" : "'.addslashes($lang['done']).'" , "error" : ""}]'; |
|
2046 | 2046 | break; |
2047 | 2047 | |
2048 | 2048 | case 'save_option_change': |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | |
2084 | 2084 | // Check if setting is already in DB. If NO then insert, if YES then update. |
2085 | 2085 | $data = DB::query( |
2086 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2086 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2087 | 2087 | WHERE type = %s AND intitule = %s', |
2088 | 2088 | 'admin', |
2089 | 2089 | $post_field |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | array( |
2107 | 2107 | 'valeur' => time(), |
2108 | 2108 | 'type' => 'admin', |
2109 | - 'intitule' => $post_field . '_time', |
|
2109 | + 'intitule' => $post_field.'_time', |
|
2110 | 2110 | 'updated_at' => time(), |
2111 | 2111 | ) |
2112 | 2112 | ); |
@@ -2128,10 +2128,10 @@ discard block |
||
2128 | 2128 | if ($post_field === 'send_stats') { |
2129 | 2129 | // Check if previous time exists, if not them insert this value in DB |
2130 | 2130 | DB::query( |
2131 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
2131 | + 'SELECT * FROM '.prefixTable('misc').' |
|
2132 | 2132 | WHERE type = %s AND intitule = %s', |
2133 | 2133 | 'admin', |
2134 | - $post_field . '_time' |
|
2134 | + $post_field.'_time' |
|
2135 | 2135 | ); |
2136 | 2136 | $counter = DB::count(); |
2137 | 2137 | if ($counter === 0) { |
@@ -2140,7 +2140,7 @@ discard block |
||
2140 | 2140 | array( |
2141 | 2141 | 'valeur' => 0, |
2142 | 2142 | 'type' => 'admin', |
2143 | - 'intitule' => $post_field . '_time', |
|
2143 | + 'intitule' => $post_field.'_time', |
|
2144 | 2144 | 'created_at' => time(), |
2145 | 2145 | ) |
2146 | 2146 | ); |
@@ -2162,13 +2162,13 @@ discard block |
||
2162 | 2162 | // special Cases |
2163 | 2163 | if ($post_field === 'cpassman_url') { |
2164 | 2164 | // update also jsUrl for CSFP protection |
2165 | - $jsUrl = $post_value . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2165 | + $jsUrl = $post_value.'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
2166 | 2166 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
2167 | 2167 | $data = file_get_contents($csrfp_file); |
2168 | 2168 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
2169 | 2169 | $posEndLine = strpos($data, '",', $posJsUrl); |
2170 | 2170 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
2171 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS) . '",', $data); |
|
2171 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_FULL_SPECIAL_CHARS).'",', $data); |
|
2172 | 2172 | file_put_contents($csrfp_file, $newdata); |
2173 | 2173 | } elseif ($post_field === 'restricted_to_input' && (int) $post_value === 0) { |
2174 | 2174 | DB::update( |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | echo prepareExchangedData( |
2194 | 2194 | array( |
2195 | 2195 | 'error' => false, |
2196 | - 'misc' => $counter . ' ; ' . $SETTINGS[$post_field], |
|
2196 | + 'misc' => $counter.' ; '.$SETTINGS[$post_field], |
|
2197 | 2197 | 'message' => empty($post_translate) === false ? $lang->get($post_translate) : '', |
2198 | 2198 | ), |
2199 | 2199 | 'encode' |
@@ -2236,7 +2236,7 @@ discard block |
||
2236 | 2236 | |
2237 | 2237 | // send statistics |
2238 | 2238 | if (null !== $post_status) { |
2239 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2239 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
2240 | 2240 | $counter = DB::count(); |
2241 | 2241 | if ($counter === 0) { |
2242 | 2242 | DB::insert( |
@@ -2267,7 +2267,7 @@ discard block |
||
2267 | 2267 | |
2268 | 2268 | // send statistics items |
2269 | 2269 | if (null !== $post_list) { |
2270 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2270 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
2271 | 2271 | $counter = DB::count(); |
2272 | 2272 | if ($counter === 0) { |
2273 | 2273 | DB::insert( |
@@ -2313,7 +2313,7 @@ discard block |
||
2313 | 2313 | break; |
2314 | 2314 | } |
2315 | 2315 | |
2316 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
2316 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
2317 | 2317 | if (DB::count() === 1) { |
2318 | 2318 | echo 1; |
2319 | 2319 | } else { |
@@ -2374,7 +2374,7 @@ discard block |
||
2374 | 2374 | |
2375 | 2375 | $rows = DB::query( |
2376 | 2376 | 'SELECT id, title |
2377 | - FROM ' . prefixTable('roles_title') . ' |
|
2377 | + FROM ' . prefixTable('roles_title').' |
|
2378 | 2378 | ORDER BY title ASC' |
2379 | 2379 | ); |
2380 | 2380 | foreach ($rows as $record) { |
@@ -2506,7 +2506,7 @@ discard block |
||
2506 | 2506 | |
2507 | 2507 | $ignoredFiles = DB::queryFirstField( |
2508 | 2508 | 'SELECT valeur |
2509 | - FROM ' . prefixTable('misc') . ' |
|
2509 | + FROM ' . prefixTable('misc').' |
|
2510 | 2510 | WHERE type = %s AND intitule = %s', |
2511 | 2511 | 'admin', |
2512 | 2512 | 'ignored_unknown_files' |
@@ -2549,7 +2549,7 @@ discard block |
||
2549 | 2549 | // Get ignored unknown files |
2550 | 2550 | $existingData = DB::queryFirstRow( |
2551 | 2551 | 'SELECT valeur |
2552 | - FROM ' . prefixTable('misc') . ' |
|
2552 | + FROM ' . prefixTable('misc').' |
|
2553 | 2553 | WHERE type = %s AND intitule = %s', |
2554 | 2554 | 'admin', |
2555 | 2555 | 'ignored_unknown_files' |
@@ -2606,7 +2606,7 @@ discard block |
||
2606 | 2606 | // Get the list of files to delete |
2607 | 2607 | $filesToDelete = DB::queryFirstField( |
2608 | 2608 | 'SELECT valeur |
2609 | - FROM ' . prefixTable('misc') . ' |
|
2609 | + FROM ' . prefixTable('misc').' |
|
2610 | 2610 | WHERE type = %s AND intitule = %s', |
2611 | 2611 | 'admin', |
2612 | 2612 | 'unknown_files' |
@@ -2653,7 +2653,7 @@ discard block |
||
2653 | 2653 | $lang = new Language($session->get('user-language') ?? 'english'); |
2654 | 2654 | |
2655 | 2655 | $results = []; |
2656 | - $fullPath = __DIR__ . '/../'; |
|
2656 | + $fullPath = __DIR__.'/../'; |
|
2657 | 2657 | |
2658 | 2658 | foreach ($files as $file) { |
2659 | 2659 | // Normalize path separators for cross-platform compatibility |
@@ -2702,7 +2702,7 @@ discard block |
||
2702 | 2702 | } |
2703 | 2703 | |
2704 | 2704 | // Try to delete the file |
2705 | - $deleteResult = '';//@unlink($normalizedPath); |
|
2705 | + $deleteResult = ''; //@unlink($normalizedPath); |
|
2706 | 2706 | |
2707 | 2707 | if ($deleteResult) { |
2708 | 2708 | $results[$normalizedPath] = [ |
@@ -2732,7 +2732,7 @@ discard block |
||
2732 | 2732 | */ |
2733 | 2733 | function filesIntegrityCheck($baseDir): array |
2734 | 2734 | { |
2735 | - $referenceFile = __DIR__ . '/../files_reference.txt'; |
|
2735 | + $referenceFile = __DIR__.'/../files_reference.txt'; |
|
2736 | 2736 | |
2737 | 2737 | $unknownFiles = findUnknownFiles($baseDir, $referenceFile); |
2738 | 2738 | |
@@ -2770,7 +2770,7 @@ discard block |
||
2770 | 2770 | $dir, |
2771 | 2771 | FilesystemIterator::SKIP_DOTS |
2772 | 2772 | ), |
2773 | - function ($current, $key, $iterator) { |
|
2773 | + function($current, $key, $iterator) { |
|
2774 | 2774 | // Ignore hidden files and folders |
2775 | 2775 | if ($current->getFilename()[0] === '.') { |
2776 | 2776 | return false; |
@@ -2784,7 +2784,7 @@ discard block |
||
2784 | 2784 | foreach ($iterator as $file) { |
2785 | 2785 | try { |
2786 | 2786 | if ($file->isFile()) { |
2787 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
2787 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
2788 | 2788 | $relativePath = str_replace('\\', '/', $relativePath); // Normalisation Windows/Linux |
2789 | 2789 | |
2790 | 2790 | // Split relatif path into parts |
@@ -2850,7 +2850,7 @@ discard block |
||
2850 | 2850 | // Get ignored files |
2851 | 2851 | $ignoredFiles = DB::queryFirstField( |
2852 | 2852 | 'SELECT valeur |
2853 | - FROM ' . prefixTable('misc') . ' |
|
2853 | + FROM ' . prefixTable('misc').' |
|
2854 | 2854 | WHERE type = %s AND intitule = %s', |
2855 | 2855 | 'admin', |
2856 | 2856 | 'ignored_unknown_files' |
@@ -2869,7 +2869,7 @@ discard block |
||
2869 | 2869 | function tablesIntegrityCheck(): array |
2870 | 2870 | { |
2871 | 2871 | // Get integrity tables file |
2872 | - $integrityTablesFile = TEAMPASS_ROOT_PATH . '/includes/tables_integrity.json'; |
|
2872 | + $integrityTablesFile = TEAMPASS_ROOT_PATH.'/includes/tables_integrity.json'; |
|
2873 | 2873 | if (file_exists($integrityTablesFile) === false) { |
2874 | 2874 | return [ |
2875 | 2875 | 'error' => true, |
@@ -2887,7 +2887,7 @@ discard block |
||
2887 | 2887 | // Get all tables |
2888 | 2888 | $tables = []; |
2889 | 2889 | foreach (DB::queryFirstColumn("SHOW TABLES") as $table) { |
2890 | - $tables[] = str_replace(DB_PREFIX, "", $table);; |
|
2890 | + $tables[] = str_replace(DB_PREFIX, "", $table); ; |
|
2891 | 2891 | } |
2892 | 2892 | // Prepare the integrity check |
2893 | 2893 | $tablesInError = []; |
@@ -2953,7 +2953,7 @@ discard block |
||
2953 | 2953 | |
2954 | 2954 | // Compare hashes |
2955 | 2955 | $expectedHash = $referenceData[$file]; |
2956 | - $actualHash = md5_file($baseDir . '/' . $file); |
|
2956 | + $actualHash = md5_file($baseDir.'/'.$file); |
|
2957 | 2957 | |
2958 | 2958 | if ($expectedHash !== $actualHash) { |
2959 | 2959 | $issues[] = "$file (expected: <i>$expectedHash</i>, actual: <i>$actualHash</i>)"; |
@@ -3006,7 +3006,7 @@ discard block |
||
3006 | 3006 | foreach ($iterator as $file) { |
3007 | 3007 | if ($file->isFile()) { |
3008 | 3008 | // Build relative path |
3009 | - $relativePath = str_replace($dir . DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
3009 | + $relativePath = str_replace($dir.DIRECTORY_SEPARATOR, '', $file->getPathname()); |
|
3010 | 3010 | $relativePath = str_replace('\\', '/', $relativePath); // Normalize for Windows |
3011 | 3011 | // Calculate hash |
3012 | 3012 | $files[$relativePath] = md5_file($file->getPathname()); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ) { |
80 | 80 | // Not allowed page |
81 | 81 | $session->set('system-error_code', ERR_NOT_ALLOWED); |
82 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
82 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
83 | 83 | exit; |
84 | 84 | } |
85 | 85 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | date_default_timezone_set('UTC'); |
105 | 105 | } |
106 | 106 | |
107 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $session->get('user-language') . '.php'; |
|
107 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session->get('user-language').'.php'; |
|
108 | 108 | header('Content-type: text/html; charset=utf-8'); |
109 | 109 | header('Cache-Control: no-cache, must-revalidate'); |
110 | 110 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // About special settings |
366 | 366 | $dataFolderSettings = DB::queryFirstRow( |
367 | 367 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
368 | - FROM ' . prefixTable('nested_tree') . ' |
|
368 | + FROM ' . prefixTable('nested_tree').' |
|
369 | 369 | WHERE id = %i', |
370 | 370 | $inputData['folderId'] |
371 | 371 | ); |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | // Get folder complexity |
383 | 383 | $folderComplexity = DB::queryFirstRow( |
384 | 384 | 'SELECT valeur |
385 | - FROM ' . prefixTable('misc') . ' |
|
385 | + FROM ' . prefixTable('misc').' |
|
386 | 386 | WHERE type = %s AND intitule = %i', |
387 | 387 | 'complex', |
388 | 388 | $inputData['folderId'] |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $itemExists = 0; |
408 | 408 | $newID = ''; |
409 | 409 | $data = DB::queryFirstRow( |
410 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
410 | + 'SELECT * FROM '.prefixTable('items').' |
|
411 | 411 | WHERE label = %s AND inactif = %i', |
412 | 412 | $inputData['label'], |
413 | 413 | 0 |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | (int) $post_folder_is_personal, |
489 | 489 | (int) $newID, |
490 | 490 | $cryptedStuff['objectKey'], |
491 | - true, // only for the item creator |
|
492 | - false, // no delete all |
|
491 | + true, // only for the item creator |
|
492 | + false, // no delete all |
|
493 | 493 | ); |
494 | 494 | |
495 | 495 | // update fields |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | // should we encrypt the data |
503 | 503 | $dataTmp = DB::queryFirstRow( |
504 | 504 | 'SELECT encrypted_data |
505 | - FROM ' . prefixTable('categories') . ' |
|
505 | + FROM ' . prefixTable('categories').' |
|
506 | 506 | WHERE id = %i', |
507 | 507 | $field['id'] |
508 | 508 | ); |
@@ -531,8 +531,8 @@ discard block |
||
531 | 531 | (int) $post_folder_is_personal, |
532 | 532 | (int) $newObjectId, |
533 | 533 | $cryptedStuff['objectKey'], |
534 | - true, // only for the item creator |
|
535 | - false, // no delete all |
|
534 | + true, // only for the item creator |
|
535 | + false, // no delete all |
|
536 | 536 | ); |
537 | 537 | |
538 | 538 | array_push( |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | ) { |
569 | 569 | DB::queryFirstRow( |
570 | 570 | 'SELECT * |
571 | - FROM ' . prefixTable('templates') . ' |
|
571 | + FROM ' . prefixTable('templates').' |
|
572 | 572 | WHERE item_id = %i', |
573 | 573 | $newID |
574 | 574 | ); |
@@ -637,11 +637,11 @@ discard block |
||
637 | 637 | ) { |
638 | 638 | foreach ($post_restricted_to as $userRest) { |
639 | 639 | if (empty($userRest) === false) { |
640 | - $dataTmp = DB::queryFirstRow('SELECT login FROM ' . prefixTable('users') . ' WHERE id= %i', $userRest); |
|
640 | + $dataTmp = DB::queryFirstRow('SELECT login FROM '.prefixTable('users').' WHERE id= %i', $userRest); |
|
641 | 641 | if (empty($listOfRestricted)) { |
642 | 642 | $listOfRestricted = $dataTmp['login']; |
643 | 643 | } else { |
644 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
644 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | } |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | if (empty($userRest) === false) { |
658 | 658 | $dataTmp = DB::queryFirstRow( |
659 | 659 | 'SELECT login |
660 | - FROM ' . prefixTable('users') . ' |
|
660 | + FROM ' . prefixTable('users').' |
|
661 | 661 | WHERE id= %i', |
662 | 662 | $userRest |
663 | 663 | ); |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | if (empty($oldRestrictionList) === true) { |
666 | 666 | $oldRestrictionList = $dataTmp['login']; |
667 | 667 | } else { |
668 | - $oldRestrictionList .= ';' . $dataTmp['login']; |
|
668 | + $oldRestrictionList .= ';'.$dataTmp['login']; |
|
669 | 669 | } |
670 | 670 | } |
671 | 671 | } |
@@ -728,7 +728,7 @@ discard block |
||
728 | 728 | if (empty($post_uploaded_file_id) === false) { |
729 | 729 | $rows = DB::query( |
730 | 730 | 'SELECT id |
731 | - FROM ' . prefixTable('files') . ' |
|
731 | + FROM ' . prefixTable('files').' |
|
732 | 732 | WHERE id_item = %s', |
733 | 733 | $post_uploaded_file_id |
734 | 734 | ); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | $lang->get('email_subject_item_updated'), |
785 | 785 | str_replace( |
786 | 786 | array('#label', '#link'), |
787 | - array($path, $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $inputData['folderId'] . '&id=' . $newID . $lang['email_body3']), |
|
787 | + array($path, $SETTINGS['email_server_url'].'/index.php?page=items&group='.$inputData['folderId'].'&id='.$newID.$lang['email_body3']), |
|
788 | 788 | $lang->get('new_item_email_body') |
789 | 789 | ), |
790 | 790 | $emailAddress, |
@@ -888,11 +888,11 @@ discard block |
||
888 | 888 | // Prepare variables |
889 | 889 | $itemInfos = array(); |
890 | 890 | $inputData['label'] = isset($dataReceived['label']) && is_string($dataReceived['label']) ? filter_var($dataReceived['label'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
891 | - $post_url = isset($dataReceived['url'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
891 | + $post_url = isset($dataReceived['url']) === true ? filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL) : ''; |
|
892 | 892 | $post_password = $original_pw = isset($dataReceived['pw']) && is_string($dataReceived['pw']) ? htmlspecialchars_decode($dataReceived['pw']) : ''; |
893 | 893 | $post_login = isset($dataReceived['login']) && is_string($dataReceived['login']) ? filter_var(htmlspecialchars_decode($dataReceived['login']), FILTER_SANITIZE_FULL_SPECIAL_CHARS) : ''; |
894 | - $post_tags = isset($dataReceived['tags'])=== true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
895 | - $post_email = isset($dataReceived['email'])=== true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
894 | + $post_tags = isset($dataReceived['tags']) === true ? htmlspecialchars($dataReceived['tags']) : ''; |
|
895 | + $post_email = isset($dataReceived['email']) === true ? filter_var(htmlspecialchars_decode($dataReceived['email']), FILTER_SANITIZE_EMAIL) : ''; |
|
896 | 896 | $post_template_id = (int) filter_var($dataReceived['template_id'], FILTER_SANITIZE_NUMBER_INT); |
897 | 897 | $inputData['itemId'] = (int) filter_var($dataReceived['id'], FILTER_SANITIZE_NUMBER_INT); |
898 | 898 | $post_anyone_can_modify = (int) filter_var($dataReceived['anyone_can_modify'], FILTER_SANITIZE_NUMBER_INT); |
@@ -923,8 +923,7 @@ discard block |
||
923 | 923 | $post_to_be_deleted_after_date = isset($dataReceived['to_be_deleted_after_date']) === true ? filter_var( |
924 | 924 | $dataReceived['to_be_deleted_after_date'], |
925 | 925 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
926 | - ) : |
|
927 | - ''; |
|
926 | + ) : ''; |
|
928 | 927 | $post_fields = (filter_var_array( |
929 | 928 | $dataReceived['fields'], |
930 | 929 | FILTER_SANITIZE_FULL_SPECIAL_CHARS |
@@ -984,7 +983,7 @@ discard block |
||
984 | 983 | // About special settings |
985 | 984 | $dataFolderSettings = DB::queryFirstRow( |
986 | 985 | 'SELECT bloquer_creation, bloquer_modification, personal_folder, title |
987 | - FROM ' . prefixTable('nested_tree') . ' |
|
986 | + FROM ' . prefixTable('nested_tree').' |
|
988 | 987 | WHERE id = %i', |
989 | 988 | $inputData['folderId'] |
990 | 989 | ); |
@@ -1000,7 +999,7 @@ discard block |
||
1000 | 999 | // Get folder complexity |
1001 | 1000 | $folderComplexity = DB::queryFirstRow( |
1002 | 1001 | 'SELECT valeur |
1003 | - FROM ' . prefixTable('misc') . ' |
|
1002 | + FROM ' . prefixTable('misc').' |
|
1004 | 1003 | WHERE type = %s AND intitule = %i', |
1005 | 1004 | 'complex', |
1006 | 1005 | $inputData['folderId'] |
@@ -1045,8 +1044,8 @@ discard block |
||
1045 | 1044 | // Get all informations for this item |
1046 | 1045 | $dataItem = DB::queryFirstRow( |
1047 | 1046 | 'SELECT * |
1048 | - FROM ' . prefixTable('items') . ' as i |
|
1049 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
1047 | + FROM ' . prefixTable('items').' as i |
|
1048 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
1050 | 1049 | WHERE i.id=%i AND l.action = %s', |
1051 | 1050 | $inputData['itemId'], |
1052 | 1051 | 'at_creation' |
@@ -1089,7 +1088,7 @@ discard block |
||
1089 | 1088 | //db::debugmode(true); |
1090 | 1089 | DB::query( |
1091 | 1090 | 'SELECT * |
1092 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
1091 | + FROM ' . prefixTable('sharekeys_items').' |
|
1093 | 1092 | WHERE object_id = %i AND user_id = %s', |
1094 | 1093 | $inputData['itemId'], |
1095 | 1094 | $session->get('user-id') |
@@ -1149,9 +1148,9 @@ discard block |
||
1149 | 1148 | 'SELECT i.id as id, i.label as label, i.description as description, i.pw as pw, i.url as url, i.id_tree as id_tree, i.perso as perso, i.login as login, |
1150 | 1149 | i.inactif as inactif, i.restricted_to as restricted_to, i.anyone_can_modify as anyone_can_modify, i.email as email, i.notification as notification, |
1151 | 1150 | u.login as user_login, u.email as user_email |
1152 | - FROM ' . prefixTable('items') . ' as i |
|
1153 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id=l.id_item) |
|
1154 | - INNER JOIN ' . prefixTable('users') . ' as u ON (u.id=l.id_user) |
|
1151 | + FROM ' . prefixTable('items').' as i |
|
1152 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id=l.id_item) |
|
1153 | + INNER JOIN ' . prefixTable('users').' as u ON (u.id=l.id_user) |
|
1155 | 1154 | WHERE i.id=%i', |
1156 | 1155 | $inputData['itemId'] |
1157 | 1156 | ); |
@@ -1159,7 +1158,7 @@ discard block |
||
1159 | 1158 | // Should we log a password change? |
1160 | 1159 | $userKey = DB::queryFirstRow( |
1161 | 1160 | 'SELECT share_key |
1162 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
1161 | + FROM ' . prefixTable('sharekeys_items').' |
|
1163 | 1162 | WHERE user_id = %i AND object_id = %i', |
1164 | 1163 | $session->get('user-id'), |
1165 | 1164 | $inputData['itemId'] |
@@ -1223,12 +1222,12 @@ discard block |
||
1223 | 1222 | (int) $post_folder_is_personal, |
1224 | 1223 | (int) $inputData['itemId'], |
1225 | 1224 | $encrypted_password_key, |
1226 | - true, // only for the item creator |
|
1227 | - true, // delete all |
|
1225 | + true, // only for the item creator |
|
1226 | + true, // delete all |
|
1228 | 1227 | ); |
1229 | 1228 | |
1230 | 1229 | // Create a task to create sharekeys for users |
1231 | - if (WIP=== true) error_log('createTaskForItem - new password for this item - '.$post_password ." -- ". $pw); |
|
1230 | + if (WIP === true) error_log('createTaskForItem - new password for this item - '.$post_password." -- ".$pw); |
|
1232 | 1231 | $tasksToBePerformed = ['item_password']; |
1233 | 1232 | $encryptionTaskIsRequested = true; |
1234 | 1233 | } else { |
@@ -1239,7 +1238,7 @@ discard block |
||
1239 | 1238 | // Get list of tags |
1240 | 1239 | $itemTags = DB::queryFirstColumn( |
1241 | 1240 | 'SELECT tag |
1242 | - FROM ' . prefixTable('tags') . ' |
|
1241 | + FROM ' . prefixTable('tags').' |
|
1243 | 1242 | WHERE item_id = %i', |
1244 | 1243 | $inputData['itemId'] |
1245 | 1244 | ); |
@@ -1285,7 +1284,7 @@ discard block |
||
1285 | 1284 | $session->get('user-id'), |
1286 | 1285 | 'at_modification', |
1287 | 1286 | $session->get('user-login'), |
1288 | - 'at_tag : ' . implode(' ', $itemTags) . ' => ' . $post_tags |
|
1287 | + 'at_tag : '.implode(' ', $itemTags).' => '.$post_tags |
|
1289 | 1288 | ); |
1290 | 1289 | } |
1291 | 1290 | |
@@ -1325,8 +1324,8 @@ discard block |
||
1325 | 1324 | 'SELECT c.id AS id, c.title AS title, i.data AS data, i.data_iv AS data_iv, |
1326 | 1325 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, |
1327 | 1326 | c.masked AS masked, i.id AS field_item_id |
1328 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
1329 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
1327 | + FROM ' . prefixTable('categories_items').' AS i |
|
1328 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
1330 | 1329 | WHERE i.field_id = %i AND i.item_id = %i', |
1331 | 1330 | $field['id'], |
1332 | 1331 | $inputData['itemId'] |
@@ -1342,7 +1341,7 @@ discard block |
||
1342 | 1341 | // Perform new query |
1343 | 1342 | $dataTmpCat = DB::queryFirstRow( |
1344 | 1343 | 'SELECT id, title, encrypted_data, masked |
1345 | - FROM ' . prefixTable('categories') . ' |
|
1344 | + FROM ' . prefixTable('categories').' |
|
1346 | 1345 | WHERE id = %i', |
1347 | 1346 | $field['id'] |
1348 | 1347 | ); |
@@ -1372,8 +1371,8 @@ discard block |
||
1372 | 1371 | (int) $post_folder_is_personal, |
1373 | 1372 | (int) $newId, |
1374 | 1373 | $cryptedStuff['objectKey'], |
1375 | - true, // only for the item creator |
|
1376 | - true, // delete all |
|
1374 | + true, // only for the item creator |
|
1375 | + true, // delete all |
|
1377 | 1376 | ); |
1378 | 1377 | |
1379 | 1378 | // update value |
@@ -1423,7 +1422,7 @@ discard block |
||
1423 | 1422 | $session->get('user-id'), |
1424 | 1423 | 'at_modification', |
1425 | 1424 | $session->get('user-login'), |
1426 | - 'at_field : ' . $dataTmpCat['title'] . ' : ' . $field['value'] |
|
1425 | + 'at_field : '.$dataTmpCat['title'].' : '.$field['value'] |
|
1427 | 1426 | ); |
1428 | 1427 | } else { |
1429 | 1428 | // Case where the field already exists |
@@ -1432,7 +1431,7 @@ discard block |
||
1432 | 1431 | // Get user sharekey for this field |
1433 | 1432 | $userKey = DB::queryFirstRow( |
1434 | 1433 | 'SELECT share_key |
1435 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
1434 | + FROM ' . prefixTable('sharekeys_fields').' |
|
1436 | 1435 | WHERE user_id = %i AND object_id = %i', |
1437 | 1436 | $session->get('user-id'), |
1438 | 1437 | $dataTmpCat['field_item_id'] |
@@ -1471,8 +1470,8 @@ discard block |
||
1471 | 1470 | (int) $post_folder_is_personal, |
1472 | 1471 | (int) $dataTmpCat['field_item_id'], |
1473 | 1472 | $cryptedStuff['objectKey'], |
1474 | - true, // only for the item creator |
|
1475 | - true, // delete all |
|
1473 | + true, // only for the item creator |
|
1474 | + true, // delete all |
|
1476 | 1475 | ); |
1477 | 1476 | |
1478 | 1477 | if ($encryptedFieldIsChanged === false) { |
@@ -1514,7 +1513,7 @@ discard block |
||
1514 | 1513 | $session->get('user-id'), |
1515 | 1514 | 'at_modification', |
1516 | 1515 | $session->get('user-login'), |
1517 | - 'at_field : ' . $dataTmpCat['title'] . ' => ' . $oldVal |
|
1516 | + 'at_field : '.$dataTmpCat['title'].' => '.$oldVal |
|
1518 | 1517 | ); |
1519 | 1518 | } |
1520 | 1519 | } |
@@ -1568,7 +1567,7 @@ discard block |
||
1568 | 1567 | ) { |
1569 | 1568 | DB::queryFirstRow( |
1570 | 1569 | 'SELECT * |
1571 | - FROM ' . prefixTable('templates') . ' |
|
1570 | + FROM ' . prefixTable('templates').' |
|
1572 | 1571 | WHERE item_id = %i', |
1573 | 1572 | $inputData['itemId'] |
1574 | 1573 | ); |
@@ -1611,7 +1610,7 @@ discard block |
||
1611 | 1610 | // check if elem exists in Table. If not add it or update it. |
1612 | 1611 | DB::query( |
1613 | 1612 | 'SELECT * |
1614 | - FROM ' . prefixTable('automatic_del') . ' |
|
1613 | + FROM ' . prefixTable('automatic_del').' |
|
1615 | 1614 | WHERE item_id = %i', |
1616 | 1615 | $inputData['itemId'] |
1617 | 1616 | ); |
@@ -1638,7 +1637,7 @@ discard block |
||
1638 | 1637 | // Store updates performed |
1639 | 1638 | array_push( |
1640 | 1639 | $arrayOfChanges, |
1641 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('enabled') |
|
1640 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('enabled') |
|
1642 | 1641 | ); |
1643 | 1642 | |
1644 | 1643 | // update LOG |
@@ -1681,7 +1680,7 @@ discard block |
||
1681 | 1680 | // Store updates performed |
1682 | 1681 | array_push( |
1683 | 1682 | $arrayOfChanges, |
1684 | - $lang->get('automatic_deletion_engaged') . ': ' . $lang->get('disabled') |
|
1683 | + $lang->get('automatic_deletion_engaged').': '.$lang->get('disabled') |
|
1685 | 1684 | ); |
1686 | 1685 | |
1687 | 1686 | // update LOG |
@@ -1709,7 +1708,7 @@ discard block |
||
1709 | 1708 | if (empty($userId) === false) { |
1710 | 1709 | $dataTmp = DB::queryFirstRow( |
1711 | 1710 | 'SELECT id, name, lastname |
1712 | - FROM ' . prefixTable('users') . ' |
|
1711 | + FROM ' . prefixTable('users').' |
|
1713 | 1712 | WHERE id= %i', |
1714 | 1713 | $userId |
1715 | 1714 | ); |
@@ -1717,7 +1716,7 @@ discard block |
||
1717 | 1716 | // Add to array |
1718 | 1717 | array_push( |
1719 | 1718 | $arrayOfUsersRestriction, |
1720 | - $dataTmp['name'] . ' ' . $dataTmp['lastname'] |
|
1719 | + $dataTmp['name'].' '.$dataTmp['lastname'] |
|
1721 | 1720 | ); |
1722 | 1721 | array_push( |
1723 | 1722 | $arrayOfUsersIdRestriction, |
@@ -1748,8 +1747,8 @@ discard block |
||
1748 | 1747 | // get values before deleting them |
1749 | 1748 | $rows = DB::query( |
1750 | 1749 | 'SELECT t.title, t.id AS id |
1751 | - FROM ' . prefixTable('roles_title') . ' as t |
|
1752 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (t.id=r.role_id) |
|
1750 | + FROM ' . prefixTable('roles_title').' as t |
|
1751 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (t.id=r.role_id) |
|
1753 | 1752 | WHERE r.item_id = %i |
1754 | 1753 | ORDER BY t.title ASC', |
1755 | 1754 | $inputData['itemId'] |
@@ -1783,7 +1782,7 @@ discard block |
||
1783 | 1782 | ); |
1784 | 1783 | $dataTmp = DB::queryFirstRow( |
1785 | 1784 | 'SELECT title |
1786 | - FROM ' . prefixTable('roles_title') . ' |
|
1785 | + FROM ' . prefixTable('roles_title').' |
|
1787 | 1786 | WHERE id = %i', |
1788 | 1787 | $role |
1789 | 1788 | ); |
@@ -1811,7 +1810,7 @@ discard block |
||
1811 | 1810 | // Get current status |
1812 | 1811 | $otpStatus = DB::queryFirstRow( |
1813 | 1812 | 'SELECT enabled as otp_is_enabled, phone_number, secret |
1814 | - FROM ' . prefixTable('items_otp') . ' |
|
1813 | + FROM ' . prefixTable('items_otp').' |
|
1815 | 1814 | WHERE item_id = %i', |
1816 | 1815 | $inputData['itemId'] |
1817 | 1816 | ); |
@@ -1825,7 +1824,7 @@ discard block |
||
1825 | 1824 | 'decrypt' |
1826 | 1825 | )['string']; |
1827 | 1826 | } else { |
1828 | - $currentsecret=''; |
|
1827 | + $currentsecret = ''; |
|
1829 | 1828 | } |
1830 | 1829 | |
1831 | 1830 | // If OTP secret provided then encrypt it |
@@ -1875,7 +1874,7 @@ discard block |
||
1875 | 1874 | $session->get('user-id'), |
1876 | 1875 | 'at_modification', |
1877 | 1876 | $session->get('user-login'), |
1878 | - 'at_otp_status:' . ((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
1877 | + 'at_otp_status:'.((int) $post_otp_is_enabled === 0 ? 'disabled' : 'enabled') |
|
1879 | 1878 | ); |
1880 | 1879 | } |
1881 | 1880 | if ($otpStatus['phone_number'] !== $post_otp_phone_number) { |
@@ -1886,7 +1885,7 @@ discard block |
||
1886 | 1885 | $session->get('user-id'), |
1887 | 1886 | 'at_modification', |
1888 | 1887 | $session->get('user-login'), |
1889 | - 'at_phone_number:' . $otpStatus['phone_number'] . ' => ' . $post_otp_phone_number |
|
1888 | + 'at_phone_number:'.$otpStatus['phone_number'].' => '.$post_otp_phone_number |
|
1890 | 1889 | ); |
1891 | 1890 | } |
1892 | 1891 | if ($currentsecret !== $post_otp_secret) { |
@@ -1935,8 +1934,8 @@ discard block |
||
1935 | 1934 | $session->get('user-id'), |
1936 | 1935 | 'at_modification', |
1937 | 1936 | $session->get('user-login'), |
1938 | - 'at_restriction : ' . (count($diffUsersRestiction) > 0 ? |
|
1939 | - implode(', ', $arrayOfUsersRestriction) . (count($diffRolesRestiction) > 0 ? ', ' : '') : '') . (count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
1937 | + 'at_restriction : '.(count($diffUsersRestiction) > 0 ? |
|
1938 | + implode(', ', $arrayOfUsersRestriction).(count($diffRolesRestiction) > 0 ? ', ' : '') : '').(count($diffRolesRestiction) > 0 ? implode(', ', $arrayOfRestrictionRoles) : '') |
|
1940 | 1939 | ); |
1941 | 1940 | } |
1942 | 1941 | |
@@ -1956,7 +1955,7 @@ discard block |
||
1956 | 1955 | $session->get('user-id'), |
1957 | 1956 | 'at_modification', |
1958 | 1957 | $session->get('user-login'), |
1959 | - 'at_label : ' . $data['label'] . ' => ' . $inputData['label'] |
|
1958 | + 'at_label : '.$data['label'].' => '.$inputData['label'] |
|
1960 | 1959 | ); |
1961 | 1960 | } |
1962 | 1961 | // LOGIN |
@@ -1975,7 +1974,7 @@ discard block |
||
1975 | 1974 | $session->get('user-id'), |
1976 | 1975 | 'at_modification', |
1977 | 1976 | $session->get('user-login'), |
1978 | - 'at_login : ' . $data['login'] . ' => ' . $post_login |
|
1977 | + 'at_login : '.$data['login'].' => '.$post_login |
|
1979 | 1978 | ); |
1980 | 1979 | } |
1981 | 1980 | |
@@ -1994,7 +1993,7 @@ discard block |
||
1994 | 1993 | $session->get('user-id'), |
1995 | 1994 | 'at_modification', |
1996 | 1995 | $session->get('user-login'), |
1997 | - 'at_email : ' . $data['email'] . ' => ' . $post_email |
|
1996 | + 'at_email : '.$data['email'].' => '.$post_email |
|
1998 | 1997 | ); |
1999 | 1998 | } |
2000 | 1999 | // URL |
@@ -2013,7 +2012,7 @@ discard block |
||
2013 | 2012 | $session->get('user-id'), |
2014 | 2013 | 'at_modification', |
2015 | 2014 | $session->get('user-login'), |
2016 | - 'at_url : ' . $data['url'] . ' => ' . $post_url |
|
2015 | + 'at_url : '.$data['url'].' => '.$post_url |
|
2017 | 2016 | ); |
2018 | 2017 | } |
2019 | 2018 | // DESCRIPTION |
@@ -2039,7 +2038,7 @@ discard block |
||
2039 | 2038 | // FOLDER |
2040 | 2039 | if ((int) $data['id_tree'] !== (int) $inputData['folderId']) { |
2041 | 2040 | // Get name of folders |
2042 | - $dataTmp = DB::query('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
2041 | + $dataTmp = DB::query('SELECT title FROM '.prefixTable('nested_tree').' WHERE id IN %li', array($data['id_tree'], $inputData['folderId'])); |
|
2043 | 2042 | |
2044 | 2043 | // Store updates performed |
2045 | 2044 | array_push( |
@@ -2055,7 +2054,7 @@ discard block |
||
2055 | 2054 | $session->get('user-id'), |
2056 | 2055 | 'at_modification', |
2057 | 2056 | $session->get('user-login'), |
2058 | - 'at_category : ' . $dataTmp[0]['title'] . ' => ' . $dataTmp[1]['title'] |
|
2057 | + 'at_category : '.$dataTmp[0]['title'].' => '.$dataTmp[1]['title'] |
|
2059 | 2058 | ); |
2060 | 2059 | } |
2061 | 2060 | // ANYONE_CAN_MODIFY |
@@ -2063,7 +2062,7 @@ discard block |
||
2063 | 2062 | // Store updates performed |
2064 | 2063 | array_push( |
2065 | 2064 | $arrayOfChanges, |
2066 | - $lang->get('at_anyoneconmodify') . ': ' . ((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
2065 | + $lang->get('at_anyoneconmodify').': '.((int) $post_anyone_can_modify === 0 ? $lang->get('disabled') : $lang->get('enabled')) |
|
2067 | 2066 | ); |
2068 | 2067 | |
2069 | 2068 | // Log |
@@ -2074,15 +2073,15 @@ discard block |
||
2074 | 2073 | $session->get('user-id'), |
2075 | 2074 | 'at_modification', |
2076 | 2075 | $session->get('user-login'), |
2077 | - 'at_anyoneconmodify : ' . ((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
2076 | + 'at_anyoneconmodify : '.((int) $post_anyone_can_modify === 0 ? 'disabled' : 'enabled') |
|
2078 | 2077 | ); |
2079 | 2078 | } |
2080 | 2079 | |
2081 | 2080 | // Reload new values |
2082 | 2081 | $dataItem = DB::queryFirstRow( |
2083 | 2082 | 'SELECT * |
2084 | - FROM ' . prefixTable('items') . ' as i |
|
2085 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
2083 | + FROM ' . prefixTable('items').' as i |
|
2084 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
2086 | 2085 | WHERE i.id = %i AND l.action = %s', |
2087 | 2086 | $inputData['itemId'], |
2088 | 2087 | 'at_creation' |
@@ -2091,8 +2090,8 @@ discard block |
||
2091 | 2090 | $history = ''; |
2092 | 2091 | $rows = DB::query( |
2093 | 2092 | 'SELECT l.date as date, l.action as action, l.raison as raison, u.login as login |
2094 | - FROM ' . prefixTable('log_items') . ' as l |
|
2095 | - LEFT JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
2093 | + FROM ' . prefixTable('log_items').' as l |
|
2094 | + LEFT JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
2096 | 2095 | WHERE l.action <> %s AND id_item=%s', |
2097 | 2096 | 'at_shown', |
2098 | 2097 | $inputData['itemId'] |
@@ -2101,14 +2100,14 @@ discard block |
||
2101 | 2100 | if ($record['raison'] === NULL) continue; |
2102 | 2101 | $reason = explode(':', $record['raison']); |
2103 | 2102 | if (count($reason) > 0) { |
2104 | - $sentence = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) . ' - ' |
|
2105 | - . $record['login'] . ' - ' . $lang->get($record['action']) . ' - ' |
|
2106 | - . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])) . ' : ' . $reason[1] |
|
2103 | + $sentence = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']).' - ' |
|
2104 | + . $record['login'].' - '.$lang->get($record['action']).' - ' |
|
2105 | + . (empty($record['raison']) === false ? (count($reason) > 1 ? $lang->get(trim($reason[0])).' : '.$reason[1] |
|
2107 | 2106 | : $lang->get(trim($reason[0]))) : ''); |
2108 | 2107 | if (empty($history)) { |
2109 | 2108 | $history = $sentence; |
2110 | 2109 | } else { |
2111 | - $history .= '<br />' . $sentence; |
|
2110 | + $history .= '<br />'.$sentence; |
|
2112 | 2111 | } |
2113 | 2112 | } |
2114 | 2113 | } |
@@ -2246,7 +2245,7 @@ discard block |
||
2246 | 2245 | ) { |
2247 | 2246 | // load the original record into an array |
2248 | 2247 | $originalRecord = DB::queryFirstRow( |
2249 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
2248 | + 'SELECT * FROM '.prefixTable('items').' |
|
2250 | 2249 | WHERE id = %i', |
2251 | 2250 | $inputData['itemId'] |
2252 | 2251 | ); |
@@ -2265,7 +2264,7 @@ discard block |
||
2265 | 2264 | |
2266 | 2265 | // Load the destination folder record into an array |
2267 | 2266 | $dataDestination = DB::queryFirstRow( |
2268 | - 'SELECT personal_folder FROM ' . prefixTable('nested_tree') . ' |
|
2267 | + 'SELECT personal_folder FROM '.prefixTable('nested_tree').' |
|
2269 | 2268 | WHERE id = %i', |
2270 | 2269 | $post_dest_id |
2271 | 2270 | ); |
@@ -2273,7 +2272,7 @@ discard block |
||
2273 | 2272 | // Get the ITEM object key for the user |
2274 | 2273 | $userKey = DB::queryFirstRow( |
2275 | 2274 | 'SELECT share_key |
2276 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
2275 | + FROM ' . prefixTable('sharekeys_items').' |
|
2277 | 2276 | WHERE user_id = %i AND object_id = %i', |
2278 | 2277 | $session->get('user-id'), |
2279 | 2278 | $inputData['itemId'] |
@@ -2350,8 +2349,8 @@ discard block |
||
2350 | 2349 | // Manage Custom Fields |
2351 | 2350 | $rows = DB::query( |
2352 | 2351 | 'SELECT ci.id AS id, ci.data AS data, ci.field_id AS field_id, c.encrypted_data AS encrypted_data |
2353 | - FROM ' . prefixTable('categories_items') . ' AS ci |
|
2354 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (c.id = ci.field_id) |
|
2352 | + FROM ' . prefixTable('categories_items').' AS ci |
|
2353 | + INNER JOIN ' . prefixTable('categories').' AS c ON (c.id = ci.field_id) |
|
2355 | 2354 | WHERE ci.item_id = %i', |
2356 | 2355 | $inputData['itemId'] |
2357 | 2356 | ); |
@@ -2363,7 +2362,7 @@ discard block |
||
2363 | 2362 | // Get user key |
2364 | 2363 | $userKey = DB::queryFirstRow( |
2365 | 2364 | 'SELECT share_key |
2366 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
2365 | + FROM ' . prefixTable('sharekeys_fields').' |
|
2367 | 2366 | WHERE user_id = %i AND object_id = %i', |
2368 | 2367 | $session->get('user-id'), |
2369 | 2368 | $field['id'] |
@@ -2430,15 +2429,15 @@ discard block |
||
2430 | 2429 | $rows = DB::query( |
2431 | 2430 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
2432 | 2431 | f.size AS size, f.type AS type, s.share_key AS share_key |
2433 | - FROM ' . prefixTable('files') . ' AS f |
|
2434 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
2432 | + FROM ' . prefixTable('files').' AS f |
|
2433 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
2435 | 2434 | WHERE s.user_id = %i AND f.id_item = %i', |
2436 | 2435 | $session->get('user-id'), |
2437 | 2436 | $inputData['itemId'] |
2438 | 2437 | ); |
2439 | 2438 | foreach ($rows as $record) { |
2440 | 2439 | // Check if file still exists |
2441 | - if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($record['file'])) === true) { |
|
2440 | + if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($record['file'])) === true) { |
|
2442 | 2441 | // Step1 - decrypt the file |
2443 | 2442 | // deepcode ignore PT: path is sanitized inside decryptFile() |
2444 | 2443 | $fileContent = decryptFile( |
@@ -2449,8 +2448,8 @@ discard block |
||
2449 | 2448 | |
2450 | 2449 | // Step2 - create file |
2451 | 2450 | // deepcode ignore InsecureHash: md5 is used jonly for file name in order to get a hashed value in database |
2452 | - $newFileName = md5(time() . '_' . $record['id']) . '.' . $record['extension']; |
|
2453 | - $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab'); |
|
2451 | + $newFileName = md5(time().'_'.$record['id']).'.'.$record['extension']; |
|
2452 | + $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab'); |
|
2454 | 2453 | if ($outstream === false) { |
2455 | 2454 | echo prepareExchangedData( |
2456 | 2455 | array( |
@@ -2523,7 +2522,7 @@ discard block |
||
2523 | 2522 | |
2524 | 2523 | // ------------------------- |
2525 | 2524 | // Add specific restrictions |
2526 | - $rows = DB::query('SELECT * FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', $inputData['itemId']); |
|
2525 | + $rows = DB::query('SELECT * FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', $inputData['itemId']); |
|
2527 | 2526 | foreach ($rows as $record) { |
2528 | 2527 | DB::insert( |
2529 | 2528 | prefixTable('restriction_to_roles'), |
@@ -2535,7 +2534,7 @@ discard block |
||
2535 | 2534 | } |
2536 | 2535 | |
2537 | 2536 | // Add Tags |
2538 | - $rows = DB::query('SELECT * FROM ' . prefixTable('tags') . ' WHERE item_id = %i', $inputData['itemId']); |
|
2537 | + $rows = DB::query('SELECT * FROM '.prefixTable('tags').' WHERE item_id = %i', $inputData['itemId']); |
|
2539 | 2538 | foreach ($rows as $record) { |
2540 | 2539 | DB::insert( |
2541 | 2540 | prefixTable('tags'), |
@@ -2637,7 +2636,7 @@ discard block |
||
2637 | 2636 | // then we can show it |
2638 | 2637 | $item_deleted = DB::queryFirstRow( |
2639 | 2638 | 'SELECT * |
2640 | - FROM ' . prefixTable('log_items') . ' |
|
2639 | + FROM ' . prefixTable('log_items').' |
|
2641 | 2640 | WHERE id_item = %i AND action = %s |
2642 | 2641 | ORDER BY date DESC |
2643 | 2642 | LIMIT 0, 1', |
@@ -2648,7 +2647,7 @@ discard block |
||
2648 | 2647 | |
2649 | 2648 | $item_restored = DB::queryFirstRow( |
2650 | 2649 | 'SELECT * |
2651 | - FROM ' . prefixTable('log_items') . ' |
|
2650 | + FROM ' . prefixTable('log_items').' |
|
2652 | 2651 | WHERE id_item = %i AND action = %s |
2653 | 2652 | ORDER BY date DESC |
2654 | 2653 | LIMIT 0, 1', |
@@ -2672,8 +2671,8 @@ discard block |
||
2672 | 2671 | // Get all informations for this item |
2673 | 2672 | $dataItem = DB::queryFirstRow( |
2674 | 2673 | 'SELECT * |
2675 | - FROM ' . prefixTable('items') . ' as i |
|
2676 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
2674 | + FROM ' . prefixTable('items').' as i |
|
2675 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
2677 | 2676 | WHERE i.id = %i AND l.action = %s', |
2678 | 2677 | $inputData['id'], |
2679 | 2678 | 'at_creation' |
@@ -2682,7 +2681,7 @@ discard block |
||
2682 | 2681 | // Notification |
2683 | 2682 | DB::queryFirstRow( |
2684 | 2683 | 'SELECT * |
2685 | - FROM ' . prefixTable('notification') . ' |
|
2684 | + FROM ' . prefixTable('notification').' |
|
2686 | 2685 | WHERE item_id = %i AND user_id = %i', |
2687 | 2686 | $inputData['id'], |
2688 | 2687 | $session->get('user-id') |
@@ -2701,7 +2700,7 @@ discard block |
||
2701 | 2700 | |
2702 | 2701 | // manage case of API user |
2703 | 2702 | if ($dataItem['id_user'] === API_USER_ID) { |
2704 | - $arrData['author'] = 'API [' . $dataItem['description'] . ']'; |
|
2703 | + $arrData['author'] = 'API ['.$dataItem['description'].']'; |
|
2705 | 2704 | $arrData['id_user'] = API_USER_ID; |
2706 | 2705 | $arrData['author_email'] = ''; |
2707 | 2706 | $arrData['notification_status'] = false; |
@@ -2711,7 +2710,7 @@ discard block |
||
2711 | 2710 | $tags = array(); |
2712 | 2711 | $rows = DB::query( |
2713 | 2712 | 'SELECT tag |
2714 | - FROM ' . prefixTable('tags') . ' |
|
2713 | + FROM ' . prefixTable('tags').' |
|
2715 | 2714 | WHERE item_id = %i', |
2716 | 2715 | $inputData['id'] |
2717 | 2716 | ); |
@@ -2736,7 +2735,7 @@ discard block |
||
2736 | 2735 | // Check if user has a role that is accepted |
2737 | 2736 | $rows_tmp = DB::query( |
2738 | 2737 | 'SELECT role_id |
2739 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
2738 | + FROM ' . prefixTable('restriction_to_roles').' |
|
2740 | 2739 | WHERE item_id=%i', |
2741 | 2740 | $inputData['id'] |
2742 | 2741 | ); |
@@ -2750,7 +2749,7 @@ discard block |
||
2750 | 2749 | // Get the object key for the user |
2751 | 2750 | $userKey = DB::queryFirstRow( |
2752 | 2751 | 'SELECT share_key |
2753 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
2752 | + FROM ' . prefixTable('sharekeys_items').' |
|
2754 | 2753 | WHERE user_id = %i AND object_id = %i', |
2755 | 2754 | $session->get('user-id'), |
2756 | 2755 | $inputData['id'] |
@@ -2847,8 +2846,8 @@ discard block |
||
2847 | 2846 | // Add restriction if item is restricted to roles |
2848 | 2847 | $rows = DB::query( |
2849 | 2848 | 'SELECT t.title, t.id |
2850 | - FROM ' . prefixTable('roles_title') . ' AS t |
|
2851 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' AS r ON (t.id=r.role_id) |
|
2849 | + FROM ' . prefixTable('roles_title').' AS t |
|
2850 | + INNER JOIN ' . prefixTable('restriction_to_roles').' AS r ON (t.id=r.role_id) |
|
2852 | 2851 | WHERE r.item_id = %i |
2853 | 2852 | ORDER BY t.title ASC', |
2854 | 2853 | $inputData['id'] |
@@ -2864,8 +2863,8 @@ discard block |
||
2864 | 2863 | $tmp = array(); |
2865 | 2864 | $rows = DB::query( |
2866 | 2865 | 'SELECT k.label, k.id |
2867 | - FROM ' . prefixTable('kb_items') . ' as i |
|
2868 | - INNER JOIN ' . prefixTable('kb') . ' as k ON (i.kb_id=k.id) |
|
2866 | + FROM ' . prefixTable('kb_items').' as i |
|
2867 | + INNER JOIN ' . prefixTable('kb').' as k ON (i.kb_id=k.id) |
|
2869 | 2868 | WHERE i.item_id = %i |
2870 | 2869 | ORDER BY k.label ASC', |
2871 | 2870 | $inputData['id'] |
@@ -2948,7 +2947,7 @@ discard block |
||
2948 | 2947 | $arrCatList = array(); |
2949 | 2948 | $rows_tmp = DB::query( |
2950 | 2949 | 'SELECT id_category |
2951 | - FROM ' . prefixTable('categories_folders') . ' |
|
2950 | + FROM ' . prefixTable('categories_folders').' |
|
2952 | 2951 | WHERE id_folder=%i', |
2953 | 2952 | $inputData['folderId'] |
2954 | 2953 | ); |
@@ -2963,8 +2962,8 @@ discard block |
||
2963 | 2962 | 'SELECT i.id AS id, i.field_id AS field_id, i.data AS data, i.item_id AS item_id, |
2964 | 2963 | i.encryption_type AS encryption_type, c.encrypted_data AS encrypted_data, c.parent_id AS parent_id, |
2965 | 2964 | c.type as field_type, c.masked AS field_masked, c.role_visibility AS role_visibility |
2966 | - FROM ' . prefixTable('categories_items') . ' AS i |
|
2967 | - INNER JOIN ' . prefixTable('categories') . ' AS c ON (i.field_id=c.id) |
|
2965 | + FROM ' . prefixTable('categories_items').' AS i |
|
2966 | + INNER JOIN ' . prefixTable('categories').' AS c ON (i.field_id=c.id) |
|
2968 | 2967 | WHERE i.item_id=%i AND c.parent_id IN %ls', |
2969 | 2968 | $inputData['id'], |
2970 | 2969 | $arrCatList |
@@ -2975,7 +2974,7 @@ discard block |
||
2975 | 2974 | //db::debugmode(true); |
2976 | 2975 | $userKey = DB::queryFirstRow( |
2977 | 2976 | 'SELECT share_key |
2978 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
2977 | + FROM ' . prefixTable('sharekeys_fields').' |
|
2979 | 2978 | WHERE user_id = %i AND object_id = %i', |
2980 | 2979 | $session->get('user-id'), |
2981 | 2980 | $row['id'] |
@@ -2993,7 +2992,7 @@ discard block |
||
2993 | 2992 | } else if (DB::count() === 0 && (int) $row['encrypted_data'] === 0) { |
2994 | 2993 | // Data is not encrypted in DB |
2995 | 2994 | $fieldText = [ |
2996 | - 'string' => $row['data'],//#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
2995 | + 'string' => $row['data'], //#3945 - isBase64($row['data']) === true ? base64_decode($row['data']) : |
|
2997 | 2996 | 'encrypted' => false, |
2998 | 2997 | 'error' => false, |
2999 | 2998 | ]; |
@@ -3038,7 +3037,7 @@ discard block |
||
3038 | 3037 | if (isset($SETTINGS['item_creation_templates']) && (int) $SETTINGS['item_creation_templates'] === 1) { |
3039 | 3038 | $rows_tmp = DB::queryFirstRow( |
3040 | 3039 | 'SELECT category_id |
3041 | - FROM ' . prefixTable('templates') . ' |
|
3040 | + FROM ' . prefixTable('templates').' |
|
3042 | 3041 | WHERE item_id = %i', |
3043 | 3042 | $inputData['id'] |
3044 | 3043 | ); |
@@ -3055,7 +3054,7 @@ discard block |
||
3055 | 3054 | // Evaluate if item is ready for all users |
3056 | 3055 | $rows_tmp = DB::queryFirstRow( |
3057 | 3056 | 'SELECT finished_at |
3058 | - FROM ' . prefixTable('background_tasks') . ' |
|
3057 | + FROM ' . prefixTable('background_tasks').' |
|
3059 | 3058 | WHERE item_id = %i', |
3060 | 3059 | $inputData['id'] |
3061 | 3060 | ); |
@@ -3072,7 +3071,7 @@ discard block |
||
3072 | 3071 | // Is the Item to be deleted? |
3073 | 3072 | $dataDelete = DB::queryFirstRow( |
3074 | 3073 | 'SELECT * |
3075 | - FROM ' . prefixTable('automatic_del') . ' |
|
3074 | + FROM ' . prefixTable('automatic_del').' |
|
3076 | 3075 | WHERE item_id = %i', |
3077 | 3076 | $inputData['id'] |
3078 | 3077 | ); |
@@ -3153,14 +3152,14 @@ discard block |
||
3153 | 3152 | if (empty($userRest) === false) { |
3154 | 3153 | $dataTmp = DB::queryFirstRow( |
3155 | 3154 | 'SELECT login |
3156 | - FROM ' . prefixTable('users') . ' |
|
3155 | + FROM ' . prefixTable('users').' |
|
3157 | 3156 | WHERE id= %i', |
3158 | 3157 | $userRest |
3159 | 3158 | ); |
3160 | 3159 | if (empty($listOfRestricted)) { |
3161 | 3160 | $listOfRestricted = $dataTmp['login']; |
3162 | 3161 | } else { |
3163 | - $listOfRestricted .= ';' . $dataTmp['login']; |
|
3162 | + $listOfRestricted .= ';'.$dataTmp['login']; |
|
3164 | 3163 | } |
3165 | 3164 | } |
3166 | 3165 | } |
@@ -3234,9 +3233,9 @@ discard block |
||
3234 | 3233 | // Load item data |
3235 | 3234 | $dataItem = DB::queryFirstRow( |
3236 | 3235 | 'SELECT i.*, n.title AS folder_title, o.enabled AS otp_for_item_enabled, o.phone_number AS otp_phone_number, o.secret AS otp_secret |
3237 | - FROM ' . prefixTable('items') . ' AS i |
|
3238 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
3239 | - LEFT JOIN ' . prefixTable('items_otp') . ' AS o ON (o.item_id = i.id) |
|
3236 | + FROM ' . prefixTable('items').' AS i |
|
3237 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
3238 | + LEFT JOIN ' . prefixTable('items_otp').' AS o ON (o.item_id = i.id) |
|
3240 | 3239 | WHERE i.id = %i', |
3241 | 3240 | $inputData['id'] |
3242 | 3241 | ); |
@@ -3258,7 +3257,7 @@ discard block |
||
3258 | 3257 | // Check if user has a role that is accepted |
3259 | 3258 | $rows_tmp = DB::query( |
3260 | 3259 | 'SELECT role_id |
3261 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
3260 | + FROM ' . prefixTable('restriction_to_roles').' |
|
3262 | 3261 | WHERE item_id=%i', |
3263 | 3262 | $inputData['id'] |
3264 | 3263 | ); |
@@ -3290,12 +3289,12 @@ discard block |
||
3290 | 3289 | // launch query |
3291 | 3290 | $rows = DB::query( |
3292 | 3291 | 'SELECT id, name, file, extension, size |
3293 | - FROM ' . prefixTable('files') . ' |
|
3292 | + FROM ' . prefixTable('files').' |
|
3294 | 3293 | WHERE id_item = %i AND confirmed = 1', |
3295 | 3294 | $inputData['id'] |
3296 | 3295 | ); |
3297 | 3296 | foreach ($rows as $record) { |
3298 | - $filename = basename($record['name'], '.' . $record['extension']); |
|
3297 | + $filename = basename($record['name'], '.'.$record['extension']); |
|
3299 | 3298 | $filename = isBase64($filename) === true ? base64_decode($filename) : $filename; |
3300 | 3299 | |
3301 | 3300 | array_push( |
@@ -3308,7 +3307,7 @@ discard block |
||
3308 | 3307 | 'is_image' => in_array(strtolower($record['extension']), TP_IMAGE_FILE_EXT) === true ? 1 : 0, |
3309 | 3308 | 'id' => $record['id'], |
3310 | 3309 | 'key' => $session->get('user-key_tmp'), |
3311 | - 'internalFilename' => basename($record['name'], '.' . $record['extension']), |
|
3310 | + 'internalFilename' => basename($record['name'], '.'.$record['extension']), |
|
3312 | 3311 | ) |
3313 | 3312 | ); |
3314 | 3313 | } |
@@ -3346,7 +3345,7 @@ discard block |
||
3346 | 3345 | array( |
3347 | 3346 | 'latest_items' => implode(';', $session->get('user-latest_items')), |
3348 | 3347 | ), |
3349 | - 'id=' . $session->get('user-id') |
|
3348 | + 'id='.$session->get('user-id') |
|
3350 | 3349 | ); |
3351 | 3350 | } |
3352 | 3351 | |
@@ -3355,8 +3354,8 @@ discard block |
||
3355 | 3354 | $listOptionsForRoles = array(); |
3356 | 3355 | $rows = DB::query( |
3357 | 3356 | 'SELECT r.role_id AS role_id, t.title AS title |
3358 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
3359 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
3357 | + FROM ' . prefixTable('roles_values').' AS r |
|
3358 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
3360 | 3359 | WHERE r.folder_id = %i', |
3361 | 3360 | $dataItem['id_tree'] |
3362 | 3361 | ); |
@@ -3370,9 +3369,9 @@ discard block |
||
3370 | 3369 | ); |
3371 | 3370 | $rows2 = DB::query( |
3372 | 3371 | 'SELECT id, login, fonction_id, email, name, lastname |
3373 | - FROM ' . prefixTable('users') . ' |
|
3372 | + FROM ' . prefixTable('users').' |
|
3374 | 3373 | WHERE fonction_id LIKE %s', |
3375 | - '%' . $record['role_id'] . '%' |
|
3374 | + '%'.$record['role_id'].'%' |
|
3376 | 3375 | ); |
3377 | 3376 | foreach ($rows2 as $record2) { |
3378 | 3377 | foreach (explode(';', $record2['fonction_id']) as $role) { |
@@ -3385,7 +3384,7 @@ discard block |
||
3385 | 3384 | array( |
3386 | 3385 | 'id' => (int) $record2['id'], |
3387 | 3386 | 'login' => $record2['login'], |
3388 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
3387 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
3389 | 3388 | 'email' => $record2['email'], |
3390 | 3389 | ) |
3391 | 3390 | ); |
@@ -3404,16 +3403,16 @@ discard block |
||
3404 | 3403 | $path = ''; |
3405 | 3404 | foreach ($arbo as $elem) { |
3406 | 3405 | if (empty($path) === true) { |
3407 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
3406 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
3408 | 3407 | } else { |
3409 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
3408 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
3410 | 3409 | } |
3411 | 3410 | } |
3412 | 3411 | // Build text to show user |
3413 | 3412 | if (empty($path) === true) { |
3414 | 3413 | $path = addslashes($dataItem['label']); |
3415 | 3414 | } else { |
3416 | - $path = addslashes($dataItem['label']) . ' (' . $path . ')'; |
|
3415 | + $path = addslashes($dataItem['label']).' ('.$path.')'; |
|
3417 | 3416 | } |
3418 | 3417 | |
3419 | 3418 | // Add Admins to notification list if expected |
@@ -3436,7 +3435,7 @@ discard block |
||
3436 | 3435 | array( |
3437 | 3436 | addslashes($session->get('user-login')), |
3438 | 3437 | $path, |
3439 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $dataItem['id'], |
|
3438 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$dataItem['id'], |
|
3440 | 3439 | ), |
3441 | 3440 | $lang->get('email_on_open_notification_mail') |
3442 | 3441 | ), |
@@ -3446,7 +3445,7 @@ discard block |
||
3446 | 3445 | } |
3447 | 3446 | |
3448 | 3447 | // has this item a change proposal |
3449 | - DB::query('SELECT * FROM ' . prefixTable('items_change') . ' WHERE item_id = %i', $inputData['id']); |
|
3448 | + DB::query('SELECT * FROM '.prefixTable('items_change').' WHERE item_id = %i', $inputData['id']); |
|
3450 | 3449 | $returnArray['has_change_proposal'] = DB::count(); |
3451 | 3450 | |
3452 | 3451 | // Setting |
@@ -3457,7 +3456,7 @@ discard block |
||
3457 | 3456 | if (isset($SETTINGS['otv_is_enabled']) === true && (int) $SETTINGS['otv_is_enabled'] === 1) { |
3458 | 3457 | DB::query( |
3459 | 3458 | 'SELECT * |
3460 | - FROM ' . prefixTable('otv') . ' |
|
3459 | + FROM ' . prefixTable('otv').' |
|
3461 | 3460 | WHERE item_id = %i |
3462 | 3461 | AND time_limit > %i', |
3463 | 3462 | $inputData['id'], |
@@ -3556,7 +3555,7 @@ discard block |
||
3556 | 3555 | // Load item data |
3557 | 3556 | $data = DB::queryFirstRow( |
3558 | 3557 | 'SELECT id_tree, id, label |
3559 | - FROM ' . prefixTable('items') . ' |
|
3558 | + FROM ' . prefixTable('items').' |
|
3560 | 3559 | WHERE id = %i OR item_key = %s', |
3561 | 3560 | $inputData['itemId'], |
3562 | 3561 | $inputData['itemKey'] |
@@ -3647,7 +3646,7 @@ discard block |
||
3647 | 3646 | // Load item data |
3648 | 3647 | $dataItem = DB::queryFirstRow( |
3649 | 3648 | 'SELECT secret, enabled |
3650 | - FROM ' . prefixTable('items_otp') . ' |
|
3649 | + FROM ' . prefixTable('items_otp').' |
|
3651 | 3650 | WHERE item_id = %i', |
3652 | 3651 | $inputData['id'] |
3653 | 3652 | ); |
@@ -3729,13 +3728,13 @@ discard block |
||
3729 | 3728 | |
3730 | 3729 | // Check if user is allowed to access this folder |
3731 | 3730 | if (!in_array($inputData['folderId'], $session->get('user-accessible_folders'))) { |
3732 | - echo '[{"error" : "' . $lang->get('error_not_allowed_to') . '"}]'; |
|
3731 | + echo '[{"error" : "'.$lang->get('error_not_allowed_to').'"}]'; |
|
3733 | 3732 | break; |
3734 | 3733 | } |
3735 | 3734 | |
3736 | 3735 | // Check if title doesn't contains html codes |
3737 | 3736 | if (preg_match_all('|<[^>]+>(.*)</[^>]+>|U', $title, $out)) { |
3738 | - echo '[ { "error" : "' . $lang->get('error_html_codes') . '" } ]'; |
|
3737 | + echo '[ { "error" : "'.$lang->get('error_html_codes').'" } ]'; |
|
3739 | 3738 | break; |
3740 | 3739 | } |
3741 | 3740 | // check that title is not numeric |
@@ -3746,9 +3745,9 @@ discard block |
||
3746 | 3745 | |
3747 | 3746 | // Check if duplicate folders name are allowed |
3748 | 3747 | if (isset($SETTINGS['duplicate_folder']) && $SETTINGS['duplicate_folder'] === '0') { |
3749 | - $data = DB::queryFirstRow('SELECT id, title FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', $title); |
|
3748 | + $data = DB::queryFirstRow('SELECT id, title FROM '.prefixTable('nested_tree').' WHERE title = %s', $title); |
|
3750 | 3749 | if (empty($data['id']) === false && $dataReceived['folder'] !== $data['id']) { |
3751 | - echo '[ { "error" : "' . $lang->get('error_group_exist') . '" } ]'; |
|
3750 | + echo '[ { "error" : "'.$lang->get('error_group_exist').'" } ]'; |
|
3752 | 3751 | break; |
3753 | 3752 | } |
3754 | 3753 | } |
@@ -3756,7 +3755,7 @@ discard block |
||
3756 | 3755 | // query on folder |
3757 | 3756 | $data = DB::queryFirstRow( |
3758 | 3757 | 'SELECT parent_id, personal_folder |
3759 | - FROM ' . prefixTable('nested_tree') . ' |
|
3758 | + FROM ' . prefixTable('nested_tree').' |
|
3760 | 3759 | WHERE id = %i', |
3761 | 3760 | $inputData['folderId'] |
3762 | 3761 | ); |
@@ -3766,20 +3765,20 @@ discard block |
||
3766 | 3765 | if ($session->get('user-admin') !== 1 && $session->get('user-manager') !== 1 && $data['personal_folder'] === '0') { |
3767 | 3766 | $data = DB::queryFirstRow( |
3768 | 3767 | 'SELECT valeur |
3769 | - FROM ' . prefixTable('misc') . ' |
|
3768 | + FROM ' . prefixTable('misc').' |
|
3770 | 3769 | WHERE intitule = %i AND type = %s', |
3771 | 3770 | $data['parent_id'], |
3772 | 3771 | 'complex' |
3773 | 3772 | ); |
3774 | 3773 | if (intval($dataReceived['complexity']) < intval($data['valeur'])) { |
3775 | - echo '[ { "error" : "' . $lang->get('error_folder_complexity_lower_than_top_folder') . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]"} ]'; |
|
3774 | + echo '[ { "error" : "'.$lang->get('error_folder_complexity_lower_than_top_folder').' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]"} ]'; |
|
3776 | 3775 | break; |
3777 | 3776 | } |
3778 | 3777 | } |
3779 | 3778 | |
3780 | 3779 | // update Folders table |
3781 | 3780 | $tmp = DB::queryFirstRow( |
3782 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
3781 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
3783 | 3782 | $dataReceived['folder'] |
3784 | 3783 | ); |
3785 | 3784 | if ($tmp['parent_id'] !== 0 || $tmp['title'] !== $session->get('user-id') || $tmp['personal_folder'] !== 1) { |
@@ -3893,7 +3892,7 @@ discard block |
||
3893 | 3892 | $uniqueLoadData['path'] = $arr_arbo; |
3894 | 3893 | |
3895 | 3894 | // store last folder accessed in cookie |
3896 | - $arr_cookie_options = array ( |
|
3895 | + $arr_cookie_options = array( |
|
3897 | 3896 | 'expires' => time() + TP_ONE_DAY_SECONDS * 5, |
3898 | 3897 | 'path' => '/', |
3899 | 3898 | 'secure' => true, |
@@ -3908,7 +3907,7 @@ discard block |
||
3908 | 3907 | foreach ($session->get('user-roles_array') as $role) { |
3909 | 3908 | $roleQ = DB::queryFirstRow( |
3910 | 3909 | 'SELECT allow_pw_change |
3911 | - FROM ' . prefixTable('roles_title') . ' |
|
3910 | + FROM ' . prefixTable('roles_title').' |
|
3912 | 3911 | WHERE id = %i', |
3913 | 3912 | $role |
3914 | 3913 | ); |
@@ -3939,11 +3938,11 @@ discard block |
||
3939 | 3938 | |
3940 | 3939 | foreach ($session->get('user-roles_array') as $role) { |
3941 | 3940 | $access = DB::queryFirstRow( |
3942 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
3941 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
3943 | 3942 | $role, |
3944 | 3943 | $inputData['id'] |
3945 | 3944 | ); |
3946 | - if (DB::count()>0) { |
|
3945 | + if (DB::count() > 0) { |
|
3947 | 3946 | if ($access['type'] === 'R') { |
3948 | 3947 | array_push($arrTmp, 10); |
3949 | 3948 | } elseif ($access['type'] === 'W') { |
@@ -4008,7 +4007,7 @@ discard block |
||
4008 | 4007 | } else { |
4009 | 4008 | DB::query( |
4010 | 4009 | 'SELECT * |
4011 | - FROM ' . prefixTable('items') . ' |
|
4010 | + FROM ' . prefixTable('items').' |
|
4012 | 4011 | WHERE inactif = %i', |
4013 | 4012 | 0 |
4014 | 4013 | ); |
@@ -4018,7 +4017,7 @@ discard block |
||
4018 | 4017 | |
4019 | 4018 | // Get folder complexity |
4020 | 4019 | $folderComplexity = DB::queryFirstRow( |
4021 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %i', |
|
4020 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %i', |
|
4022 | 4021 | 'complex', |
4023 | 4022 | $inputData['id'] |
4024 | 4023 | ); |
@@ -4030,7 +4029,7 @@ discard block |
||
4030 | 4029 | if (isset($SETTINGS['item_extra_fields']) && (int) $SETTINGS['item_extra_fields'] === 1) { |
4031 | 4030 | $folderRow = DB::query( |
4032 | 4031 | 'SELECT id_category |
4033 | - FROM ' . prefixTable('categories_folders') . ' |
|
4032 | + FROM ' . prefixTable('categories_folders').' |
|
4034 | 4033 | WHERE id_folder = %i', |
4035 | 4034 | $inputData['id'] |
4036 | 4035 | ); |
@@ -4145,15 +4144,15 @@ discard block |
||
4145 | 4144 | // List all ITEMS |
4146 | 4145 | if ($folderIsPf === false) { |
4147 | 4146 | $where->add('i.inactif=%i', 0); |
4148 | - $sql_e='(SELECT date FROM ' . prefixTable('log_items') |
|
4147 | + $sql_e = '(SELECT date FROM '.prefixTable('log_items') |
|
4149 | 4148 | . " WHERE action = 'at_creation' AND id_item=i.id " |
4150 | - . 'union all SELECT date FROM '. prefixTable('log_items') |
|
4149 | + . 'union all SELECT date FROM '.prefixTable('log_items') |
|
4151 | 4150 | . " WHERE action = 'at_modification' AND raison = 'at_pw' |
4152 | 4151 | AND id_item=i.id ORDER BY date DESC LIMIT 1)"; |
4153 | 4152 | $where->add('l.date=%l', $sql_e); |
4154 | 4153 | |
4155 | - $query_limit = ' LIMIT ' . |
|
4156 | - $start . ',' . |
|
4154 | + $query_limit = ' LIMIT '. |
|
4155 | + $start.','. |
|
4157 | 4156 | $post_nb_items_to_display_once; |
4158 | 4157 | //db::debugmode(true); |
4159 | 4158 | $rows = DB::query( |
@@ -4165,9 +4164,9 @@ discard block |
||
4165 | 4164 | l.id_user AS log_user, |
4166 | 4165 | i.url AS link, |
4167 | 4166 | i.email AS email |
4168 | - FROM ' . prefixTable('items') . ' AS i |
|
4169 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
4170 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item) |
|
4167 | + FROM ' . prefixTable('items').' AS i |
|
4168 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
4169 | + INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item) |
|
4171 | 4170 | WHERE %l |
4172 | 4171 | GROUP BY i.id, l.date, l.id_user, l.action |
4173 | 4172 | ORDER BY i.label ASC, l.date DESC' . $query_limit, |
@@ -4187,9 +4186,9 @@ discard block |
||
4187 | 4186 | l.id_user AS log_user, |
4188 | 4187 | i.url AS link, |
4189 | 4188 | i.email AS email |
4190 | - FROM ' . prefixTable('items') . ' AS i |
|
4191 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (i.id_tree = n.id) |
|
4192 | - INNER JOIN ' . prefixTable('log_items') . ' AS l ON (i.id = l.id_item) |
|
4189 | + FROM ' . prefixTable('items').' AS i |
|
4190 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (i.id_tree = n.id) |
|
4191 | + INNER JOIN ' . prefixTable('log_items').' AS l ON (i.id = l.id_item) |
|
4193 | 4192 | WHERE %l |
4194 | 4193 | GROUP BY i.id, l.date, l.id_user, l.action |
4195 | 4194 | ORDER BY i.label ASC, l.date DESC', |
@@ -4220,7 +4219,7 @@ discard block |
||
4220 | 4219 | $item_is_restricted_to_role = false; |
4221 | 4220 | DB::queryFirstRow( |
4222 | 4221 | 'SELECT role_id |
4223 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
4222 | + FROM ' . prefixTable('restriction_to_roles').' |
|
4224 | 4223 | WHERE item_id = %i', |
4225 | 4224 | $record['id'] |
4226 | 4225 | ); |
@@ -4232,7 +4231,7 @@ discard block |
||
4232 | 4231 | $user_is_included_in_role = false; |
4233 | 4232 | DB::query( |
4234 | 4233 | 'SELECT role_id |
4235 | - FROM ' . prefixTable('restriction_to_roles') . ' |
|
4234 | + FROM ' . prefixTable('restriction_to_roles').' |
|
4236 | 4235 | WHERE item_id = %i AND role_id IN %ls', |
4237 | 4236 | $record['id'], |
4238 | 4237 | $session->get('user-roles_array') |
@@ -4443,9 +4442,9 @@ discard block |
||
4443 | 4442 | if ((int) $start === 0) { |
4444 | 4443 | DB::query( |
4445 | 4444 | 'SELECT i.id |
4446 | - FROM ' . prefixTable('items') . ' as i |
|
4447 | - INNER JOIN ' . prefixTable('nested_tree') . ' as n ON (i.id_tree = n.id) |
|
4448 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (i.id = l.id_item) |
|
4445 | + FROM ' . prefixTable('items').' as i |
|
4446 | + INNER JOIN ' . prefixTable('nested_tree').' as n ON (i.id_tree = n.id) |
|
4447 | + INNER JOIN ' . prefixTable('log_items').' as l ON (i.id = l.id_item) |
|
4449 | 4448 | WHERE %l |
4450 | 4449 | ORDER BY i.label ASC, l.date DESC', |
4451 | 4450 | $where |
@@ -4510,8 +4509,8 @@ discard block |
||
4510 | 4509 | $dataItem = DB::queryFirstRow( |
4511 | 4510 | 'SELECT i.pw AS pw, s.share_key AS share_key, i.id AS id, |
4512 | 4511 | i.label AS label, i.id_tree AS id_tree |
4513 | - FROM ' . prefixTable('items') . ' AS i |
|
4514 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
4512 | + FROM ' . prefixTable('items').' AS i |
|
4513 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
4515 | 4514 | WHERE user_id = %i AND (i.item_key = %s OR i.id = %i)', |
4516 | 4515 | $session->get('user-id'), |
4517 | 4516 | $inputData['itemKey'] ?? '', |
@@ -4622,7 +4621,7 @@ discard block |
||
4622 | 4621 | // do query on this folder |
4623 | 4622 | $data_this_folder = DB::queryFirstRow( |
4624 | 4623 | 'SELECT id, personal_folder, title |
4625 | - FROM ' . prefixTable('nested_tree') . ' |
|
4624 | + FROM ' . prefixTable('nested_tree').' |
|
4626 | 4625 | WHERE id = %s', |
4627 | 4626 | $inputData['folderId'] |
4628 | 4627 | ); |
@@ -4662,8 +4661,8 @@ discard block |
||
4662 | 4661 | $visibilite = ''; |
4663 | 4662 | $data = DB::queryFirstRow( |
4664 | 4663 | 'SELECT m.valeur, n.personal_folder |
4665 | - FROM ' . prefixTable('misc') . ' AS m |
|
4666 | - INNER JOIN ' . prefixTable('nested_tree') . ' AS n ON (m.intitule = n.id) |
|
4664 | + FROM ' . prefixTable('misc').' AS m |
|
4665 | + INNER JOIN ' . prefixTable('nested_tree').' AS n ON (m.intitule = n.id) |
|
4667 | 4666 | WHERE type=%s AND intitule = %s', |
4668 | 4667 | 'complex', |
4669 | 4668 | $inputData['folderId'] |
@@ -4676,8 +4675,8 @@ discard block |
||
4676 | 4675 | // Prepare Item actual visibility (what Users/Roles can see it) |
4677 | 4676 | $rows = DB::query( |
4678 | 4677 | 'SELECT t.title |
4679 | - FROM ' . prefixTable('roles_values') . ' as v |
|
4680 | - INNER JOIN ' . prefixTable('roles_title') . ' as t ON (v.role_id = t.id) |
|
4678 | + FROM ' . prefixTable('roles_values').' as v |
|
4679 | + INNER JOIN ' . prefixTable('roles_title').' as t ON (v.role_id = t.id) |
|
4681 | 4680 | WHERE v.folder_id = %i |
4682 | 4681 | GROUP BY title', |
4683 | 4682 | $inputData['folderId'] |
@@ -4686,7 +4685,7 @@ discard block |
||
4686 | 4685 | if (empty($visibilite)) { |
4687 | 4686 | $visibilite = $record['title']; |
4688 | 4687 | } else { |
4689 | - $visibilite .= ' - ' . $record['title']; |
|
4688 | + $visibilite .= ' - '.$record['title']; |
|
4690 | 4689 | } |
4691 | 4690 | } |
4692 | 4691 | } else { |
@@ -4696,14 +4695,14 @@ discard block |
||
4696 | 4695 | // do new query to know if current folder is pf |
4697 | 4696 | $data_pf = DB::queryFirstRow( |
4698 | 4697 | 'SELECT personal_folder |
4699 | - FROM ' . prefixTable('nested_tree') . ' |
|
4698 | + FROM ' . prefixTable('nested_tree').' |
|
4700 | 4699 | WHERE id = %s', |
4701 | 4700 | $inputData['folderId'] |
4702 | 4701 | ); |
4703 | 4702 | |
4704 | 4703 | $folder_is_personal = $data_pf !== null ? (int) $data_pf['personal_folder'] : 0; |
4705 | 4704 | |
4706 | - $visibilite = $session->get('user-name') . ' ' . $session->get('user-lastname') . ' (' . $session->get('user-login') . ')'; |
|
4705 | + $visibilite = $session->get('user-name').' '.$session->get('user-lastname').' ('.$session->get('user-login').')'; |
|
4707 | 4706 | } |
4708 | 4707 | |
4709 | 4708 | recupDroitCreationSansComplexite($inputData['folderId']); |
@@ -4713,8 +4712,8 @@ discard block |
||
4713 | 4712 | $listOptionsForRoles = array(); |
4714 | 4713 | $rows = DB::query( |
4715 | 4714 | 'SELECT r.role_id AS role_id, t.title AS title |
4716 | - FROM ' . prefixTable('roles_values') . ' AS r |
|
4717 | - INNER JOIN ' . prefixTable('roles_title') . ' AS t ON (r.role_id = t.id) |
|
4715 | + FROM ' . prefixTable('roles_values').' AS r |
|
4716 | + INNER JOIN ' . prefixTable('roles_title').' AS t ON (r.role_id = t.id) |
|
4718 | 4717 | WHERE r.folder_id = %i', |
4719 | 4718 | $inputData['folderId'] |
4720 | 4719 | ); |
@@ -4728,7 +4727,7 @@ discard block |
||
4728 | 4727 | ); |
4729 | 4728 | $rows2 = DB::query( |
4730 | 4729 | 'SELECT id, login, fonction_id, email, name, lastname |
4731 | - FROM ' . prefixTable('users') . ' |
|
4730 | + FROM ' . prefixTable('users').' |
|
4732 | 4731 | WHERE admin = 0 AND fonction_id is not null' |
4733 | 4732 | ); |
4734 | 4733 | foreach ($rows2 as $record2) { |
@@ -4742,7 +4741,7 @@ discard block |
||
4742 | 4741 | array( |
4743 | 4742 | 'id' => $record2['id'], |
4744 | 4743 | 'login' => $record2['login'], |
4745 | - 'name' => $record2['name'] . ' ' . $record2['lastname'], |
|
4744 | + 'name' => $record2['name'].' '.$record2['lastname'], |
|
4746 | 4745 | 'email' => $record2['email'], |
4747 | 4746 | ) |
4748 | 4747 | ); |
@@ -4759,12 +4758,12 @@ discard block |
||
4759 | 4758 | foreach ($session->get('user-roles_array') as $role) { |
4760 | 4759 | $access = DB::queryFirstRow( |
4761 | 4760 | 'SELECT type |
4762 | - FROM ' . prefixTable('roles_values') . ' |
|
4761 | + FROM ' . prefixTable('roles_values').' |
|
4763 | 4762 | WHERE role_id = %i AND folder_id = %i', |
4764 | 4763 | $role, |
4765 | 4764 | $inputData['folderId'] |
4766 | 4765 | ); |
4767 | - if (DB::count()>0) { |
|
4766 | + if (DB::count() > 0) { |
|
4768 | 4767 | if ($access['type'] === 'R') { |
4769 | 4768 | array_push($arrTmp, 10); |
4770 | 4769 | } elseif ($access['type'] === 'W') { |
@@ -4792,7 +4791,7 @@ discard block |
||
4792 | 4791 | // Check if personal folder is owned by user |
4793 | 4792 | $folder = DB::queryFirstRow( |
4794 | 4793 | 'SELECT id |
4795 | - FROM ' . prefixTable('nested_tree') . ' |
|
4794 | + FROM ' . prefixTable('nested_tree').' |
|
4796 | 4795 | WHERE title = %s', |
4797 | 4796 | $session->get('user-id'), |
4798 | 4797 | ); |
@@ -4897,7 +4896,7 @@ discard block |
||
4897 | 4896 | // Get some info before deleting |
4898 | 4897 | $data = DB::queryFirstRow( |
4899 | 4898 | 'SELECT name, id_item, file |
4900 | - FROM ' . prefixTable('files') . ' |
|
4899 | + FROM ' . prefixTable('files').' |
|
4901 | 4900 | WHERE id = %i', |
4902 | 4901 | $fileId |
4903 | 4902 | ); |
@@ -4905,7 +4904,7 @@ discard block |
||
4905 | 4904 | // Load item data |
4906 | 4905 | $data_item = DB::queryFirstRow( |
4907 | 4906 | 'SELECT id_tree |
4908 | - FROM ' . prefixTable('items') . ' |
|
4907 | + FROM ' . prefixTable('items').' |
|
4909 | 4908 | WHERE id = %i', |
4910 | 4909 | $data['id_item'] |
4911 | 4910 | ); |
@@ -4935,7 +4934,7 @@ discard block |
||
4935 | 4934 | $session->get('user-id'), |
4936 | 4935 | 'at_modification', |
4937 | 4936 | $session->get('user-login'), |
4938 | - 'at_del_file : ' . $data['name'] |
|
4937 | + 'at_del_file : '.$data['name'] |
|
4939 | 4938 | ); |
4940 | 4939 | |
4941 | 4940 | // DElete sharekeys |
@@ -4946,7 +4945,7 @@ discard block |
||
4946 | 4945 | ); |
4947 | 4946 | |
4948 | 4947 | // Delete file from server |
4949 | - $fileToDelete = $SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($data['file']); |
|
4948 | + $fileToDelete = $SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($data['file']); |
|
4950 | 4949 | $fileToDelete = realpath($fileToDelete); |
4951 | 4950 | if ($fileToDelete && strpos($fileToDelete, $SETTINGS['path_to_upload_folder']) === 0) { |
4952 | 4951 | fileDelete($fileToDelete, $SETTINGS); |
@@ -5000,7 +4999,7 @@ discard block |
||
5000 | 4999 | // Update SESSION with this new favourite |
5001 | 5000 | $data = DB::queryFirstRow( |
5002 | 5001 | 'SELECT label,id_tree |
5003 | - FROM ' . prefixTable('items') . ' |
|
5002 | + FROM ' . prefixTable('items').' |
|
5004 | 5003 | WHERE id = %i', |
5005 | 5004 | $inputData['itemId'] |
5006 | 5005 | ); |
@@ -5009,7 +5008,7 @@ discard block |
||
5009 | 5008 | [ |
5010 | 5009 | $inputData['itemId'] => [ |
5011 | 5010 | 'label' => $data['label'], |
5012 | - 'url' => 'index.php?page=items&group=' . $data['id_tree'] . '&id=' . $inputData['itemId'], |
|
5011 | + 'url' => 'index.php?page=items&group='.$data['id_tree'].'&id='.$inputData['itemId'], |
|
5013 | 5012 | ], |
5014 | 5013 | ], |
5015 | 5014 | 'add' |
@@ -5078,8 +5077,8 @@ discard block |
||
5078 | 5077 | // get data about item |
5079 | 5078 | $dataSource = DB::queryFirstRow( |
5080 | 5079 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
5081 | - FROM ' . prefixTable('items') . ' as i |
|
5082 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
5080 | + FROM ' . prefixTable('items').' as i |
|
5081 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
5083 | 5082 | WHERE i.id=%i', |
5084 | 5083 | $inputData['itemId'] |
5085 | 5084 | ); |
@@ -5123,7 +5122,7 @@ discard block |
||
5123 | 5122 | // get data about new folder |
5124 | 5123 | $dataDestination = DB::queryFirstRow( |
5125 | 5124 | 'SELECT personal_folder, title |
5126 | - FROM ' . prefixTable('nested_tree') . ' |
|
5125 | + FROM ' . prefixTable('nested_tree').' |
|
5127 | 5126 | WHERE id = %i', |
5128 | 5127 | $inputData['folderId'] |
5129 | 5128 | ); |
@@ -5176,7 +5175,7 @@ discard block |
||
5176 | 5175 | // Get fields for this Item |
5177 | 5176 | $rows = DB::query( |
5178 | 5177 | 'SELECT id |
5179 | - FROM ' . prefixTable('categories_items') . ' |
|
5178 | + FROM ' . prefixTable('categories_items').' |
|
5180 | 5179 | WHERE item_id = %i', |
5181 | 5180 | $inputData['itemId'] |
5182 | 5181 | ); |
@@ -5193,7 +5192,7 @@ discard block |
||
5193 | 5192 | // Get FILES for this Item |
5194 | 5193 | $rows = DB::query( |
5195 | 5194 | 'SELECT id |
5196 | - FROM ' . prefixTable('files') . ' |
|
5195 | + FROM ' . prefixTable('files').' |
|
5197 | 5196 | WHERE id_item = %i', |
5198 | 5197 | $inputData['itemId'] |
5199 | 5198 | ); |
@@ -5240,7 +5239,7 @@ discard block |
||
5240 | 5239 | // Get the ITEM object key for the user |
5241 | 5240 | $userKey = DB::queryFirstRow( |
5242 | 5241 | 'SELECT share_key |
5243 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
5242 | + FROM ' . prefixTable('sharekeys_items').' |
|
5244 | 5243 | WHERE user_id = %i AND object_id = %i', |
5245 | 5244 | $session->get('user-id'), |
5246 | 5245 | $inputData['itemId'] |
@@ -5251,7 +5250,7 @@ discard block |
||
5251 | 5250 | // This is a public object |
5252 | 5251 | $users = DB::query( |
5253 | 5252 | 'SELECT id, public_key |
5254 | - FROM ' . prefixTable('users') . ' |
|
5253 | + FROM ' . prefixTable('users').' |
|
5255 | 5254 | WHERE id NOT IN %li |
5256 | 5255 | AND public_key != ""', |
5257 | 5256 | $tpUsersIDs |
@@ -5274,14 +5273,14 @@ discard block |
||
5274 | 5273 | // Get fields for this Item |
5275 | 5274 | $rows = DB::query( |
5276 | 5275 | 'SELECT id |
5277 | - FROM ' . prefixTable('categories_items') . ' |
|
5276 | + FROM ' . prefixTable('categories_items').' |
|
5278 | 5277 | WHERE item_id = %i', |
5279 | 5278 | $inputData['itemId'] |
5280 | 5279 | ); |
5281 | 5280 | foreach ($rows as $field) { |
5282 | 5281 | $userKey = DB::queryFirstRow( |
5283 | 5282 | 'SELECT share_key |
5284 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
5283 | + FROM ' . prefixTable('sharekeys_fields').' |
|
5285 | 5284 | WHERE user_id = %i AND object_id = %i', |
5286 | 5285 | $session->get('user-id'), |
5287 | 5286 | $field['id'] |
@@ -5292,7 +5291,7 @@ discard block |
||
5292 | 5291 | // This is a public object |
5293 | 5292 | $users = DB::query( |
5294 | 5293 | 'SELECT id, public_key |
5295 | - FROM ' . prefixTable('users') . ' |
|
5294 | + FROM ' . prefixTable('users').' |
|
5296 | 5295 | WHERE id NOT IN %li |
5297 | 5296 | AND public_key != ""', |
5298 | 5297 | $tpUsersIDs |
@@ -5315,14 +5314,14 @@ discard block |
||
5315 | 5314 | // Get FILES for this Item |
5316 | 5315 | $rows = DB::query( |
5317 | 5316 | 'SELECT id |
5318 | - FROM ' . prefixTable('files') . ' |
|
5317 | + FROM ' . prefixTable('files').' |
|
5319 | 5318 | WHERE id_item = %i', |
5320 | 5319 | $inputData['itemId'] |
5321 | 5320 | ); |
5322 | 5321 | foreach ($rows as $attachment) { |
5323 | 5322 | $userKey = DB::queryFirstRow( |
5324 | 5323 | 'SELECT share_key |
5325 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
5324 | + FROM ' . prefixTable('sharekeys_files').' |
|
5326 | 5325 | WHERE user_id = %i AND object_id = %i', |
5327 | 5326 | $session->get('user-id'), |
5328 | 5327 | $attachment['id'] |
@@ -5333,7 +5332,7 @@ discard block |
||
5333 | 5332 | // This is a public object |
5334 | 5333 | $users = DB::query( |
5335 | 5334 | 'SELECT id, public_key |
5336 | - FROM ' . prefixTable('users') . ' |
|
5335 | + FROM ' . prefixTable('users').' |
|
5337 | 5336 | WHERE id NOT IN %li |
5338 | 5337 | AND public_key != ""', |
5339 | 5338 | $tpUsersIDs |
@@ -5374,7 +5373,7 @@ discard block |
||
5374 | 5373 | $session->get('user-id'), |
5375 | 5374 | 'at_modification', |
5376 | 5375 | $session->get('user-login'), |
5377 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
5376 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
5378 | 5377 | ); |
5379 | 5378 | |
5380 | 5379 | // Update cache table |
@@ -5433,8 +5432,8 @@ discard block |
||
5433 | 5432 | // get data about item |
5434 | 5433 | $dataSource = DB::queryFirstRow( |
5435 | 5434 | 'SELECT i.pw, f.personal_folder,i.id_tree, f.title,i.label |
5436 | - FROM ' . prefixTable('items') . ' as i |
|
5437 | - INNER JOIN ' . prefixTable('nested_tree') . ' as f ON (i.id_tree=f.id) |
|
5435 | + FROM ' . prefixTable('items').' as i |
|
5436 | + INNER JOIN ' . prefixTable('nested_tree').' as f ON (i.id_tree=f.id) |
|
5438 | 5437 | WHERE i.id=%i', |
5439 | 5438 | $item_id |
5440 | 5439 | ); |
@@ -5456,7 +5455,7 @@ discard block |
||
5456 | 5455 | |
5457 | 5456 | // get data about new folder |
5458 | 5457 | $dataDestination = DB::queryFirstRow( |
5459 | - 'SELECT personal_folder, title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
5458 | + 'SELECT personal_folder, title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
5460 | 5459 | $inputData['folderId'] |
5461 | 5460 | ); |
5462 | 5461 | |
@@ -5498,7 +5497,7 @@ discard block |
||
5498 | 5497 | // Get fields for this Item |
5499 | 5498 | $rows = DB::query( |
5500 | 5499 | 'SELECT id |
5501 | - FROM ' . prefixTable('categories_items') . ' |
|
5500 | + FROM ' . prefixTable('categories_items').' |
|
5502 | 5501 | WHERE item_id = %i', |
5503 | 5502 | $item_id |
5504 | 5503 | ); |
@@ -5515,7 +5514,7 @@ discard block |
||
5515 | 5514 | // Get FILES for this Item |
5516 | 5515 | $rows = DB::query( |
5517 | 5516 | 'SELECT id |
5518 | - FROM ' . prefixTable('files') . ' |
|
5517 | + FROM ' . prefixTable('files').' |
|
5519 | 5518 | WHERE id_item = %i', |
5520 | 5519 | $item_id |
5521 | 5520 | ); |
@@ -5570,7 +5569,7 @@ discard block |
||
5570 | 5569 | // Get the ITEM object key for the user |
5571 | 5570 | $userKey = DB::queryFirstRow( |
5572 | 5571 | 'SELECT share_key |
5573 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
5572 | + FROM ' . prefixTable('sharekeys_items').' |
|
5574 | 5573 | WHERE user_id = %i AND object_id = %i', |
5575 | 5574 | $session->get('user-id'), |
5576 | 5575 | $item_id |
@@ -5581,7 +5580,7 @@ discard block |
||
5581 | 5580 | // This is a public object |
5582 | 5581 | $users = DB::query( |
5583 | 5582 | 'SELECT id, public_key |
5584 | - FROM ' . prefixTable('users') . ' |
|
5583 | + FROM ' . prefixTable('users').' |
|
5585 | 5584 | WHERE id NOT IN %li |
5586 | 5585 | AND public_key != ""', |
5587 | 5586 | $tpUsersIDs |
@@ -5604,14 +5603,14 @@ discard block |
||
5604 | 5603 | // Get fields for this Item |
5605 | 5604 | $rows = DB::query( |
5606 | 5605 | 'SELECT id |
5607 | - FROM ' . prefixTable('categories_items') . ' |
|
5606 | + FROM ' . prefixTable('categories_items').' |
|
5608 | 5607 | WHERE item_id = %i', |
5609 | 5608 | $item_id |
5610 | 5609 | ); |
5611 | 5610 | foreach ($rows as $field) { |
5612 | 5611 | $userKey = DB::queryFirstRow( |
5613 | 5612 | 'SELECT share_key |
5614 | - FROM ' . prefixTable('sharekeys_fields') . ' |
|
5613 | + FROM ' . prefixTable('sharekeys_fields').' |
|
5615 | 5614 | WHERE user_id = %i AND object_id = %i', |
5616 | 5615 | $session->get('user-id'), |
5617 | 5616 | $field['id'] |
@@ -5622,7 +5621,7 @@ discard block |
||
5622 | 5621 | // This is a public object |
5623 | 5622 | $users = DB::query( |
5624 | 5623 | 'SELECT id, public_key |
5625 | - FROM ' . prefixTable('users') . ' |
|
5624 | + FROM ' . prefixTable('users').' |
|
5626 | 5625 | WHERE id NOT IN %li |
5627 | 5626 | AND public_key != ""', |
5628 | 5627 | $tpUsersIDs |
@@ -5646,14 +5645,14 @@ discard block |
||
5646 | 5645 | // Get FILES for this Item |
5647 | 5646 | $rows = DB::query( |
5648 | 5647 | 'SELECT id |
5649 | - FROM ' . prefixTable('files') . ' |
|
5648 | + FROM ' . prefixTable('files').' |
|
5650 | 5649 | WHERE id_item = %i', |
5651 | 5650 | $item_id |
5652 | 5651 | ); |
5653 | 5652 | foreach ($rows as $attachment) { |
5654 | 5653 | $userKey = DB::queryFirstRow( |
5655 | 5654 | 'SELECT share_key |
5656 | - FROM ' . prefixTable('sharekeys_files') . ' |
|
5655 | + FROM ' . prefixTable('sharekeys_files').' |
|
5657 | 5656 | WHERE user_id = %i AND object_id = %i', |
5658 | 5657 | $session->get('user-id'), |
5659 | 5658 | $attachment['id'] |
@@ -5664,7 +5663,7 @@ discard block |
||
5664 | 5663 | // This is a public object |
5665 | 5664 | $users = DB::query( |
5666 | 5665 | 'SELECT id, public_key |
5667 | - FROM ' . prefixTable('users') . ' |
|
5666 | + FROM ' . prefixTable('users').' |
|
5668 | 5667 | WHERE id NOT IN %li |
5669 | 5668 | AND public_key != ""', |
5670 | 5669 | $tpUsersIDs |
@@ -5704,13 +5703,13 @@ discard block |
||
5704 | 5703 | $session->get('user-id'), |
5705 | 5704 | 'at_modification', |
5706 | 5705 | $session->get('user-login'), |
5707 | - 'at_moved : ' . $dataSource['title'] . ' -> ' . $dataDestination['title'] |
|
5706 | + 'at_moved : '.$dataSource['title'].' -> '.$dataDestination['title'] |
|
5708 | 5707 | ); |
5709 | 5708 | } |
5710 | 5709 | } |
5711 | 5710 | |
5712 | 5711 | // reload cache table |
5713 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
5712 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
5714 | 5713 | updateCacheTable('reload', null); |
5715 | 5714 | |
5716 | 5715 | echo (string) prepareExchangedData( |
@@ -5774,7 +5773,7 @@ discard block |
||
5774 | 5773 | // get info |
5775 | 5774 | $dataSource = DB::queryFirstRow( |
5776 | 5775 | 'SELECT label, id_tree |
5777 | - FROM ' . prefixTable('items') . ' |
|
5776 | + FROM ' . prefixTable('items').' |
|
5778 | 5777 | WHERE id=%i', |
5779 | 5778 | $item_id |
5780 | 5779 | ); |
@@ -5875,14 +5874,14 @@ discard block |
||
5875 | 5874 | // Variables |
5876 | 5875 | $dataAuthor = DB::queryFirstRow( |
5877 | 5876 | 'SELECT email,login |
5878 | - FROM ' . prefixTable('users') . ' |
|
5877 | + FROM ' . prefixTable('users').' |
|
5879 | 5878 | WHERE id = %i', |
5880 | 5879 | $post_content[1] |
5881 | 5880 | ); |
5882 | 5881 | |
5883 | 5882 | $dataItem = DB::queryFirstRow( |
5884 | 5883 | 'SELECT label, id_tree |
5885 | - FROM ' . prefixTable('items') . ' |
|
5884 | + FROM ' . prefixTable('items').' |
|
5886 | 5885 | WHERE id = %i', |
5887 | 5886 | $post_content[0] |
5888 | 5887 | ); |
@@ -5899,7 +5898,7 @@ discard block |
||
5899 | 5898 | $lang->get('email_request_access_subject'), |
5900 | 5899 | str_replace( |
5901 | 5900 | array('#tp_item_author#', '#tp_user#', '#tp_item#'), |
5902 | - array(' ' . addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
5901 | + array(' '.addslashes($dataAuthor['login']), addslashes($session->get('user-login')), $path), |
|
5903 | 5902 | $lang->get('email_request_access_mail') |
5904 | 5903 | ), |
5905 | 5904 | $dataAuthor['email'], |
@@ -5908,7 +5907,7 @@ discard block |
||
5908 | 5907 | } elseif ($inputData['cat'] === 'share_this_item') { |
5909 | 5908 | $dataItem = DB::queryFirstRow( |
5910 | 5909 | 'SELECT label,id_tree |
5911 | - FROM ' . prefixTable('items') . ' |
|
5910 | + FROM ' . prefixTable('items').' |
|
5912 | 5911 | WHERE id= %i', |
5913 | 5912 | $inputData['id'] |
5914 | 5913 | ); |
@@ -5931,7 +5930,7 @@ discard block |
||
5931 | 5930 | ), |
5932 | 5931 | array( |
5933 | 5932 | empty($SETTINGS['email_server_url']) === false ? |
5934 | - $SETTINGS['email_server_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'] : $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $inputData['id'], |
|
5933 | + $SETTINGS['email_server_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'] : $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$inputData['id'], |
|
5935 | 5934 | addslashes($session->get('user-login')), |
5936 | 5935 | addslashes($path), |
5937 | 5936 | ), |
@@ -5980,8 +5979,8 @@ discard block |
||
5980 | 5979 | // Get all informations for this item |
5981 | 5980 | $dataItem = DB::queryFirstRow( |
5982 | 5981 | 'SELECT * |
5983 | - FROM ' . prefixTable('items') . ' as i |
|
5984 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
5982 | + FROM ' . prefixTable('items').' as i |
|
5983 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
5985 | 5984 | WHERE i.id=%i AND l.action = %s', |
5986 | 5985 | $item_id, |
5987 | 5986 | 'at_creation' |
@@ -6010,18 +6009,18 @@ discard block |
||
6010 | 6009 | $session->get('user-login'), |
6011 | 6010 | htmlspecialchars_decode($label, ENT_QUOTES), |
6012 | 6011 | null, |
6013 | - (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'] . ' ' . $SETTINGS['time_format']) |
|
6012 | + (string) dateToStamp($date.' '.$time, $SETTINGS['date_format'].' '.$SETTINGS['time_format']) |
|
6014 | 6013 | ); |
6015 | 6014 | // Prepare new line |
6016 | 6015 | $data = DB::queryFirstRow( |
6017 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i ORDER BY date DESC', |
|
6016 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i ORDER BY date DESC', |
|
6018 | 6017 | $item_id |
6019 | 6018 | ); |
6020 | - $historic = date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $data['date']) . ' - ' . $session->get('user-login') . ' - ' . $lang->get($data['action']) . ' - ' . $data['raison']; |
|
6019 | + $historic = date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $data['date']).' - '.$session->get('user-login').' - '.$lang->get($data['action']).' - '.$data['raison']; |
|
6021 | 6020 | // send back |
6022 | 6021 | $data = array( |
6023 | 6022 | 'error' => '', |
6024 | - 'new_line' => '<br>' . addslashes($historic), |
|
6023 | + 'new_line' => '<br>'.addslashes($historic), |
|
6025 | 6024 | ); |
6026 | 6025 | echo (string) prepareExchangedData( |
6027 | 6026 | $data, |
@@ -6096,8 +6095,8 @@ discard block |
||
6096 | 6095 | // Should we log a password change? |
6097 | 6096 | $itemQ = DB::queryFirstRow( |
6098 | 6097 | 'SELECT s.share_key, i.pw |
6099 | - FROM ' . prefixTable('items') . ' AS i |
|
6100 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (i.id = s.object_id) |
|
6098 | + FROM ' . prefixTable('items').' AS i |
|
6099 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (i.id = s.object_id) |
|
6101 | 6100 | WHERE s.user_id = %i AND s.object_id = %i', |
6102 | 6101 | $session->get('user-id'), |
6103 | 6102 | $dataReceived['id'] |
@@ -6152,7 +6151,7 @@ discard block |
||
6152 | 6151 | if (isset($SETTINGS['otv_expiration_period']) === false) { |
6153 | 6152 | $SETTINGS['otv_expiration_period'] = 7; |
6154 | 6153 | } |
6155 | - $url = $SETTINGS['cpassman_url'] . '/index.php?' . http_build_query($otv_session); |
|
6154 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
6156 | 6155 | |
6157 | 6156 | echo json_encode( |
6158 | 6157 | array( |
@@ -6183,7 +6182,7 @@ discard block |
||
6183 | 6182 | // get parameters from original link |
6184 | 6183 | $url = $dataReceived['original_link']; |
6185 | 6184 | $parts = parse_url($url); |
6186 | - if(isset($parts['query'])){ |
|
6185 | + if (isset($parts['query'])) { |
|
6187 | 6186 | parse_str($parts['query'], $orignal_link_parameters); |
6188 | 6187 | } else { |
6189 | 6188 | $orignal_link_parameters = array(); |
@@ -6214,13 +6213,13 @@ discard block |
||
6214 | 6213 | $domain_scheme = parse_url($SETTINGS['cpassman_url'], PHP_URL_SCHEME); |
6215 | 6214 | $domain_host = parse_url($SETTINGS['cpassman_url'], PHP_URL_HOST); |
6216 | 6215 | if (str_contains($domain_host, 'www.') === true) { |
6217 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . substr($domain_host, 4); |
|
6216 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.substr($domain_host, 4); |
|
6218 | 6217 | } else { |
6219 | - $domain_host = (string) $SETTINGS['otv_subdomain'] . '.' . $domain_host; |
|
6218 | + $domain_host = (string) $SETTINGS['otv_subdomain'].'.'.$domain_host; |
|
6220 | 6219 | } |
6221 | - $url = $domain_scheme.'://'.$domain_host . '/index.php?'.http_build_query($otv_session); |
|
6220 | + $url = $domain_scheme.'://'.$domain_host.'/index.php?'.http_build_query($otv_session); |
|
6222 | 6221 | } else { |
6223 | - $url = $SETTINGS['cpassman_url'] . '/index.php?'.http_build_query($otv_session); |
|
6222 | + $url = $SETTINGS['cpassman_url'].'/index.php?'.http_build_query($otv_session); |
|
6224 | 6223 | } |
6225 | 6224 | |
6226 | 6225 | echo (string) prepareExchangedData( |
@@ -6255,8 +6254,8 @@ discard block |
||
6255 | 6254 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, |
6256 | 6255 | f.extension AS extension, f.type AS type, |
6257 | 6256 | s.share_key AS share_key |
6258 | - FROM ' . prefixTable('files') . ' AS f |
|
6259 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
6257 | + FROM ' . prefixTable('files').' AS f |
|
6258 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
6260 | 6259 | WHERE s.user_id = %i AND s.object_id = %i', |
6261 | 6260 | $session->get('user-id'), |
6262 | 6261 | $inputData['id'] |
@@ -6277,7 +6276,7 @@ discard block |
||
6277 | 6276 | //$fileName = basename($file_info['name'], '.'.$file_info['extension']); |
6278 | 6277 | |
6279 | 6278 | // prepare image info |
6280 | - $post_title = basename($file_info['name'], '.' . $file_info['extension']); |
|
6279 | + $post_title = basename($file_info['name'], '.'.$file_info['extension']); |
|
6281 | 6280 | $post_title = isBase64($post_title) === true ? base64_decode($post_title) : $post_title; |
6282 | 6281 | |
6283 | 6282 | // Get image content |
@@ -6304,7 +6303,7 @@ discard block |
||
6304 | 6303 | echo (string) prepareExchangedData( |
6305 | 6304 | array( |
6306 | 6305 | 'error' => false, |
6307 | - 'filename' => $post_title . '.' . $file_info['extension'], |
|
6306 | + 'filename' => $post_title.'.'.$file_info['extension'], |
|
6308 | 6307 | 'file_type' => $file_info['type'], |
6309 | 6308 | 'file_content' => $fileContent, |
6310 | 6309 | ), |
@@ -6418,7 +6417,7 @@ discard block |
||
6418 | 6417 | $arbo = $tree->getPath($folder->id, false); |
6419 | 6418 | $path = ''; |
6420 | 6419 | foreach ($arbo as $elem) { |
6421 | - $path = (empty($path) ? '' : $path . ' / ') . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
6420 | + $path = (empty($path) ? '' : $path.' / ').htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
6422 | 6421 | } |
6423 | 6422 | |
6424 | 6423 | // Build array |
@@ -6487,7 +6486,7 @@ discard block |
||
6487 | 6486 | if (is_array($foldersArray) === true && $inputData['data'] !== '[null]') { |
6488 | 6487 | $rows = DB::query( |
6489 | 6488 | 'SELECT id, categories |
6490 | - FROM ' . prefixTable('nested_tree') . ' |
|
6489 | + FROM ' . prefixTable('nested_tree').' |
|
6491 | 6490 | WHERE id IN (%l)', |
6492 | 6491 | implode(',', $foldersArray) |
6493 | 6492 | ); |
@@ -6529,7 +6528,7 @@ discard block |
||
6529 | 6528 | // get item info |
6530 | 6529 | $dataItem = DB::queryFirstRow( |
6531 | 6530 | 'SELECT * |
6532 | - FROM ' . prefixTable('items') . ' |
|
6531 | + FROM ' . prefixTable('items').' |
|
6533 | 6532 | WHERE id=%i', |
6534 | 6533 | $inputData['itemId'] |
6535 | 6534 | ); |
@@ -6541,8 +6540,8 @@ discard block |
||
6541 | 6540 | 'SELECT l.date as date, l.action as action, l.raison as raison, |
6542 | 6541 | u.login as login, u.avatar_thumb as avatar_thumb, u.name as name, u.lastname as lastname, |
6543 | 6542 | l.old_value as old_value |
6544 | - FROM ' . prefixTable('log_items') . ' as l |
|
6545 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
6543 | + FROM ' . prefixTable('log_items').' as l |
|
6544 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
6546 | 6545 | WHERE id_item=%i AND l.action NOT IN (%l) |
6547 | 6546 | ORDER BY date DESC', |
6548 | 6547 | $inputData['itemId'], |
@@ -6557,18 +6556,18 @@ discard block |
||
6557 | 6556 | |
6558 | 6557 | // imported via API |
6559 | 6558 | if (empty($record['login']) === true) { |
6560 | - $record['login'] = $lang->get('imported_via_api') . ' [' . $record['raison'] . ']'; |
|
6559 | + $record['login'] = $lang->get('imported_via_api').' ['.$record['raison'].']'; |
|
6561 | 6560 | } |
6562 | 6561 | |
6563 | 6562 | // Prepare avatar |
6564 | 6563 | if (isset($record['avatar_thumb']) && empty($record['avatar_thumb']) === false) { |
6565 | - if (file_exists($SETTINGS['cpassman_dir'] . '/includes/avatars/' . $record['avatar_thumb'])) { |
|
6566 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/avatars/' . $record['avatar_thumb']; |
|
6564 | + if (file_exists($SETTINGS['cpassman_dir'].'/includes/avatars/'.$record['avatar_thumb'])) { |
|
6565 | + $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$record['avatar_thumb']; |
|
6567 | 6566 | } else { |
6568 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
6567 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
6569 | 6568 | } |
6570 | 6569 | } else { |
6571 | - $avatar = $SETTINGS['cpassman_url'] . '/includes/images/photo.jpg'; |
|
6570 | + $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg'; |
|
6572 | 6571 | } |
6573 | 6572 | |
6574 | 6573 | // Prepare action |
@@ -6588,7 +6587,7 @@ discard block |
||
6588 | 6587 | $previous_passwords, |
6589 | 6588 | [ |
6590 | 6589 | 'password' => htmlentities($previous_pwd['string']), |
6591 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
6590 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
6592 | 6591 | ] |
6593 | 6592 | ); |
6594 | 6593 | } |
@@ -6601,19 +6600,19 @@ discard block |
||
6601 | 6600 | $action = $lang->get($reason[0]); |
6602 | 6601 | if ($reason[0] === 'at_moved') { |
6603 | 6602 | $tmp = explode(' -> ', $reason[1]); |
6604 | - $detail = $lang->get('from') . ' <span class="font-weight-light">' . $tmp[0] . '</span> ' . $lang->get('to') . ' <span class="font-weight-light">' . $tmp[1] . ' </span>'; |
|
6603 | + $detail = $lang->get('from').' <span class="font-weight-light">'.$tmp[0].'</span> '.$lang->get('to').' <span class="font-weight-light">'.$tmp[1].' </span>'; |
|
6605 | 6604 | } elseif ($reason[0] === 'at_field') { |
6606 | 6605 | $tmp = explode(' => ', $reason[1]); |
6607 | 6606 | if (count($tmp) > 1) { |
6608 | - $detail = '<b>' . trim($tmp[0]) . '</b> | ' . $lang->get('previous_value') . |
|
6609 | - ': <span class="font-weight-light">' . trim($tmp[1]) . '</span>'; |
|
6607 | + $detail = '<b>'.trim($tmp[0]).'</b> | '.$lang->get('previous_value'). |
|
6608 | + ': <span class="font-weight-light">'.trim($tmp[1]).'</span>'; |
|
6610 | 6609 | } else { |
6611 | 6610 | $detail = trim($reason[1]); |
6612 | 6611 | } |
6613 | 6612 | } elseif (in_array($reason[0], array('at_restriction', 'at_email', 'at_login', 'at_label', 'at_url', 'at_tag')) === true) { |
6614 | 6613 | $tmp = explode(' => ', $reason[1]); |
6615 | 6614 | $detail = empty(trim($tmp[0])) === true ? |
6616 | - $lang->get('no_previous_value') : $lang->get('previous_value') . ': <span class="font-weight-light">' . $tmp[0] . ' </span>'; |
|
6615 | + $lang->get('no_previous_value') : $lang->get('previous_value').': <span class="font-weight-light">'.$tmp[0].' </span>'; |
|
6617 | 6616 | } elseif ($reason[0] === 'at_automatic_del') { |
6618 | 6617 | $detail = $lang->get($reason[1]); |
6619 | 6618 | } elseif ($reason[0] === 'at_anyoneconmodify' || $reason[0] === 'at_otp_status' || $reason[0] === 'at_otp_secret' || $reason[0] === 'at_phone_number') { |
@@ -6622,7 +6621,7 @@ discard block |
||
6622 | 6621 | $tmp = explode(':', $reason[1]); |
6623 | 6622 | $tmp = explode('.', $tmp[0]); |
6624 | 6623 | $detail = isBase64($tmp[0]) === true ? |
6625 | - base64_decode($tmp[0]) . '.' . $tmp[1] : $tmp[0]; |
|
6624 | + base64_decode($tmp[0]).'.'.$tmp[1] : $tmp[0]; |
|
6626 | 6625 | } elseif ($reason[0] === 'at_import') { |
6627 | 6626 | $detail = ''; |
6628 | 6627 | } elseif (in_array($reason[0], array('csv', 'pdf')) === true) { |
@@ -6641,8 +6640,8 @@ discard block |
||
6641 | 6640 | array( |
6642 | 6641 | 'avatar' => $avatar, |
6643 | 6642 | 'login' => $record['login'], |
6644 | - 'name' => $record['name'] . ' ' . $record['lastname'], |
|
6645 | - 'date' => date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']), |
|
6643 | + 'name' => $record['name'].' '.$record['lastname'], |
|
6644 | + 'date' => date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']), |
|
6646 | 6645 | 'action' => $action, |
6647 | 6646 | 'detail' => $detail, |
6648 | 6647 | ) |
@@ -6730,11 +6729,11 @@ discard block |
||
6730 | 6729 | |
6731 | 6730 | // get some info to add to the notification email |
6732 | 6731 | $resp_user = DB::queryFirstRow( |
6733 | - 'SELECT login FROM ' . prefixTable('users') . ' WHERE id = %i', |
|
6732 | + 'SELECT login FROM '.prefixTable('users').' WHERE id = %i', |
|
6734 | 6733 | $session->get('user-id') |
6735 | 6734 | ); |
6736 | 6735 | $resp_folder = DB::queryFirstRow( |
6737 | - 'SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
6736 | + 'SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
6738 | 6737 | $folder |
6739 | 6738 | ); |
6740 | 6739 | |
@@ -6743,7 +6742,7 @@ discard block |
||
6743 | 6742 | $emailService = new EmailService(); |
6744 | 6743 | $rows = DB::query( |
6745 | 6744 | 'SELECT email |
6746 | - FROM ' . prefixTable('users') . ' |
|
6745 | + FROM ' . prefixTable('users').' |
|
6747 | 6746 | WHERE `gestionnaire` = %i AND `email` IS NOT NULL', |
6748 | 6747 | 1 |
6749 | 6748 | ); |
@@ -6789,7 +6788,7 @@ discard block |
||
6789 | 6788 | // Send email |
6790 | 6789 | $dataItem = DB::queryFirstRow( |
6791 | 6790 | 'SELECT label, id_tree |
6792 | - FROM ' . prefixTable('items') . ' |
|
6791 | + FROM ' . prefixTable('items').' |
|
6793 | 6792 | WHERE id = %i', |
6794 | 6793 | $inputData['itemId'] |
6795 | 6794 | ); |
@@ -6843,7 +6842,7 @@ discard block |
||
6843 | 6842 | |
6844 | 6843 | DB::query( |
6845 | 6844 | 'SELECT * |
6846 | - FROM ' . prefixTable('notification') . ' |
|
6845 | + FROM ' . prefixTable('notification').' |
|
6847 | 6846 | WHERE item_id = %i AND user_id = %i', |
6848 | 6847 | $inputData['itemId'], |
6849 | 6848 | $session->get('user-id') |
@@ -6915,7 +6914,7 @@ discard block |
||
6915 | 6914 | // And related logs |
6916 | 6915 | $rows = DB::query( |
6917 | 6916 | 'SELECT id, file AS filename |
6918 | - FROM ' . prefixTable('files') . ' |
|
6917 | + FROM ' . prefixTable('files').' |
|
6919 | 6918 | WHERE id_item = %i AND confirmed = %i', |
6920 | 6919 | $inputData['itemId'], |
6921 | 6920 | 0 |
@@ -6929,12 +6928,12 @@ discard block |
||
6929 | 6928 | ); |
6930 | 6929 | |
6931 | 6930 | // Delete file on server |
6932 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . TP_FILE_PREFIX . base64_decode($file['filename'])); |
|
6931 | + unlink($SETTINGS['path_to_upload_folder'].'/'.TP_FILE_PREFIX.base64_decode($file['filename'])); |
|
6933 | 6932 | |
6934 | 6933 | // Delete related logs |
6935 | 6934 | $logFile = DB::query( |
6936 | 6935 | 'SELECT increment_id, raison |
6937 | - FROM ' . prefixTable('log_items') . ' |
|
6936 | + FROM ' . prefixTable('log_items').' |
|
6938 | 6937 | WHERE id_item = %i AND id_user = %i AND action = %s AND raison LIKE "at_add_file :%"', |
6939 | 6938 | $inputData['itemId'], |
6940 | 6939 | $session->get('user-id'), |
@@ -6993,7 +6992,7 @@ discard block |
||
6993 | 6992 | // Confirm attachments |
6994 | 6993 | $rows = DB::query( |
6995 | 6994 | 'SELECT id, file AS filename |
6996 | - FROM ' . prefixTable('files') . ' |
|
6995 | + FROM ' . prefixTable('files').' |
|
6997 | 6996 | WHERE id_item = %i AND confirmed = %i', |
6998 | 6997 | $inputData['itemId'], |
6999 | 6998 | 0 |
@@ -7109,7 +7108,7 @@ discard block |
||
7109 | 7108 | $successfulDeletions = array(); |
7110 | 7109 | $failedDeletions = array(); |
7111 | 7110 | |
7112 | - foreach( $selectedItemIds as $itemId) { |
|
7111 | + foreach ($selectedItemIds as $itemId) { |
|
7113 | 7112 | // Check that user can access this item |
7114 | 7113 | $granted = accessToItemIsGranted((int) $itemId, $SETTINGS); |
7115 | 7114 | if ($granted !== true) { |
@@ -7120,7 +7119,7 @@ discard block |
||
7120 | 7119 | // Load item data |
7121 | 7120 | $data = DB::queryFirstRow( |
7122 | 7121 | 'SELECT id_tree, id, label |
7123 | - FROM ' . prefixTable('items') . ' |
|
7122 | + FROM ' . prefixTable('items').' |
|
7124 | 7123 | WHERE id = %i', |
7125 | 7124 | $itemId |
7126 | 7125 | ); |
@@ -7203,15 +7202,15 @@ discard block |
||
7203 | 7202 | case 'autocomplete_tags': |
7204 | 7203 | // Get a list off all existing TAGS |
7205 | 7204 | $listOfTags = ''; |
7206 | - $rows = DB::query('SELECT tag FROM ' . prefixTable('tags') . ' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
7205 | + $rows = DB::query('SELECT tag FROM '.prefixTable('tags').' WHERE tag LIKE %ss GROUP BY tag', $inputData['getTerm']); |
|
7207 | 7206 | foreach ($rows as $record) { |
7208 | 7207 | if (empty($listOfTags)) { |
7209 | - $listOfTags = '"' . $record['tag'] . '"'; |
|
7208 | + $listOfTags = '"'.$record['tag'].'"'; |
|
7210 | 7209 | } else { |
7211 | - $listOfTags .= ', "' . $record['tag'] . '"'; |
|
7210 | + $listOfTags .= ', "'.$record['tag'].'"'; |
|
7212 | 7211 | } |
7213 | 7212 | } |
7214 | - echo '[' . $listOfTags . ']'; |
|
7213 | + echo '['.$listOfTags.']'; |
|
7215 | 7214 | break; |
7216 | 7215 | } |
7217 | 7216 | } |
@@ -7227,7 +7226,7 @@ discard block |
||
7227 | 7226 | { |
7228 | 7227 | $data = DB::queryFirstRow( |
7229 | 7228 | 'SELECT bloquer_creation, bloquer_modification, personal_folder |
7230 | - FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
7229 | + FROM ' . prefixTable('nested_tree').' WHERE id = %i', |
|
7231 | 7230 | $groupe |
7232 | 7231 | ); |
7233 | 7232 | // Check if it's in a personal folder. If yes, then force complexity overhead. |
@@ -7341,7 +7340,7 @@ discard block |
||
7341 | 7340 | // Get item date |
7342 | 7341 | $itemRestrictedUsersList = DB::queryFirstRow( |
7343 | 7342 | 'SELECT restricted_to |
7344 | - FROM ' . prefixTable('items') . ' |
|
7343 | + FROM ' . prefixTable('items').' |
|
7345 | 7344 | WHERE id = %i', |
7346 | 7345 | $itemId |
7347 | 7346 | ); |
@@ -7374,7 +7373,7 @@ discard block |
||
7374 | 7373 | $now = time(); |
7375 | 7374 | $editionLocks = DB::query( |
7376 | 7375 | 'SELECT timestamp, user_id, increment_id |
7377 | - FROM ' . prefixTable('items_edition') . ' |
|
7376 | + FROM ' . prefixTable('items_edition').' |
|
7378 | 7377 | WHERE item_id = %i |
7379 | 7378 | ORDER BY increment_id DESC', |
7380 | 7379 | $itemId |
@@ -7420,7 +7419,7 @@ discard block |
||
7420 | 7419 | |
7421 | 7420 | // Delete related background tasks if any |
7422 | 7421 | $task = DB::queryFirstRow( |
7423 | - 'SELECT increment_id FROM ' . prefixTable('background_tasks') . ' |
|
7422 | + 'SELECT increment_id FROM '.prefixTable('background_tasks').' |
|
7424 | 7423 | WHERE item_id = %i AND finished_at = ""', |
7425 | 7424 | $itemId |
7426 | 7425 | ); |
@@ -7433,7 +7432,7 @@ discard block |
||
7433 | 7432 | // Check if encryption process is still running |
7434 | 7433 | DB::queryFirstRow( |
7435 | 7434 | 'SELECT JSON_EXTRACT(arguments, "$.all_users_except_id") AS all_users_except_id |
7436 | - FROM ' . prefixTable('background_tasks') . ' |
|
7435 | + FROM ' . prefixTable('background_tasks').' |
|
7437 | 7436 | WHERE item_id = %i AND finished_at = "" |
7438 | 7437 | ORDER BY increment_id DESC', |
7439 | 7438 | $itemId |
@@ -7454,7 +7453,7 @@ discard block |
||
7454 | 7453 | } |
7455 | 7454 | |
7456 | 7455 | return [ |
7457 | - 'status' => true, // Encryption in progress |
|
7456 | + 'status' => true, // Encryption in progress |
|
7458 | 7457 | 'delay' => $delay - $elapsed, // Time remaining before the lock expires |
7459 | 7458 | ]; |
7460 | 7459 | } |
@@ -7499,7 +7498,7 @@ discard block |
||
7499 | 7498 | { |
7500 | 7499 | // Check if there's an ongoing background encryption process for the item |
7501 | 7500 | $ongoingProcess = DB::queryFirstRow( |
7502 | - 'SELECT 1 FROM ' . prefixTable('background_tasks') . ' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
7501 | + 'SELECT 1 FROM '.prefixTable('background_tasks').' WHERE item_id = %i AND finished_at = "" LIMIT 1', |
|
7503 | 7502 | $itemId |
7504 | 7503 | ); |
7505 | 7504 | |
@@ -7517,7 +7516,7 @@ discard block |
||
7517 | 7516 | function getUserVisibleFolders(int $userId): array |
7518 | 7517 | { |
7519 | 7518 | // Query to retrieve visible folders for the user |
7520 | - $data = DB::queryFirstRow('SELECT visible_folders FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', $userId); |
|
7519 | + $data = DB::queryFirstRow('SELECT visible_folders FROM '.prefixTable('cache_tree').' WHERE user_id = %i', $userId); |
|
7521 | 7520 | |
7522 | 7521 | // Decode JSON data into an array; return an empty array if the data is invalid |
7523 | 7522 | return json_decode($data['visible_folders'], true) ?? []; |
@@ -7541,7 +7540,7 @@ discard block |
||
7541 | 7540 | |
7542 | 7541 | // Query the access rights for the given roles and folder |
7543 | 7542 | $accessTypes = DB::queryFirstColumn( |
7544 | - 'SELECT DISTINCT type FROM ' . prefixTable('roles_values') . ' WHERE role_id IN %ls AND folder_id = %i', |
|
7543 | + 'SELECT DISTINCT type FROM '.prefixTable('roles_values').' WHERE role_id IN %ls AND folder_id = %i', |
|
7545 | 7544 | $roles, |
7546 | 7545 | $treeId |
7547 | 7546 | ); |