@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /* do checks */ |
| 46 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 46 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 47 | 47 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'emails', $SETTINGS) === false) { |
| 48 | 48 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
| 49 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 49 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 50 | 50 | exit; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Load template |
| 54 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 54 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 55 | 55 | |
| 56 | 56 | ?> |
| 57 | 57 | <!-- Content Header (Page header) --> |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | <div class="card-body"> |
| 200 | 200 | <div id="unsent-emails"> |
| 201 | 201 | <?php |
| 202 | - DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 202 | + DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 203 | 203 | echo str_replace('#nb_emails#', DB::count(), langHdl('email_send_backlog')); |
| 204 | 204 | ?> |
| 205 | 205 | </div> |
@@ -43,15 +43,15 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /* do checks */ |
| 46 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 46 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 47 | 47 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'utilities', $SETTINGS) === false) { |
| 48 | 48 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
| 49 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 49 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 50 | 50 | exit; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | // Load template |
| 54 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 54 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 55 | 55 | |
| 56 | 56 | ?> |
| 57 | 57 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | if ( |
| 29 | - isset($_SESSION['CPM']) === false || $_SESSION['CPM'] !== 1 |
|
| 29 | + isset($_SESSION['CPM']) === false || $_SESSION['CPM'] !== 1 |
|
| 30 | 30 | || isset($_SESSION['user_id']) === false || empty($_SESSION['user_id']) === true |
| 31 | 31 | || isset($_SESSION['key']) === false || empty($_SESSION['key']) === true |
| 32 | 32 | ) { |
@@ -50,23 +50,23 @@ discard block |
||
| 50 | 50 | // Load AntiXSS |
| 51 | 51 | include_once '../includes/libraries/voku/helper/AntiXSS.php'; |
| 52 | 52 | $antiXss = new voku\helper\AntiXSS(); |
| 53 | - if (! headers_sent()) { //If headers not sent yet... then do php redirect |
|
| 54 | - header('Location: ' . $antiXss->xss_clean($url)); |
|
| 53 | + if (!headers_sent()) { //If headers not sent yet... then do php redirect |
|
| 54 | + header('Location: '.$antiXss->xss_clean($url)); |
|
| 55 | 55 | exit; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | //If headers are sent... do java redirect... if java disabled, do html redirect. |
| 59 | 59 | echo '<script type="text/javascript">'; |
| 60 | - echo 'window.location.href="' . $antiXss->xss_clean($url) . '";'; |
|
| 60 | + echo 'window.location.href="'.$antiXss->xss_clean($url).'";'; |
|
| 61 | 61 | echo '</script>'; |
| 62 | 62 | echo '<noscript>'; |
| 63 | - echo '<meta http-equiv="refresh" content="0;url=' . $antiXss->xss_clean($url) . '" />'; |
|
| 63 | + echo '<meta http-equiv="refresh" content="0;url='.$antiXss->xss_clean($url).'" />'; |
|
| 64 | 64 | echo '</noscript>'; |
| 65 | 65 | exit; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Include files |
| 69 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 69 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 70 | 70 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 71 | 71 | // Prepare GET variables |
| 72 | 72 | $server = []; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | && isset($SETTINGS['enable_sts']) === true |
| 90 | 90 | && (int) $SETTINGS['enable_sts'] === 1 |
| 91 | 91 | ) { |
| 92 | - redirect('https://' . $server['http_host'] . $server['request_uri']); |
|
| 92 | + redirect('https://'.$server['http_host'].$server['request_uri']); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Load pwComplexity |
@@ -114,11 +114,11 @@ discard block |
||
| 114 | 114 | // LOAD CPASSMAN SETTINGS |
| 115 | 115 | if ( |
| 116 | 116 | isset($SETTINGS['cpassman_dir']) === true |
| 117 | - && is_dir($SETTINGS['cpassman_dir'] . '/install') === true |
|
| 117 | + && is_dir($SETTINGS['cpassman_dir'].'/install') === true |
|
| 118 | 118 | ) { |
| 119 | 119 | // Should we delete folder INSTALL? |
| 120 | 120 | $row = DB::queryFirstRow( |
| 121 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s', |
|
| 121 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s', |
|
| 122 | 122 | 'install', |
| 123 | 123 | 'clear_install_folder' |
| 124 | 124 | ); |
@@ -136,11 +136,11 @@ discard block |
||
| 136 | 136 | if ($directories !== false) { |
| 137 | 137 | $files = array_diff($directories, ['.', '..']); |
| 138 | 138 | foreach ($files as $file) { |
| 139 | - if (is_dir($dir . '/' . $file)) { |
|
| 140 | - delTree($dir . '/' . $file); |
|
| 139 | + if (is_dir($dir.'/'.$file)) { |
|
| 140 | + delTree($dir.'/'.$file); |
|
| 141 | 141 | } else { |
| 142 | 142 | try { |
| 143 | - unlink($dir . '/' . $file); |
|
| 143 | + unlink($dir.'/'.$file); |
|
| 144 | 144 | } catch (Exception $e) { |
| 145 | 145 | // do nothing... php will ignore and continue |
| 146 | 146 | } |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if (is_dir($SETTINGS['cpassman_dir'] . '/install')) { |
|
| 156 | + if (is_dir($SETTINGS['cpassman_dir'].'/install')) { |
|
| 157 | 157 | // Set the permissions on the install directory and delete |
| 158 | 158 | // is server Windows or Linux? |
| 159 | 159 | if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { |
| 160 | - recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440); |
|
| 160 | + recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440); |
|
| 161 | 161 | } |
| 162 | - delTree($SETTINGS['cpassman_dir'] . '/install'); |
|
| 162 | + delTree($SETTINGS['cpassman_dir'].'/install'); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // Delete temporary install table |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | // Load Languages stuff |
| 178 | 178 | if (isset($languagesList) === false) { |
| 179 | 179 | $languagesList = []; |
| 180 | - $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
| 180 | + $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
| 181 | 181 | foreach ($rows as $record) { |
| 182 | 182 | array_push($languagesList, $record['name']); |
| 183 | 183 | if (isset($_SESSION['user_language']) && $record['name'] === $_SESSION['user_language']) { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | // CHECK IF SESSION EXISTS AND IF SESSION IS VALID |
| 236 | 236 | if (empty($_SESSION['sessionDuration']) === false) { |
| 237 | 237 | $dataSession = DB::queryFirstRow( |
| 238 | - 'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
| 238 | + 'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i', |
|
| 239 | 239 | $_SESSION['user_id'] |
| 240 | 240 | ); |
| 241 | 241 | } else { |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | && (isset($_SESSION['user_admin']) === true && $_SESSION['user_admin'] === 1) |
| 300 | 300 | ) { |
| 301 | 301 | $row = DB::queryFirstRow( |
| 302 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule', |
|
| 302 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule', |
|
| 303 | 303 | [ |
| 304 | 304 | 'type' => 'admin', |
| 305 | 305 | 'intitule' => 'cpassman_version', |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | |
| 360 | 360 | syslog( |
| 361 | 361 | LOG_WARNING, |
| 362 | - 'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})" |
|
| 362 | + 'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})" |
|
| 363 | 363 | ); |
| 364 | 364 | // erase session table |
| 365 | 365 | $_SESSION = []; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) { |
| 411 | 411 | // query on user |
| 412 | 412 | $data = DB::queryfirstrow( |
| 413 | - 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
| 413 | + 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM '.prefixTable('users').' WHERE id=%i', |
|
| 414 | 414 | $_SESSION['user_id'] |
| 415 | 415 | ); |
| 416 | 416 | //Check if user has been deleted or unlogged |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | $_SESSION['item_fields'] = []; |
| 492 | 492 | $rows = DB::query( |
| 493 | 493 | 'SELECT * |
| 494 | - FROM ' . prefixTable('categories') . ' |
|
| 494 | + FROM ' . prefixTable('categories').' |
|
| 495 | 495 | WHERE level=%i', |
| 496 | 496 | '0' |
| 497 | 497 | ); |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | // get each field |
| 501 | 501 | $rows2 = DB::query( |
| 502 | 502 | 'SELECT * |
| 503 | - FROM ' . prefixTable('categories') . ' |
|
| 503 | + FROM ' . prefixTable('categories').' |
|
| 504 | 504 | WHERE parent_id=%i |
| 505 | 505 | ORDER BY `order` ASC', |
| 506 | 506 | $record['id'] |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | if ( |
| 578 | 578 | isset($SETTINGS['roles_allowed_to_print']) === true |
| 579 | 579 | && isset($_SESSION['user_roles']) === true |
| 580 | - && (! isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout'])) |
|
| 580 | + && (!isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout'])) |
|
| 581 | 581 | ) { |
| 582 | 582 | foreach (explode(';', $SETTINGS['roles_allowed_to_print']) as $role) { |
| 583 | 583 | if (in_array($role, $_SESSION['user_roles']) === true) { |
@@ -587,5 +587,5 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /* CHECK NUMBER OF USER ONLINE */ |
| 590 | -DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600); |
|
| 590 | +DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600); |
|
| 591 | 591 | $_SESSION['nb_users_online'] = DB::count(); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | require_once 'SecureHandler.php'; |
| 29 | 29 | session_name('teampass_session'); |
| 30 | 30 | session_start(); |
| 31 | -if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 31 | +if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 32 | 32 | die('Hacking attempt...'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -499,8 +499,7 @@ discard block |
||
| 499 | 499 | $post_masked = filter_var($dataReceived['masked'], FILTER_SANITIZE_STRING); |
| 500 | 500 | $post_encrypted = filter_var($dataReceived['encrypted'], FILTER_SANITIZE_STRING); |
| 501 | 501 | $post_roles = filter_var_array($dataReceived['roles'], FILTER_SANITIZE_STRING); |
| 502 | - $post_fieldId = isset($dataReceived['fieldId']) === false ? '' : |
|
| 503 | - filter_var($dataReceived['fieldId'], FILTER_SANITIZE_NUMBER_INT); |
|
| 502 | + $post_fieldId = isset($dataReceived['fieldId']) === false ? '' : filter_var($dataReceived['fieldId'], FILTER_SANITIZE_NUMBER_INT); |
|
| 504 | 503 | |
| 505 | 504 | if (empty($post_fieldId) === false) { |
| 506 | 505 | // UPDATE FIELD |
@@ -515,7 +514,7 @@ discard block |
||
| 515 | 514 | 'encrypted_data' => $post_encrypted, |
| 516 | 515 | 'is_mandatory' => $post_mandatory, |
| 517 | 516 | 'masked' => $post_masked, |
| 518 | - 'role_visibility' => is_null($post_roles) === true || count($post_roles) ===0 ? '' : implode(',', $post_roles), |
|
| 517 | + 'role_visibility' => is_null($post_roles) === true || count($post_roles) === 0 ? '' : implode(',', $post_roles), |
|
| 519 | 518 | 'order' => calculateOrder($post_fieldId, $post_order), |
| 520 | 519 | ), |
| 521 | 520 | 'id = %i', |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | require_once 'SecureHandler.php'; |
| 29 | 29 | session_name('teampass_session'); |
| 30 | 30 | session_start(); |
| 31 | -if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 31 | +if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 32 | 32 | die('Hacking attempt...'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -42,17 +42,17 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // Do checks |
| 45 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 46 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 45 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 46 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 47 | 47 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) { |
| 48 | 48 | // Not allowed page |
| 49 | 49 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
| 50 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 50 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 51 | 51 | exit; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 55 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 54 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 55 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 56 | 56 | header('Content-type: text/html; charset=utf-8'); |
| 57 | 57 | header('Cache-Control: no-cache, must-revalidate'); |
| 58 | 58 | require_once 'main.functions.php'; |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | if (isset($_SESSION['groupes_visibles']) === false |
| 61 | 61 | || empty($_SESSION['groupes_visibles']) === true |
| 62 | 62 | ) { |
| 63 | - echo '{"sEcho": ' . intval($_GET['sEcho']) . ' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
| 63 | + echo '{"sEcho": '.intval($_GET['sEcho']).' ,"iTotalRecords": "0", "iTotalDisplayRecords": "0", "aaData": [] }'; |
|
| 64 | 64 | exit; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //Connect to DB |
| 68 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 68 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 69 | 69 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 70 | 70 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 71 | 71 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $folders = $_SESSION['groupes_visibles']; |
| 90 | 90 | } else { |
| 91 | 91 | // Build tree |
| 92 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 92 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 93 | 93 | $tree->register(); |
| 94 | 94 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 95 | 95 | $folders = $tree->getDescendants(filter_var($_GET['limited'], FILTER_SANITIZE_NUMBER_INT), true); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | //Get current user "personal folder" ID |
| 100 | 100 | $row = DB::query( |
| 101 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %i', |
|
| 101 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %i', |
|
| 102 | 102 | intval($_SESSION['user_id']) |
| 103 | 103 | ); |
| 104 | 104 | //get list of personal folders |
@@ -107,21 +107,21 @@ discard block |
||
| 107 | 107 | $listPf = ''; |
| 108 | 108 | if (empty($row['id']) === false) { |
| 109 | 109 | $rows = DB::query( |
| 110 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 110 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 111 | 111 | WHERE personal_folder = 1 AND NOT parent_id = %i AND NOT title = %i', |
| 112 | 112 | '1', |
| 113 | 113 | filter_var($row['id'], FILTER_SANITIZE_NUMBER_INT), |
| 114 | 114 | filter_var($_SESSION['user_id'], FILTER_SANITIZE_NUMBER_INT) |
| 115 | 115 | ); |
| 116 | 116 | foreach ($rows as $record) { |
| 117 | - if (! in_array($record['id'], $arrayPf)) { |
|
| 117 | + if (!in_array($record['id'], $arrayPf)) { |
|
| 118 | 118 | //build an array of personal folders ids |
| 119 | 119 | array_push($arrayPf, $record['id']); |
| 120 | 120 | //build also a string with those ids |
| 121 | 121 | if (empty($listPf)) { |
| 122 | 122 | $listPf = $record['id']; |
| 123 | 123 | } else { |
| 124 | - $listPf .= ', ' . $record['id']; |
|
| 124 | + $listPf .= ', '.$record['id']; |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | //Paging |
| 132 | 132 | $sLimit = ''; |
| 133 | 133 | if (isset($_GET['start']) === true && $_GET['length'] !== '-1') { |
| 134 | - $sLimit = 'LIMIT ' . filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT) . ', ' . filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT) . ''; |
|
| 134 | + $sLimit = 'LIMIT '.filter_var($_GET['start'], FILTER_SANITIZE_NUMBER_INT).', '.filter_var($_GET['length'], FILTER_SANITIZE_NUMBER_INT).''; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | //Ordering |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | $sOrder = 'ORDER BY '; |
| 146 | 146 | if ($_GET['order'][0]['column'] >= 0) { |
| 147 | - $sOrder .= '' . $aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)] . ' ' |
|
| 148 | - . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_STRING) . ', '; |
|
| 147 | + $sOrder .= ''.$aColumns[filter_var($_GET['order'][0]['column'], FILTER_SANITIZE_NUMBER_INT)].' ' |
|
| 148 | + . filter_var($_GET['order'][0]['dir'], FILTER_SANITIZE_STRING).', '; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $sOrder = substr_replace($sOrder, '', -2); |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $sOrder = ''; |
| 154 | 154 | } |
| 155 | 155 | } else { |
| 156 | - $sOrder = 'ORDER BY ' . $aColumns[1] . ' ASC'; |
|
| 156 | + $sOrder = 'ORDER BY '.$aColumns[1].' ASC'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | // Define criteria |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | if (empty($search_criteria) === false) { |
| 176 | 176 | $sWhere .= ' AND ('; |
| 177 | 177 | for ($i = 0; $i < count($aColumns); ++$i) { |
| 178 | - $sWhere .= $aColumns[$i] . ' LIKE %ss_' . $i . ' OR '; |
|
| 178 | + $sWhere .= $aColumns[$i].' LIKE %ss_'.$i.' OR '; |
|
| 179 | 179 | } |
| 180 | - $sWhere = substr_replace((string) $sWhere, '', -3) . ') '; |
|
| 180 | + $sWhere = substr_replace((string) $sWhere, '', -3).') '; |
|
| 181 | 181 | $crit = [ |
| 182 | 182 | 'idtree' => array_unique($folders), |
| 183 | 183 | '0' => $search_criteria, |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | if (empty($sWhere) === false) { |
| 216 | 216 | $sWhere .= ' AND '; |
| 217 | 217 | } |
| 218 | - $sWhere = 'WHERE ' . $sWhere . 'id_tree NOT IN %ls_pf '; |
|
| 218 | + $sWhere = 'WHERE '.$sWhere.'id_tree NOT IN %ls_pf '; |
|
| 219 | 219 | } else { |
| 220 | - $sWhere = 'WHERE ' . $sWhere; |
|
| 220 | + $sWhere = 'WHERE '.$sWhere; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | DB::query( |
| 224 | - 'SELECT id FROM ' . prefixTable('cache') . " |
|
| 224 | + 'SELECT id FROM '.prefixTable('cache')." |
|
| 225 | 225 | ${sWhere} |
| 226 | 226 | ${sOrder}", |
| 227 | 227 | $crit |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $iTotal = DB::count(); |
| 230 | 230 | $rows = DB::query( |
| 231 | 231 | 'SELECT id, label, description, tags, id_tree, perso, restricted_to, login, folder, author, renewal_period, url, timestamp |
| 232 | - FROM ' . prefixTable('cache') . " |
|
| 232 | + FROM ' . prefixTable('cache')." |
|
| 233 | 233 | ${sWhere} |
| 234 | 234 | ${sOrder} |
| 235 | 235 | ${sLimit}", |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | if (isset($_GET['type']) === false) { |
| 242 | 242 | $sOutput = '{'; |
| 243 | 243 | if (isset($_GET['draw']) === true) { |
| 244 | - $sOutput .= '"draw": ' . intval($_GET['draw']) . ', '; |
|
| 244 | + $sOutput .= '"draw": '.intval($_GET['draw']).', '; |
|
| 245 | 245 | } |
| 246 | 246 | $sOutput .= '"data": ['; |
| 247 | 247 | $sOutputConst = ''; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $arrTmp = []; |
| 258 | 258 | foreach (explode(';', $_SESSION['fonction_id']) as $role) { |
| 259 | 259 | $access = DB::queryFirstRow( |
| 260 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
| 260 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
| 261 | 261 | $role, |
| 262 | 262 | $record['id_tree'] |
| 263 | 263 | ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | } |
| 276 | 276 | $accessLevel = count($arrTmp) > 0 ? min($arrTmp) : $accessLevel; |
| 277 | 277 | if ($accessLevel === 0) { |
| 278 | - $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"' . $record['id'] . '\">'; |
|
| 278 | + $checkbox = '<input type=\"checkbox\" value=\"0\" class=\"mass_op_cb\" data-id=\"'.$record['id'].'\">'; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | if ((int) $accessLevel === 0) { |
@@ -315,22 +315,22 @@ discard block |
||
| 315 | 315 | if (empty($restrictedTo)) { |
| 316 | 316 | $restrictedTo = $_SESSION['user_id']; |
| 317 | 317 | } else { |
| 318 | - $restrictedTo .= ',' . $_SESSION['user_id']; |
|
| 318 | + $restrictedTo .= ','.$_SESSION['user_id']; |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | //col1 |
| 323 | - $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"' . langHdl('open_url_link') . '\" onClick=\"window.location.href='index.php?page=items&group=' . $record['id_tree'] . '&id=' . $record['id'] . ''\" style=\"cursor:pointer;\"></i>' . |
|
| 324 | - '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"' . langHdl('see_item_title') . '\" data-id=\"' . $record['id'] . '\" data-perso=\"' . $record['perso'] . '\" data-tree-id=\"' . $record['id_tree'] . '\" data-expired=\"' . $expired . '\" data-restricted-to=\"' . $restrictedTo . '\" data-rights=\"' . $right . '\" style=\"cursor:pointer;\"></i>' . $checkbox . '", '; |
|
| 323 | + $sOutputItem .= '"<i class=\"fa fa-external-link-alt infotip mr-2\" title=\"'.langHdl('open_url_link').'\" onClick=\"window.location.href='index.php?page=items&group='.$record['id_tree'].'&id='.$record['id'].''\" style=\"cursor:pointer;\"></i>'. |
|
| 324 | + '<i class=\"fa fa-eye infotip mr-2 item-detail\" title=\"'.langHdl('see_item_title').'\" data-id=\"'.$record['id'].'\" data-perso=\"'.$record['perso'].'\" data-tree-id=\"'.$record['id_tree'].'\" data-expired=\"'.$expired.'\" data-restricted-to=\"'.$restrictedTo.'\" data-rights=\"'.$right.'\" style=\"cursor:pointer;\"></i>'.$checkbox.'", '; |
|
| 325 | 325 | //col2 |
| 326 | - $sOutputItem .= '"<span id=\"item_label-' . $record['id'] . '\">' . stripslashes($record['label']) . '</span>", '; |
|
| 326 | + $sOutputItem .= '"<span id=\"item_label-'.$record['id'].'\">'.stripslashes($record['label']).'</span>", '; |
|
| 327 | 327 | //col3 |
| 328 | - $sOutputItem .= '"' . str_replace('&', '&', htmlspecialchars(stripslashes($record['login']), ENT_QUOTES)) . '", '; |
|
| 328 | + $sOutputItem .= '"'.str_replace('&', '&', htmlspecialchars(stripslashes($record['login']), ENT_QUOTES)).'", '; |
|
| 329 | 329 | //col4 |
| 330 | 330 | //get restriction from ROles |
| 331 | 331 | $restrictedToRole = false; |
| 332 | 332 | $rTmp = DB::queryFirstColumn( |
| 333 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id = %i', |
|
| 333 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id = %i', |
|
| 334 | 334 | $record['id'] |
| 335 | 335 | ); |
| 336 | 336 | // We considere here that if user has at least one group similar to the object ones |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | } else { |
| 349 | 349 | $txt = str_replace(['\n', '<br />', '\\'], [' ', ' ', '', ' '], strip_tags($record['description'])); |
| 350 | 350 | if (strlen($txt) > 50) { |
| 351 | - $sOutputItem .= '"' . substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50) . '", '; |
|
| 351 | + $sOutputItem .= '"'.substr(stripslashes(preg_replace('~/<[\/]{0,1}[^>]*>\//|[ \t]/~', '', $txt)), 0, 50).'", '; |
|
| 352 | 352 | } else { |
| 353 | - $sOutputItem .= '"' . stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt)) . '", '; |
|
| 353 | + $sOutputItem .= '"'.stripslashes(preg_replace('~/<[^>]*>|[ \t]/~', '', $txt)).'", '; |
|
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | //col5 - TAGS |
| 358 | - $sOutputItem .= '"' . htmlspecialchars(stripslashes($record['tags']), ENT_QUOTES) . '", '; |
|
| 358 | + $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['tags']), ENT_QUOTES).'", '; |
|
| 359 | 359 | // col6 - URL |
| 360 | 360 | if ($record['url'] !== '0') { |
| 361 | 361 | $sOutputItem .= '"'.filter_var($record['url'], FILTER_SANITIZE_URL).'", '; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | //col7 - Prepare the Treegrid |
| 367 | - $sOutputItem .= '"' . htmlspecialchars(stripslashes($record['folder']), ENT_QUOTES) . '"'; |
|
| 367 | + $sOutputItem .= '"'.htmlspecialchars(stripslashes($record['folder']), ENT_QUOTES).'"'; |
|
| 368 | 368 | //Finish the line |
| 369 | 369 | $sOutputItem .= '], '; |
| 370 | 370 | if ($getItemInList === true) { |
@@ -373,16 +373,16 @@ discard block |
||
| 373 | 373 | --$iTotal; |
| 374 | 374 | } |
| 375 | 375 | } |
| 376 | - if (! empty($sOutputConst)) { |
|
| 376 | + if (!empty($sOutputConst)) { |
|
| 377 | 377 | $sOutput .= substr_replace($sOutputConst, '', -2); |
| 378 | 378 | } |
| 379 | 379 | $sOutput .= '], '; |
| 380 | - $sOutput .= '"recordsTotal": ' . $iTotal . ', '; |
|
| 381 | - $sOutput .= '"recordsFiltered": ' . $iTotal . ' }'; |
|
| 380 | + $sOutput .= '"recordsTotal": '.$iTotal.', '; |
|
| 381 | + $sOutput .= '"recordsFiltered": '.$iTotal.' }'; |
|
| 382 | 382 | echo $sOutput; |
| 383 | 383 | } elseif (isset($_GET['type']) && ($_GET['type'] === 'search_for_items' || $_GET['type'] === 'search_for_items_with_tags')) { |
| 384 | 384 | include_once 'main.functions.php'; |
| 385 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 385 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 386 | 386 | |
| 387 | 387 | $arr_data = []; |
| 388 | 388 | foreach ($rows as $record) { |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | |
| 403 | 403 | // Anyone can modify? |
| 404 | 404 | $tmp = DB::queryfirstrow( |
| 405 | - 'SELECT anyone_can_modify FROM ' . prefixTable('items') . ' WHERE id = %i', |
|
| 405 | + 'SELECT anyone_can_modify FROM '.prefixTable('items').' WHERE id = %i', |
|
| 406 | 406 | $record['id'] |
| 407 | 407 | ); |
| 408 | 408 | if (count($tmp) > 0) { |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | // => récupérer un tableau contenant les roles associés à cet ID (a partir table restriction_to_roles) |
| 434 | 434 | $user_is_included_in_role = 0; |
| 435 | 435 | $roles = DB::query( |
| 436 | - 'SELECT role_id FROM ' . prefixTable('restriction_to_roles') . ' WHERE item_id=%i', |
|
| 436 | + 'SELECT role_id FROM '.prefixTable('restriction_to_roles').' WHERE item_id=%i', |
|
| 437 | 437 | $record['id'] |
| 438 | 438 | ); |
| 439 | 439 | if (count($roles) > 0) { |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | if (empty($restrictedTo)) { |
| 457 | 457 | $restrictedTo = $_SESSION['user_id']; |
| 458 | 458 | } else { |
| 459 | - $restrictedTo .= ',' . $_SESSION['user_id']; |
|
| 459 | + $restrictedTo .= ','.$_SESSION['user_id']; |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $arrTmp = []; |
| 555 | 555 | foreach (explode(';', $_SESSION['fonction_id']) as $role) { |
| 556 | 556 | $access = DB::queryFirstRow( |
| 557 | - 'SELECT type FROM ' . prefixTable('roles_values') . ' WHERE role_id = %i AND folder_id = %i', |
|
| 557 | + 'SELECT type FROM '.prefixTable('roles_values').' WHERE role_id = %i AND folder_id = %i', |
|
| 558 | 558 | $role, |
| 559 | 559 | $record['id_tree'] |
| 560 | 560 | ); |
@@ -603,8 +603,8 @@ discard block |
||
| 603 | 603 | ) { |
| 604 | 604 | $data_item = DB::queryFirstRow( |
| 605 | 605 | 'SELECT i.pw AS pw, s.share_key AS share_key |
| 606 | - FROM ' . prefixTable('items') . ' AS i |
|
| 607 | - INNER JOIN ' . prefixTable('sharekeys_items') . ' AS s ON (s.object_id = i.id) |
|
| 606 | + FROM ' . prefixTable('items').' AS i |
|
| 607 | + INNER JOIN ' . prefixTable('sharekeys_items').' AS s ON (s.object_id = i.id) |
|
| 608 | 608 | WHERE i.id = %i AND s.user_id = %i', |
| 609 | 609 | $record['id'], |
| 610 | 610 | $_SESSION['user_id'] |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | // Do checks |
| 40 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 41 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 40 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 41 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 42 | 42 | if (checkUser($_SESSION['user_id'], $_SESSION['key'], 'items', $SETTINGS) === false) { |
| 43 | 43 | // Not allowed page |
| 44 | 44 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; |
| 45 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 45 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 46 | 46 | exit; |
| 47 | 47 | } |
| 48 | 48 | |
@@ -55,14 +55,14 @@ discard block |
||
| 55 | 55 | date_default_timezone_set('UTC'); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 59 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 58 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 59 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 60 | 60 | header('Content-type: text/html; charset=utf-8'); |
| 61 | 61 | header('Cache-Control: no-cache, must-revalidate'); |
| 62 | 62 | require_once 'main.functions.php'; |
| 63 | 63 | |
| 64 | 64 | // Connect to mysql server |
| 65 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 65 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 66 | 66 | mysqli_connect(DB_HOST, DB_USER, defuseReturnDecrypted(DB_PASSWD, $SETTINGS), DB_NAME, (int) DB_PORT, null); |
| 67 | 67 | |
| 68 | 68 | // Protect POST |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | require_once 'SecureHandler.php'; |
| 29 | 29 | session_name('teampass_session'); |
| 30 | 30 | session_start(); |
| 31 | -if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 31 | +if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 32 | 32 | die('Hacking attempt...'); |
| 33 | 33 | } |
| 34 | 34 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | require_once 'SecureHandler.php'; |
| 29 | 29 | session_name('teampass_session'); |
| 30 | 30 | session_start(); |
| 31 | -if (! isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || ! isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 31 | +if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] === false || !isset($_SESSION['key']) || empty($_SESSION['key'])) { |
|
| 32 | 32 | die('Hacking attempt...'); |
| 33 | 33 | } |
| 34 | 34 | |