@@ -50,22 +50,22 @@ 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 | } |
| 66 | 66 | |
| 67 | 67 | // Include files |
| 68 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 68 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 69 | 69 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 70 | 70 | // Prepare GET variables |
| 71 | 71 | $server = []; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | && isset($SETTINGS['enable_sts']) === true |
| 89 | 89 | && (int) $SETTINGS['enable_sts'] === 1 |
| 90 | 90 | ) { |
| 91 | - redirect('https://' . $server['http_host'] . $server['request_uri']); |
|
| 91 | + redirect('https://'.$server['http_host'].$server['request_uri']); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | // Load pwComplexity |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | // LOAD CPASSMAN SETTINGS |
| 114 | 114 | if ( |
| 115 | 115 | isset($SETTINGS['cpassman_dir']) === true |
| 116 | - && is_dir($SETTINGS['cpassman_dir'] . '/install') === true |
|
| 116 | + && is_dir($SETTINGS['cpassman_dir'].'/install') === true |
|
| 117 | 117 | ) { |
| 118 | 118 | // Should we delete folder INSTALL? |
| 119 | 119 | $row = DB::queryFirstRow( |
| 120 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s AND intitule=%s', |
|
| 120 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s AND intitule=%s', |
|
| 121 | 121 | 'install', |
| 122 | 122 | 'clear_install_folder' |
| 123 | 123 | ); |
@@ -135,11 +135,11 @@ discard block |
||
| 135 | 135 | if ($directories !== false) { |
| 136 | 136 | $files = array_diff($directories, ['.', '..']); |
| 137 | 137 | foreach ($files as $file) { |
| 138 | - if (is_dir($dir . '/' . $file)) { |
|
| 139 | - delTree($dir . '/' . $file); |
|
| 138 | + if (is_dir($dir.'/'.$file)) { |
|
| 139 | + delTree($dir.'/'.$file); |
|
| 140 | 140 | } else { |
| 141 | 141 | try { |
| 142 | - unlink($dir . '/' . $file); |
|
| 142 | + unlink($dir.'/'.$file); |
|
| 143 | 143 | } catch (Exception $e) { |
| 144 | 144 | // do nothing... php will ignore and continue |
| 145 | 145 | } |
@@ -152,13 +152,13 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (is_dir($SETTINGS['cpassman_dir'] . '/install')) { |
|
| 155 | + if (is_dir($SETTINGS['cpassman_dir'].'/install')) { |
|
| 156 | 156 | // Set the permissions on the install directory and delete |
| 157 | 157 | // is server Windows or Linux? |
| 158 | 158 | if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { |
| 159 | - recursiveChmod($SETTINGS['cpassman_dir'] . '/install', 0755, 0440); |
|
| 159 | + recursiveChmod($SETTINGS['cpassman_dir'].'/install', 0755, 0440); |
|
| 160 | 160 | } |
| 161 | - delTree($SETTINGS['cpassman_dir'] . '/install'); |
|
| 161 | + delTree($SETTINGS['cpassman_dir'].'/install'); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | // Delete temporary install table |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | // Load Languages stuff |
| 177 | 177 | if (isset($languagesList) === false) { |
| 178 | 178 | $languagesList = []; |
| 179 | - $rows = DB::query('SELECT * FROM ' . prefixTable('languages') . ' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
| 179 | + $rows = DB::query('SELECT * FROM '.prefixTable('languages').' GROUP BY name, label, code, flag, id ORDER BY name ASC'); |
|
| 180 | 180 | foreach ($rows as $record) { |
| 181 | 181 | array_push($languagesList, $record['name']); |
| 182 | 182 | if (isset($_SESSION['user_language']) && $record['name'] === $_SESSION['user_language']) { |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | // CHECK IF SESSION EXISTS AND IF SESSION IS VALID |
| 235 | 235 | if (empty($_SESSION['sessionDuration']) === false) { |
| 236 | 236 | $dataSession = DB::queryFirstRow( |
| 237 | - 'SELECT key_tempo FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
| 237 | + 'SELECT key_tempo FROM '.prefixTable('users').' WHERE id=%i', |
|
| 238 | 238 | $_SESSION['user_id'] |
| 239 | 239 | ); |
| 240 | 240 | } else { |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | && (isset($_SESSION['user_admin']) === true && $_SESSION['user_admin'] === 1) |
| 299 | 299 | ) { |
| 300 | 300 | $row = DB::queryFirstRow( |
| 301 | - 'SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type=%s_type AND intitule=%s_intitule', |
|
| 301 | + 'SELECT valeur FROM '.prefixTable('misc').' WHERE type=%s_type AND intitule=%s_intitule', |
|
| 302 | 302 | [ |
| 303 | 303 | 'type' => 'admin', |
| 304 | 304 | 'intitule' => 'cpassman_version', |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | syslog( |
| 360 | 360 | LOG_WARNING, |
| 361 | - 'Unlog user: ' . date('Y/m/d H:i:s') . " {$server['remote_addr']} ({$server['http_user_agent']})" |
|
| 361 | + 'Unlog user: '.date('Y/m/d H:i:s')." {$server['remote_addr']} ({$server['http_user_agent']})" |
|
| 362 | 362 | ); |
| 363 | 363 | // erase session table |
| 364 | 364 | $_SESSION = []; |
@@ -409,7 +409,7 @@ discard block |
||
| 409 | 409 | if (isset($_SESSION['user_id']) === true && empty($_SESSION['user_id']) === false) { |
| 410 | 410 | // query on user |
| 411 | 411 | $data = DB::queryfirstrow( |
| 412 | - 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM ' . prefixTable('users') . ' WHERE id=%i', |
|
| 412 | + 'SELECT login, admin, gestionnaire, can_manage_all_users, groupes_visibles, groupes_interdits, fonction_id, last_connexion FROM '.prefixTable('users').' WHERE id=%i', |
|
| 413 | 413 | $_SESSION['user_id'] |
| 414 | 414 | ); |
| 415 | 415 | //Check if user has been deleted or unlogged |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | $_SESSION['item_fields'] = []; |
| 491 | 491 | $rows = DB::query( |
| 492 | 492 | 'SELECT * |
| 493 | - FROM ' . prefixTable('categories') . ' |
|
| 493 | + FROM ' . prefixTable('categories').' |
|
| 494 | 494 | WHERE level=%i', |
| 495 | 495 | '0' |
| 496 | 496 | ); |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | // get each field |
| 500 | 500 | $rows2 = DB::query( |
| 501 | 501 | 'SELECT * |
| 502 | - FROM ' . prefixTable('categories') . ' |
|
| 502 | + FROM ' . prefixTable('categories').' |
|
| 503 | 503 | WHERE parent_id=%i |
| 504 | 504 | ORDER BY `order` ASC', |
| 505 | 505 | $record['id'] |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | if ( |
| 577 | 577 | isset($SETTINGS['roles_allowed_to_print']) === true |
| 578 | 578 | && isset($_SESSION['user_roles']) === true |
| 579 | - && (! isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout'])) |
|
| 579 | + && (!isset($_SESSION['temporary']['user_can_printout']) || empty($_SESSION['temporary']['user_can_printout'])) |
|
| 580 | 580 | ) { |
| 581 | 581 | foreach (explode(';', $SETTINGS['roles_allowed_to_print']) as $role) { |
| 582 | 582 | if (in_array($role, $_SESSION['user_roles']) === true) { |
@@ -586,5 +586,5 @@ discard block |
||
| 586 | 586 | } |
| 587 | 587 | |
| 588 | 588 | /* CHECK NUMBER OF USER ONLINE */ |
| 589 | -DB::query('SELECT * FROM ' . prefixTable('users') . ' WHERE timestamp>=%i', time() - 600); |
|
| 589 | +DB::query('SELECT * FROM '.prefixTable('users').' WHERE timestamp>=%i', time() - 600); |
|
| 590 | 590 | $_SESSION['nb_users_online'] = DB::count(); |
@@ -46,25 +46,25 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /* do checks */ |
| 49 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 50 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 49 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 50 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 51 | 51 | if (!checkUser($_SESSION['user_id'], $_SESSION['key'], 'options', $SETTINGS)) { |
| 52 | 52 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
| 53 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 53 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 54 | 54 | exit; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 58 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 59 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 57 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 59 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 60 | 60 | |
| 61 | 61 | header('Content-type: text/html; charset=utf-8'); |
| 62 | 62 | header('Cache-Control: no-cache, no-store, must-revalidate'); |
| 63 | 63 | |
| 64 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 64 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 65 | 65 | |
| 66 | 66 | // connect to the server |
| 67 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 67 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 68 | 68 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 69 | 69 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 70 | 70 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | array( |
| 118 | 118 | 'http' => array( |
| 119 | 119 | 'ignore_errors' => true, |
| 120 | - 'proxy' => $SETTINGS['proxy_ip'] . ':' . $SETTINGS['proxy_port'], |
|
| 120 | + 'proxy' => $SETTINGS['proxy_ip'].':'.$SETTINGS['proxy_port'], |
|
| 121 | 121 | ), |
| 122 | 122 | ) |
| 123 | 123 | ); |
@@ -136,16 +136,16 @@ discard block |
||
| 136 | 136 | $json_array = json_decode($json, true); |
| 137 | 137 | |
| 138 | 138 | // About version |
| 139 | - $text .= '<li><u>' . $LANG['your_version'] . '</u> : ' . TP_VERSION_FULL; |
|
| 139 | + $text .= '<li><u>'.$LANG['your_version'].'</u> : '.TP_VERSION_FULL; |
|
| 140 | 140 | if (floatval(TP_VERSION_FULL) < floatval($json_array['info']['version'])) { |
| 141 | - $text .= ' <b>' . $LANG['please_update'] . '</b>'; |
|
| 141 | + $text .= ' <b>'.$LANG['please_update'].'</b>'; |
|
| 142 | 142 | } |
| 143 | 143 | $text .= '</li>'; |
| 144 | 144 | |
| 145 | 145 | // Libraries |
| 146 | 146 | $text .= '<li><u>Libraries</u> :</li>'; |
| 147 | 147 | foreach ($json_array['libraries'] as $key => $val) { |
| 148 | - $text .= "<li> <span class='fa fa-caret-right'></span> " . $key . " (<a href='" . $val . "' target='_blank'>" . $val . '</a>)</li>'; |
|
| 148 | + $text .= "<li> <span class='fa fa-caret-right'></span> ".$key." (<a href='".$val."' target='_blank'>".$val.'</a>)</li>'; |
|
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | 151 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | $text .= '</ul>'; |
| 158 | 158 | |
| 159 | - echo '[{"error":"' . $error . '" , "output":"' . str_replace(array("\n", "\t", "\r"), '', $text) . '"}]'; |
|
| 159 | + echo '[{"error":"'.$error.'" , "output":"'.str_replace(array("\n", "\t", "\r"), '', $text).'"}]'; |
|
| 160 | 160 | break; |
| 161 | 161 | |
| 162 | 162 | //########################################################## |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | //get through all users |
| 189 | 189 | $rows = DB::query( |
| 190 | 190 | 'SELECT id, login, email |
| 191 | - FROM ' . prefixTable('users') . ' |
|
| 191 | + FROM ' . prefixTable('users').' |
|
| 192 | 192 | ORDER BY login ASC' |
| 193 | 193 | ); |
| 194 | 194 | foreach ($rows as $record) { |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | //if folder doesn't exist then create it |
| 206 | 206 | $data = DB::queryfirstrow( |
| 207 | 207 | 'SELECT id |
| 208 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 208 | + FROM ' . prefixTable('nested_tree').' |
|
| 209 | 209 | WHERE title = %s AND parent_id = %i', |
| 210 | 210 | $record['id'], |
| 211 | 211 | 0 |
@@ -267,8 +267,8 @@ discard block |
||
| 267 | 267 | echo prepareExchangedData( |
| 268 | 268 | array( |
| 269 | 269 | 'error' => false, |
| 270 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 271 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 270 | + 'message' => langHdl('last_execution').' '. |
|
| 271 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 272 | 272 | '<i class="fas fa-check text-success ml-2"></i>', |
| 273 | 273 | ), |
| 274 | 274 | 'encode' |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | //Libraries call |
| 305 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 305 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 306 | 306 | |
| 307 | 307 | //init |
| 308 | 308 | $foldersIds = array(); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - $items = DB::query('SELECT id,label FROM ' . prefixTable('items') . ' WHERE id_tree NOT IN %li', $foldersIds); |
|
| 319 | + $items = DB::query('SELECT id,label FROM '.prefixTable('items').' WHERE id_tree NOT IN %li', $foldersIds); |
|
| 320 | 320 | foreach ($items as $item) { |
| 321 | 321 | //Delete item |
| 322 | 322 | DB::DELETE(prefixTable('items'), 'id = %i', $item['id']); |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | // delete orphan items |
| 338 | 338 | $rows = DB::query( |
| 339 | 339 | 'SELECT id |
| 340 | - FROM ' . prefixTable('items') . ' |
|
| 340 | + FROM ' . prefixTable('items').' |
|
| 341 | 341 | ORDER BY id ASC' |
| 342 | 342 | ); |
| 343 | 343 | foreach ($rows as $item) { |
| 344 | 344 | DB::query( |
| 345 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
| 345 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
| 346 | 346 | $item['id'], |
| 347 | 347 | 'at_creation' |
| 348 | 348 | ); |
@@ -372,11 +372,11 @@ discard block |
||
| 372 | 372 | echo prepareExchangedData( |
| 373 | 373 | array( |
| 374 | 374 | 'error' => false, |
| 375 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 376 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 375 | + 'message' => langHdl('last_execution').' '. |
|
| 376 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 377 | 377 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
| 378 | 378 | <i class="fas fa-chevron-right mr-2"></i>' . |
| 379 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
| 379 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
| 380 | 380 | ), |
| 381 | 381 | 'encode' |
| 382 | 382 | ); |
@@ -408,21 +408,21 @@ discard block |
||
| 408 | 408 | break; |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 411 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 412 | 412 | $return = ''; |
| 413 | 413 | |
| 414 | 414 | //Get all tables |
| 415 | 415 | $tables = array(); |
| 416 | 416 | $result = DB::query('SHOW TABLES'); |
| 417 | 417 | foreach ($result as $row) { |
| 418 | - $tables[] = $row['Tables_in_' . $database]; |
|
| 418 | + $tables[] = $row['Tables_in_'.$database]; |
|
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | //cycle through |
| 422 | 422 | foreach ($tables as $table) { |
| 423 | 423 | if (defined('DB_PREFIX') || substr_count($table, DB_PREFIX) > 0) { |
| 424 | 424 | // Do query |
| 425 | - $result = DB::queryRaw('SELECT * FROM ' . $table); |
|
| 425 | + $result = DB::queryRaw('SELECT * FROM '.$table); |
|
| 426 | 426 | DB::queryRaw( |
| 427 | 427 | 'SELECT * |
| 428 | 428 | FROM INFORMATION_SCHEMA.COLUMNS |
@@ -434,19 +434,19 @@ discard block |
||
| 434 | 434 | $numFields = DB::count(); |
| 435 | 435 | |
| 436 | 436 | // prepare a drop table |
| 437 | - $return .= 'DROP TABLE ' . $table . ';'; |
|
| 438 | - $row2 = DB::queryfirstrow('SHOW CREATE TABLE ' . $table); |
|
| 439 | - $return .= "\n\n" . $row2['Create Table'] . ";\n\n"; |
|
| 437 | + $return .= 'DROP TABLE '.$table.';'; |
|
| 438 | + $row2 = DB::queryfirstrow('SHOW CREATE TABLE '.$table); |
|
| 439 | + $return .= "\n\n".$row2['Create Table'].";\n\n"; |
|
| 440 | 440 | |
| 441 | 441 | //prepare all fields and datas |
| 442 | 442 | for ($i = 0; $i < $numFields; ++$i) { |
| 443 | 443 | while ($row = $result->fetch_row()) { |
| 444 | - $return .= 'INSERT INTO ' . $table . ' VALUES('; |
|
| 444 | + $return .= 'INSERT INTO '.$table.' VALUES('; |
|
| 445 | 445 | for ($j = 0; $j < $numFields; ++$j) { |
| 446 | 446 | $row[$j] = addslashes($row[$j]); |
| 447 | 447 | $row[$j] = preg_replace("/\n/", '\\n', $row[$j]); |
| 448 | 448 | if (isset($row[$j])) { |
| 449 | - $return .= '"' . $row[$j] . '"'; |
|
| 449 | + $return .= '"'.$row[$j].'"'; |
|
| 450 | 450 | } else { |
| 451 | 451 | $return .= 'NULL'; |
| 452 | 452 | } |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | $token = GenerateCryptKey(20, false, true, true, false, true, $SETTINGS); |
| 467 | 467 | |
| 468 | 468 | //save file |
| 469 | - $filename = time() . '-' . $token . '.sql'; |
|
| 470 | - $handle = fopen($SETTINGS['path_to_files_folder'] . '/' . $filename, 'w+'); |
|
| 469 | + $filename = time().'-'.$token.'.sql'; |
|
| 470 | + $handle = fopen($SETTINGS['path_to_files_folder'].'/'.$filename, 'w+'); |
|
| 471 | 471 | if ($handle !== false) { |
| 472 | 472 | //write file |
| 473 | 473 | fwrite($handle, $return); |
@@ -479,17 +479,17 @@ discard block |
||
| 479 | 479 | // Encrypt the file |
| 480 | 480 | prepareFileWithDefuse( |
| 481 | 481 | 'encrypt', |
| 482 | - $SETTINGS['path_to_files_folder'] . '/' . $filename, |
|
| 483 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
| 482 | + $SETTINGS['path_to_files_folder'].'/'.$filename, |
|
| 483 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
| 484 | 484 | $SETTINGS, |
| 485 | 485 | $post_option |
| 486 | 486 | ); |
| 487 | 487 | |
| 488 | 488 | // Do clean |
| 489 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $filename); |
|
| 489 | + unlink($SETTINGS['path_to_files_folder'].'/'.$filename); |
|
| 490 | 490 | rename( |
| 491 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $filename, |
|
| 492 | - $SETTINGS['path_to_files_folder'] . '/' . $filename |
|
| 491 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$filename, |
|
| 492 | + $SETTINGS['path_to_files_folder'].'/'.$filename |
|
| 493 | 493 | ); |
| 494 | 494 | } |
| 495 | 495 | |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | //update LOG |
| 500 | 500 | logEvents($SETTINGS, 'admin_action', 'dataBase backup', (string) $_SESSION['user_id'], $_SESSION['login']); |
| 501 | 501 | |
| 502 | - echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name=' . urlencode($filename) . '&sub=files&file=' . $filename . '&type=sql&key=' . $_SESSION['key'] . '&key_tmp=' . $_SESSION['key_tmp'] . '&pathIsFiles=1"}]'; |
|
| 502 | + echo '[{"result":"db_backup" , "href":"sources/downloadFile.php?name='.urlencode($filename).'&sub=files&file='.$filename.'&type=sql&key='.$_SESSION['key'].'&key_tmp='.$_SESSION['key_tmp'].'&pathIsFiles=1"}]'; |
|
| 503 | 503 | } |
| 504 | 504 | break; |
| 505 | 505 | |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | ); |
| 529 | 529 | break; |
| 530 | 530 | } |
| 531 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 531 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 532 | 532 | |
| 533 | 533 | $dataPost = explode('&', $post_option); |
| 534 | 534 | $file = htmlspecialchars($dataPost[0]); |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | // Get filename from database |
| 538 | 538 | $data = DB::queryFirstRow( |
| 539 | 539 | 'SELECT valeur |
| 540 | - FROM ' . prefixTable('misc') . ' |
|
| 540 | + FROM ' . prefixTable('misc').' |
|
| 541 | 541 | WHERE increment_id = %i', |
| 542 | 542 | $file |
| 543 | 543 | ); |
@@ -556,22 +556,22 @@ discard block |
||
| 556 | 556 | // Decrypt the file |
| 557 | 557 | $ret = prepareFileWithDefuse( |
| 558 | 558 | 'decrypt', |
| 559 | - $SETTINGS['path_to_files_folder'] . '/' . $file, |
|
| 560 | - $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file, |
|
| 559 | + $SETTINGS['path_to_files_folder'].'/'.$file, |
|
| 560 | + $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file, |
|
| 561 | 561 | $SETTINGS, |
| 562 | 562 | $key |
| 563 | 563 | ); |
| 564 | 564 | |
| 565 | 565 | if (empty($ret) === false) { |
| 566 | - echo '[{"result":"db_restore" , "message":"' . $ret . '"}]'; |
|
| 566 | + echo '[{"result":"db_restore" , "message":"'.$ret.'"}]'; |
|
| 567 | 567 | break; |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | // Do clean |
| 571 | - fileDelete($SETTINGS['path_to_files_folder'] . '/' . $file, $SETTINGS); |
|
| 572 | - $file = $SETTINGS['path_to_files_folder'] . '/defuse_temp_' . $file; |
|
| 571 | + fileDelete($SETTINGS['path_to_files_folder'].'/'.$file, $SETTINGS); |
|
| 572 | + $file = $SETTINGS['path_to_files_folder'].'/defuse_temp_'.$file; |
|
| 573 | 573 | } else { |
| 574 | - $file = $SETTINGS['path_to_files_folder'] . '/' . $file; |
|
| 574 | + $file = $SETTINGS['path_to_files_folder'].'/'.$file; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | //read sql file |
@@ -588,7 +588,7 @@ discard block |
||
| 588 | 588 | fclose($handle); |
| 589 | 589 | |
| 590 | 590 | //delete file |
| 591 | - unlink($SETTINGS['path_to_files_folder'] . '/' . $file); |
|
| 591 | + unlink($SETTINGS['path_to_files_folder'].'/'.$file); |
|
| 592 | 592 | |
| 593 | 593 | //Show done |
| 594 | 594 | echo '[{"result":"db_restore" , "message":""}]'; |
@@ -626,8 +626,8 @@ discard block |
||
| 626 | 626 | foreach ($table as $i => $tablename) { |
| 627 | 627 | if (substr_count($tablename, DB_PREFIX) > 0) { |
| 628 | 628 | // launch optimization quieries |
| 629 | - DB::query('ANALYZE TABLE `' . $tablename . '`'); |
|
| 630 | - DB::query('OPTIMIZE TABLE `' . $tablename . '`'); |
|
| 629 | + DB::query('ANALYZE TABLE `'.$tablename.'`'); |
|
| 630 | + DB::query('OPTIMIZE TABLE `'.$tablename.'`'); |
|
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | } |
@@ -635,12 +635,12 @@ discard block |
||
| 635 | 635 | //Clean up LOG_ITEMS table |
| 636 | 636 | $rows = DB::query( |
| 637 | 637 | 'SELECT id |
| 638 | - FROM ' . prefixTable('items') . ' |
|
| 638 | + FROM ' . prefixTable('items').' |
|
| 639 | 639 | ORDER BY id ASC' |
| 640 | 640 | ); |
| 641 | 641 | foreach ($rows as $item) { |
| 642 | 642 | DB::query( |
| 643 | - 'SELECT * FROM ' . prefixTable('log_items') . ' WHERE id_item = %i AND action = %s', |
|
| 643 | + 'SELECT * FROM '.prefixTable('log_items').' WHERE id_item = %i AND action = %s', |
|
| 644 | 644 | $item['id'], |
| 645 | 645 | 'at_creation' |
| 646 | 646 | ); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | if ($counter === 0) { |
| 649 | 649 | //Create new at_creation entry |
| 650 | 650 | $rowTmp = DB::queryFirstRow( |
| 651 | - 'SELECT date, id_user FROM ' . prefixTable('log_items') . ' WHERE id_item=%i ORDER BY date ASC', |
|
| 651 | + 'SELECT date, id_user FROM '.prefixTable('log_items').' WHERE id_item=%i ORDER BY date ASC', |
|
| 652 | 652 | $item['id'] |
| 653 | 653 | ); |
| 654 | 654 | DB::insert( |
@@ -678,8 +678,8 @@ discard block |
||
| 678 | 678 | echo prepareExchangedData( |
| 679 | 679 | array( |
| 680 | 680 | 'error' => false, |
| 681 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 682 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 681 | + 'message' => langHdl('last_execution').' '. |
|
| 682 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 683 | 683 | '<i class="fas fa-check text-success ml-2"></i>', |
| 684 | 684 | ), |
| 685 | 685 | 'encode' |
@@ -712,14 +712,14 @@ discard block |
||
| 712 | 712 | break; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 715 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 716 | 716 | |
| 717 | 717 | //read folder |
| 718 | 718 | if (is_dir($SETTINGS['path_to_files_folder']) === false) { |
| 719 | 719 | echo prepareExchangedData( |
| 720 | 720 | array( |
| 721 | 721 | 'error' => true, |
| 722 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_files_folder'], |
|
| 722 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_files_folder'], |
|
| 723 | 723 | ), |
| 724 | 724 | 'encode' |
| 725 | 725 | ); |
@@ -731,8 +731,8 @@ discard block |
||
| 731 | 731 | //delete file FILES |
| 732 | 732 | while (false !== ($f = readdir($dir))) { |
| 733 | 733 | if ($f !== '.' && $f !== '..' && $f !== '.htaccess') { |
| 734 | - if (file_exists($dir . $f) && ((time() - filectime($dir . $f)) > 604800)) { |
|
| 735 | - fileDelete($dir . '/' . $f, $SETTINGS); |
|
| 734 | + if (file_exists($dir.$f) && ((time() - filectime($dir.$f)) > 604800)) { |
|
| 735 | + fileDelete($dir.'/'.$f, $SETTINGS); |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | } |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | echo prepareExchangedData( |
| 747 | 747 | array( |
| 748 | 748 | 'error' => true, |
| 749 | - 'message' => langHdl('file_folder_not_accessible') . ": " . $SETTINGS['path_to_upload_folder'], |
|
| 749 | + 'message' => langHdl('file_folder_not_accessible').": ".$SETTINGS['path_to_upload_folder'], |
|
| 750 | 750 | ), |
| 751 | 751 | 'encode' |
| 752 | 752 | ); |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | while (false !== ($f = readdir($dir))) { |
| 761 | 761 | if ($f !== '.' && $f !== '..') { |
| 762 | 762 | if (strpos($f, '_delete.') > 0) { |
| 763 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $f, $SETTINGS); |
|
| 763 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$f, $SETTINGS); |
|
| 764 | 764 | } |
| 765 | 765 | } |
| 766 | 766 | } |
@@ -782,11 +782,11 @@ discard block |
||
| 782 | 782 | echo prepareExchangedData( |
| 783 | 783 | array( |
| 784 | 784 | 'error' => false, |
| 785 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 786 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 785 | + 'message' => langHdl('last_execution').' '. |
|
| 786 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 787 | 787 | '<i class="fas fa-check text-success ml-2 mr-3"></i> |
| 788 | 788 | <i class="fas fa-chevron-right mr-2"></i>' . |
| 789 | - $nbItemsDeleted . ' ' . langHdl('deleted_items'), |
|
| 789 | + $nbItemsDeleted.' '.langHdl('deleted_items'), |
|
| 790 | 790 | ), |
| 791 | 791 | 'encode' |
| 792 | 792 | ); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | break; |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 822 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 823 | 823 | updateCacheTable('reload', $SETTINGS, NULL); |
| 824 | 824 | |
| 825 | 825 | // Log |
@@ -835,8 +835,8 @@ discard block |
||
| 835 | 835 | echo prepareExchangedData( |
| 836 | 836 | [ |
| 837 | 837 | 'error' => false, |
| 838 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 839 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 838 | + 'message' => langHdl('last_execution').' '. |
|
| 839 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 840 | 840 | '<i class="fas fa-check text-success mr-2"></i>', |
| 841 | 841 | ], |
| 842 | 842 | 'encode' |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | // Perform |
| 874 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 874 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 875 | 875 | $ret = handleConfigFile('rebuild', $SETTINGS); |
| 876 | 876 | |
| 877 | 877 | // Log |
@@ -898,8 +898,8 @@ discard block |
||
| 898 | 898 | echo prepareExchangedData( |
| 899 | 899 | array( |
| 900 | 900 | 'error' => false, |
| 901 | - 'message' => langHdl('last_execution') . ' ' . |
|
| 902 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 901 | + 'message' => langHdl('last_execution').' '. |
|
| 902 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 903 | 903 | '<i class="fas fa-check text-success ml-2"></i>', |
| 904 | 904 | ), |
| 905 | 905 | 'encode' |
@@ -939,33 +939,33 @@ discard block |
||
| 939 | 939 | $filename = $post_option; |
| 940 | 940 | $tp_settings = []; |
| 941 | 941 | //get backups infos |
| 942 | - $rows = DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s', 'admin'); |
|
| 942 | + $rows = DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s', 'admin'); |
|
| 943 | 943 | foreach ($rows as $record) { |
| 944 | 944 | $tp_settings[$record['intitule']] = $record['valeur']; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | 947 | // check if backup file is in DB. |
| 948 | 948 | // If YES then it is encrypted with DEFUSE |
| 949 | - $bck = DB::queryFirstRow('SELECT valeur FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
| 949 | + $bck = DB::queryFirstRow('SELECT valeur FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'backup', 'filename'); |
|
| 950 | 950 | |
| 951 | 951 | //read file |
| 952 | 952 | $return = ''; |
| 953 | - $Fnm = $tp_settings['bck_script_path'] . '/' . $filename . '.sql'; |
|
| 953 | + $Fnm = $tp_settings['bck_script_path'].'/'.$filename.'.sql'; |
|
| 954 | 954 | if (file_exists($Fnm)) { |
| 955 | 955 | if (!empty($bck) && $bck['valeur'] === $filename) { |
| 956 | 956 | $err = ''; |
| 957 | 957 | |
| 958 | 958 | // it means that file is DEFUSE encrypted |
| 959 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
| 960 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
| 961 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
| 962 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
| 963 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
| 959 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
| 960 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
| 961 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
| 962 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
| 963 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
| 964 | 964 | |
| 965 | 965 | try { |
| 966 | 966 | \Defuse\Crypto\File::decryptFileWithPassword( |
| 967 | - $SETTINGS['bck_script_path'] . '/' . $post_option . '.sql', |
|
| 968 | - $SETTINGS['bck_script_path'] . '/' . str_replace('encrypted', 'clear', $filename) . '.sql', |
|
| 967 | + $SETTINGS['bck_script_path'].'/'.$post_option.'.sql', |
|
| 968 | + $SETTINGS['bck_script_path'].'/'.str_replace('encrypted', 'clear', $filename).'.sql', |
|
| 969 | 969 | base64_decode($SETTINGS['bck_script_key']) |
| 970 | 970 | ); |
| 971 | 971 | } catch (Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException $ex) { |
@@ -973,7 +973,7 @@ discard block |
||
| 973 | 973 | } |
| 974 | 974 | |
| 975 | 975 | if (!empty($err)) { |
| 976 | - echo '[{ "result":"backup_decrypt_fails" , "msg":"' . $err . '"}]'; |
|
| 976 | + echo '[{ "result":"backup_decrypt_fails" , "msg":"'.$err.'"}]'; |
|
| 977 | 977 | break; |
| 978 | 978 | } |
| 979 | 979 | } else { |
@@ -995,19 +995,19 @@ discard block |
||
| 995 | 995 | ); |
| 996 | 996 | |
| 997 | 997 | //save the file |
| 998 | - $handle = fopen($tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql', 'w+'); |
|
| 998 | + $handle = fopen($tp_settings['bck_script_path'].'/'.$filename.'.clear.sql', 'w+'); |
|
| 999 | 999 | if ($handle !== false) { |
| 1000 | 1000 | fwrite($handle, $return); |
| 1001 | 1001 | fclose($handle); |
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | $result = 'backup_decrypt_success'; |
| 1005 | - $msg = $tp_settings['bck_script_path'] . '/' . $filename . '.clear.sql'; |
|
| 1005 | + $msg = $tp_settings['bck_script_path'].'/'.$filename.'.clear.sql'; |
|
| 1006 | 1006 | } else { |
| 1007 | 1007 | $result = 'backup_decrypt_fails'; |
| 1008 | - $msg = 'File not found: ' . $Fnm; |
|
| 1008 | + $msg = 'File not found: '.$Fnm; |
|
| 1009 | 1009 | } |
| 1010 | - echo '[{ "result":"' . $result . '" , "msg":"' . $msg . '"}]'; |
|
| 1010 | + echo '[{ "result":"'.$result.'" , "msg":"'.$msg.'"}]'; |
|
| 1011 | 1011 | break; |
| 1012 | 1012 | |
| 1013 | 1013 | /* |
@@ -1041,22 +1041,22 @@ discard block |
||
| 1041 | 1041 | require_once 'main.functions.php'; |
| 1042 | 1042 | |
| 1043 | 1043 | // store old sk |
| 1044 | - $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 1044 | + $_SESSION['reencrypt_old_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 1045 | 1045 | |
| 1046 | 1046 | // generate new saltkey |
| 1047 | - $old_sk_filename = SECUREPATH . '/teampass-seckey.txt.' . date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))) . '.' . time(); |
|
| 1047 | + $old_sk_filename = SECUREPATH.'/teampass-seckey.txt.'.date('Y_m_d', mktime(0, 0, 0, (int) date('m'), (int) date('d'), (int) date('y'))).'.'.time(); |
|
| 1048 | 1048 | copy( |
| 1049 | - SECUREPATH . '/teampass-seckey.txt', |
|
| 1049 | + SECUREPATH.'/teampass-seckey.txt', |
|
| 1050 | 1050 | $old_sk_filename |
| 1051 | 1051 | ); |
| 1052 | 1052 | $new_key = defuse_generate_key(); |
| 1053 | 1053 | file_put_contents( |
| 1054 | - SECUREPATH . '/teampass-seckey.txt', |
|
| 1054 | + SECUREPATH.'/teampass-seckey.txt', |
|
| 1055 | 1055 | $new_key |
| 1056 | 1056 | ); |
| 1057 | 1057 | |
| 1058 | 1058 | // store new sk |
| 1059 | - $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 1059 | + $_SESSION['reencrypt_new_salt'] = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 1060 | 1060 | |
| 1061 | 1061 | //put tool in maintenance. |
| 1062 | 1062 | DB::update( |
@@ -1072,13 +1072,13 @@ discard block |
||
| 1072 | 1072 | logEvents($SETTINGS, 'system', 'change_salt_key', (string) $_SESSION['user_id'], $_SESSION['login']); |
| 1073 | 1073 | |
| 1074 | 1074 | // get number of items to change |
| 1075 | - DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', 0); |
|
| 1075 | + DB::query('SELECT id FROM '.prefixTable('items').' WHERE perso = %i', 0); |
|
| 1076 | 1076 | $nb_of_items = DB::count(); |
| 1077 | 1077 | |
| 1078 | 1078 | // create backup table |
| 1079 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 1079 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 1080 | 1080 | DB::query( |
| 1081 | - 'CREATE TABLE `' . prefixTable('sk_reencrypt_backup') . '` ( |
|
| 1081 | + 'CREATE TABLE `'.prefixTable('sk_reencrypt_backup').'` ( |
|
| 1082 | 1082 | `id` int(12) NOT null AUTO_INCREMENT, |
| 1083 | 1083 | `current_table` varchar(100) NOT NULL, |
| 1084 | 1084 | `current_field` varchar(500) NOT NULL, |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | ); |
| 1107 | 1107 | |
| 1108 | 1108 | // delete previous backup files |
| 1109 | - $files = glob($SETTINGS['path_to_upload_folder'] . '/*'); // get all file names |
|
| 1109 | + $files = glob($SETTINGS['path_to_upload_folder'].'/*'); // get all file names |
|
| 1110 | 1110 | foreach ($files as $file) { // iterate files |
| 1111 | 1111 | if (is_file($file)) { |
| 1112 | 1112 | $file_parts = pathinfo($file); |
@@ -1188,7 +1188,7 @@ discard block |
||
| 1188 | 1188 | echo prepareExchangedData( |
| 1189 | 1189 | array( |
| 1190 | 1190 | 'error' => true, |
| 1191 | - 'message' => 'Input `' . $objects[0] . '` is not allowed', |
|
| 1191 | + 'message' => 'Input `'.$objects[0].'` is not allowed', |
|
| 1192 | 1192 | 'nbOfItems' => '', |
| 1193 | 1193 | 'nextAction' => '', |
| 1194 | 1194 | ), |
@@ -1201,9 +1201,9 @@ discard block |
||
| 1201 | 1201 | //change all encrypted data in Items (passwords) |
| 1202 | 1202 | $rows = DB::query( |
| 1203 | 1203 | 'SELECT id, pw, pw_iv |
| 1204 | - FROM ' . prefixTable('items') . ' |
|
| 1204 | + FROM ' . prefixTable('items').' |
|
| 1205 | 1205 | WHERE perso = %s |
| 1206 | - LIMIT ' . $post_start . ', ' . $post_length, |
|
| 1206 | + LIMIT ' . $post_start.', '.$post_length, |
|
| 1207 | 1207 | '0' |
| 1208 | 1208 | ); |
| 1209 | 1209 | foreach ($rows as $record) { |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | 'current_field' => 'pw', |
| 1216 | 1216 | 'value_id' => $record['id'], |
| 1217 | 1217 | 'value' => $record['pw'], |
| 1218 | - 'current_sql' => 'UPDATE ' . prefixTable('items') . " SET pw = '" . $record['pw'] . "' WHERE id = '" . $record['id'] . "';", |
|
| 1218 | + 'current_sql' => 'UPDATE '.prefixTable('items')." SET pw = '".$record['pw']."' WHERE id = '".$record['id']."';", |
|
| 1219 | 1219 | 'value2' => 'none', |
| 1220 | 1220 | 'result' => 'none', |
| 1221 | 1221 | ) |
@@ -1264,9 +1264,9 @@ discard block |
||
| 1264 | 1264 | //change all encrypted data in Logs (passwords) |
| 1265 | 1265 | $rows = DB::query( |
| 1266 | 1266 | 'SELECT raison, increment_id |
| 1267 | - FROM ' . prefixTable('log_items') . " |
|
| 1267 | + FROM ' . prefixTable('log_items')." |
|
| 1268 | 1268 | WHERE action = %s AND raison LIKE 'at_pw :%' |
| 1269 | - LIMIT " . $post_start . ', ' . $post_length, |
|
| 1269 | + LIMIT " . $post_start.', '.$post_length, |
|
| 1270 | 1270 | 'at_modification' |
| 1271 | 1271 | ); |
| 1272 | 1272 | foreach ($rows as $record) { |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | 'current_field' => 'raison', |
| 1279 | 1279 | 'value_id' => $record['increment_id'], |
| 1280 | 1280 | 'value' => $record['raison'], |
| 1281 | - 'current_sql' => 'UPDATE ' . prefixTable('log_items') . " SET raison = '" . $record['raison'] . "' WHERE increment_id = '" . $record['increment_id'] . "';", |
|
| 1281 | + 'current_sql' => 'UPDATE '.prefixTable('log_items')." SET raison = '".$record['raison']."' WHERE increment_id = '".$record['increment_id']."';", |
|
| 1282 | 1282 | 'value2' => 'none', |
| 1283 | 1283 | 'result' => 'none', |
| 1284 | 1284 | ) |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | DB::update( |
| 1307 | 1307 | prefixTable('log_items'), |
| 1308 | 1308 | array( |
| 1309 | - 'raison' => 'at_pw :' . $encrypt['string'], |
|
| 1309 | + 'raison' => 'at_pw :'.$encrypt['string'], |
|
| 1310 | 1310 | 'encryption_type' => 'defuse', |
| 1311 | 1311 | ), |
| 1312 | 1312 | 'increment_id = %i', |
@@ -1331,8 +1331,8 @@ discard block |
||
| 1331 | 1331 | //change all encrypted data in CATEGORIES (passwords) |
| 1332 | 1332 | $rows = DB::query( |
| 1333 | 1333 | 'SELECT id, data |
| 1334 | - FROM ' . prefixTable('categories_items') . ' |
|
| 1335 | - LIMIT ' . $post_start . ', ' . $post_length |
|
| 1334 | + FROM ' . prefixTable('categories_items').' |
|
| 1335 | + LIMIT ' . $post_start.', '.$post_length |
|
| 1336 | 1336 | ); |
| 1337 | 1337 | foreach ($rows as $record) { |
| 1338 | 1338 | // backup data |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | 'current_field' => 'data', |
| 1344 | 1344 | 'value_id' => $record['id'], |
| 1345 | 1345 | 'value' => $record['data'], |
| 1346 | - 'current_sql' => 'UPDATE ' . prefixTable('categories_items') . " SET data = '" . $record['data'] . "' WHERE id = '" . $record['id'] . "';", |
|
| 1346 | + 'current_sql' => 'UPDATE '.prefixTable('categories_items')." SET data = '".$record['data']."' WHERE id = '".$record['id']."';", |
|
| 1347 | 1347 | 'value2' => 'none', |
| 1348 | 1348 | 'result' => 'none', |
| 1349 | 1349 | ) |
@@ -1391,9 +1391,9 @@ discard block |
||
| 1391 | 1391 | // Change all encrypted data in FILES (passwords) |
| 1392 | 1392 | $rows = DB::query( |
| 1393 | 1393 | 'SELECT id, file, status |
| 1394 | - FROM ' . prefixTable('files') . " |
|
| 1394 | + FROM ' . prefixTable('files')." |
|
| 1395 | 1395 | WHERE status = 'encrypted' |
| 1396 | - LIMIT " . $post_start . ', ' . $post_length |
|
| 1396 | + LIMIT " . $post_start.', '.$post_length |
|
| 1397 | 1397 | ); |
| 1398 | 1398 | foreach ($rows as $record) { |
| 1399 | 1399 | // backup data |
@@ -1411,20 +1411,20 @@ discard block |
||
| 1411 | 1411 | ); |
| 1412 | 1412 | $newID = DB::insertId(); |
| 1413 | 1413 | |
| 1414 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
| 1414 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
| 1415 | 1415 | // make a copy of file |
| 1416 | 1416 | if (!copy( |
| 1417 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 1418 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '.copy' |
|
| 1417 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 1418 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'.copy' |
|
| 1419 | 1419 | )) { |
| 1420 | 1420 | $error = 'Copy not possible'; |
| 1421 | 1421 | exit; |
| 1422 | 1422 | } else { |
| 1423 | 1423 | // prepare a bck of file (that will not be deleted) |
| 1424 | - $backup_filename = $record['file'] . '.bck-change-sk.' . time(); |
|
| 1424 | + $backup_filename = $record['file'].'.bck-change-sk.'.time(); |
|
| 1425 | 1425 | copy( |
| 1426 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 1427 | - $SETTINGS['path_to_upload_folder'] . '/' . $backup_filename |
|
| 1426 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 1427 | + $SETTINGS['path_to_upload_folder'].'/'.$backup_filename |
|
| 1428 | 1428 | ); |
| 1429 | 1429 | } |
| 1430 | 1430 | |
@@ -1432,24 +1432,24 @@ discard block |
||
| 1432 | 1432 | // STEP1 - Do decryption |
| 1433 | 1433 | prepareFileWithDefuse( |
| 1434 | 1434 | 'decrypt', |
| 1435 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 1436 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
| 1435 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 1436 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
| 1437 | 1437 | $SETTINGS |
| 1438 | 1438 | ); |
| 1439 | 1439 | |
| 1440 | 1440 | // Do cleanup of files |
| 1441 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file']); |
|
| 1441 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file']); |
|
| 1442 | 1442 | |
| 1443 | 1443 | // STEP2 - Do encryption |
| 1444 | 1444 | prepareFileWithDefuse( |
| 1445 | 1445 | 'encryp', |
| 1446 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted', |
|
| 1447 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['file'], |
|
| 1446 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted', |
|
| 1447 | + $SETTINGS['path_to_upload_folder'].'/'.$record['file'], |
|
| 1448 | 1448 | $SETTINGS |
| 1449 | 1449 | ); |
| 1450 | 1450 | |
| 1451 | 1451 | // Do cleanup of files |
| 1452 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['file'] . '_encrypted'); |
|
| 1452 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['file'].'_encrypted'); |
|
| 1453 | 1453 | |
| 1454 | 1454 | // Update backup table |
| 1455 | 1455 | DB::update( |
@@ -1475,13 +1475,13 @@ discard block |
||
| 1475 | 1475 | // do some things for new object |
| 1476 | 1476 | if (isset($objects[0])) { |
| 1477 | 1477 | if ($objects[0] === 'logs') { |
| 1478 | - DB::query('SELECT increment_id FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 1478 | + DB::query('SELECT increment_id FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 1479 | 1479 | } elseif ($objects[0] === 'files') { |
| 1480 | - DB::query('SELECT id FROM ' . prefixTable('files')); |
|
| 1480 | + DB::query('SELECT id FROM '.prefixTable('files')); |
|
| 1481 | 1481 | } elseif ($objects[0] === 'categories') { |
| 1482 | - DB::query('SELECT id FROM ' . prefixTable('categories_items')); |
|
| 1482 | + DB::query('SELECT id FROM '.prefixTable('categories_items')); |
|
| 1483 | 1483 | } elseif ($objects[0] === 'custfields') { |
| 1484 | - DB::query('SELECT raison FROM ' . prefixTable('log_items') . " WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 1484 | + DB::query('SELECT raison FROM '.prefixTable('log_items')." WHERE action = %s AND raison LIKE 'at_pw :%'", 'at_modification'); |
|
| 1485 | 1485 | } |
| 1486 | 1486 | $nb_of_items = DB::count(); |
| 1487 | 1487 | } else { |
@@ -1600,12 +1600,12 @@ discard block |
||
| 1600 | 1600 | ); |
| 1601 | 1601 | } elseif ($record['current_table'] === 'files') { |
| 1602 | 1602 | // restore backup file |
| 1603 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value'])) { |
|
| 1604 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value']); |
|
| 1605 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
| 1603 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value'])) { |
|
| 1604 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value']); |
|
| 1605 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
| 1606 | 1606 | rename( |
| 1607 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value2'], |
|
| 1608 | - $SETTINGS['path_to_upload_folder'] . '/' . $record['value'] |
|
| 1607 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value2'], |
|
| 1608 | + $SETTINGS['path_to_upload_folder'].'/'.$record['value'] |
|
| 1609 | 1609 | ); |
| 1610 | 1610 | } |
| 1611 | 1611 | } |
@@ -1616,15 +1616,15 @@ discard block |
||
| 1616 | 1616 | |
| 1617 | 1617 | // restore saltkey file |
| 1618 | 1618 | if (file_exists($previous_saltkey_filename)) { |
| 1619 | - unlink(SECUREPATH . '/teampass-seckey.txt'); |
|
| 1619 | + unlink(SECUREPATH.'/teampass-seckey.txt'); |
|
| 1620 | 1620 | rename( |
| 1621 | 1621 | $previous_saltkey_filename, |
| 1622 | - SECUREPATH . '/teampass-seckey.txt' |
|
| 1622 | + SECUREPATH.'/teampass-seckey.txt' |
|
| 1623 | 1623 | ); |
| 1624 | 1624 | } |
| 1625 | 1625 | |
| 1626 | 1626 | // drop table |
| 1627 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 1627 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 1628 | 1628 | |
| 1629 | 1629 | // Send back |
| 1630 | 1630 | echo prepareExchangedData( |
@@ -1667,17 +1667,17 @@ discard block |
||
| 1667 | 1667 | // delete files |
| 1668 | 1668 | $rows = DB::query( |
| 1669 | 1669 | 'SELECT value, value2 |
| 1670 | - FROM ' . prefixTable('sk_reencrypt_backup') . " |
|
| 1670 | + FROM ' . prefixTable('sk_reencrypt_backup')." |
|
| 1671 | 1671 | WHERE current_table = 'files'" |
| 1672 | 1672 | ); |
| 1673 | 1673 | foreach ($rows as $record) { |
| 1674 | - if (file_exists($SETTINGS['path_to_upload_folder'] . '/' . $record['value2'])) { |
|
| 1675 | - unlink($SETTINGS['path_to_upload_folder'] . '/' . $record['value2']); |
|
| 1674 | + if (file_exists($SETTINGS['path_to_upload_folder'].'/'.$record['value2'])) { |
|
| 1675 | + unlink($SETTINGS['path_to_upload_folder'].'/'.$record['value2']); |
|
| 1676 | 1676 | } |
| 1677 | 1677 | } |
| 1678 | 1678 | |
| 1679 | 1679 | // drop table |
| 1680 | - DB::query('DROP TABLE IF EXISTS ' . prefixTable('sk_reencrypt_backup')); |
|
| 1680 | + DB::query('DROP TABLE IF EXISTS '.prefixTable('sk_reencrypt_backup')); |
|
| 1681 | 1681 | |
| 1682 | 1682 | echo '[{"status":"done"}]'; |
| 1683 | 1683 | break; |
@@ -1709,7 +1709,7 @@ discard block |
||
| 1709 | 1709 | ); |
| 1710 | 1710 | break; |
| 1711 | 1711 | } else { |
| 1712 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1712 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1713 | 1713 | |
| 1714 | 1714 | //send email |
| 1715 | 1715 | sendEmail( |
@@ -1745,11 +1745,11 @@ discard block |
||
| 1745 | 1745 | break; |
| 1746 | 1746 | } |
| 1747 | 1747 | |
| 1748 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1748 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1749 | 1749 | |
| 1750 | 1750 | $rows = DB::query( |
| 1751 | 1751 | 'SELECT * |
| 1752 | - FROM ' . prefixTable('emails') . ' |
|
| 1752 | + FROM ' . prefixTable('emails').' |
|
| 1753 | 1753 | WHERE status = %s OR status = %s', |
| 1754 | 1754 | 'not_sent', |
| 1755 | 1755 | '' |
@@ -1834,9 +1834,9 @@ discard block |
||
| 1834 | 1834 | break; |
| 1835 | 1835 | } |
| 1836 | 1836 | |
| 1837 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1837 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1838 | 1838 | |
| 1839 | - $rows = DB::query('SELECT * FROM ' . prefixTable('emails') . ' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 1839 | + $rows = DB::query('SELECT * FROM '.prefixTable('emails').' WHERE status = %s OR status = %s', 'not_sent', ''); |
|
| 1840 | 1840 | foreach ($rows as $record) { |
| 1841 | 1841 | //send email |
| 1842 | 1842 | $ret = json_decode( |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | break; |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | - require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1907 | + require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1908 | 1908 | |
| 1909 | 1909 | // init |
| 1910 | 1910 | $filesList = array(); |
@@ -1917,7 +1917,7 @@ discard block |
||
| 1917 | 1917 | FROM ' . prefixTable('files') |
| 1918 | 1918 | ); |
| 1919 | 1919 | foreach ($rows as $record) { |
| 1920 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $record['file'])) { |
|
| 1920 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$record['file'])) { |
|
| 1921 | 1921 | $addFile = false; |
| 1922 | 1922 | if (($post_option === 'attachments-decrypt' && $record['status'] === 'encrypted') |
| 1923 | 1923 | || ($post_option === 'attachments-encrypt' && $record['status'] === 'clear') |
@@ -1982,8 +1982,8 @@ discard block |
||
| 1982 | 1982 | $post_list = filter_var_array($post_list, FILTER_SANITIZE_STRING); |
| 1983 | 1983 | $post_counter = filter_var($post_counter, FILTER_SANITIZE_NUMBER_INT); |
| 1984 | 1984 | |
| 1985 | - include $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1986 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1985 | + include $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1986 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1987 | 1987 | |
| 1988 | 1988 | $cpt = 0; |
| 1989 | 1989 | $continu = true; |
@@ -1991,15 +1991,15 @@ discard block |
||
| 1991 | 1991 | $message = ''; |
| 1992 | 1992 | |
| 1993 | 1993 | // load PhpEncryption library |
| 1994 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
| 1995 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
| 1996 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
| 1997 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Key.php'; |
|
| 1998 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
| 1999 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/File.php'; |
|
| 2000 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
| 2001 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
| 2002 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/Core.php'; |
|
| 1994 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Crypto.php'; |
|
| 1995 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Encoding.php'; |
|
| 1996 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/DerivedKeys.php'; |
|
| 1997 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Key.php'; |
|
| 1998 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyOrPassword.php'; |
|
| 1999 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/File.php'; |
|
| 2000 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/RuntimeTests.php'; |
|
| 2001 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/KeyProtectedByPassword.php'; |
|
| 2002 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/Core.php'; |
|
| 2003 | 2003 | |
| 2004 | 2004 | // treat 10 files |
| 2005 | 2005 | foreach ($post_list as $file) { |
@@ -2007,35 +2007,35 @@ discard block |
||
| 2007 | 2007 | // Get file name |
| 2008 | 2008 | $file_info = DB::queryfirstrow( |
| 2009 | 2009 | 'SELECT file |
| 2010 | - FROM ' . prefixTable('files') . ' |
|
| 2010 | + FROM ' . prefixTable('files').' |
|
| 2011 | 2011 | WHERE id = %i', |
| 2012 | 2012 | $file |
| 2013 | 2013 | ); |
| 2014 | 2014 | |
| 2015 | 2015 | // skip file is Coherancey not respected |
| 2016 | - if (is_file($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'])) { |
|
| 2016 | + if (is_file($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'])) { |
|
| 2017 | 2017 | // Case where we want to decrypt |
| 2018 | 2018 | if ($post_option === 'decrypt') { |
| 2019 | 2019 | prepareFileWithDefuse( |
| 2020 | 2020 | 'decrypt', |
| 2021 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
| 2022 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 2021 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
| 2022 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 2023 | 2023 | $SETTINGS |
| 2024 | 2024 | ); |
| 2025 | 2025 | // Case where we want to encrypt |
| 2026 | 2026 | } elseif ($post_option === 'encrypt') { |
| 2027 | 2027 | prepareFileWithDefuse( |
| 2028 | 2028 | 'encrypt', |
| 2029 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], |
|
| 2030 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 2029 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], |
|
| 2030 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 2031 | 2031 | $SETTINGS |
| 2032 | 2032 | ); |
| 2033 | 2033 | } |
| 2034 | 2034 | // Do file cleanup |
| 2035 | - fileDelete($SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'], $SETTINGS); |
|
| 2035 | + fileDelete($SETTINGS['path_to_upload_folder'].'/'.$file_info['file'], $SETTINGS); |
|
| 2036 | 2036 | rename( |
| 2037 | - $SETTINGS['path_to_upload_folder'] . '/defuse_temp_' . $file_info['file'], |
|
| 2038 | - $SETTINGS['path_to_upload_folder'] . '/' . $file_info['file'] |
|
| 2037 | + $SETTINGS['path_to_upload_folder'].'/defuse_temp_'.$file_info['file'], |
|
| 2038 | + $SETTINGS['path_to_upload_folder'].'/'.$file_info['file'] |
|
| 2039 | 2039 | ); |
| 2040 | 2040 | |
| 2041 | 2041 | // store in DB |
@@ -2070,8 +2070,8 @@ discard block |
||
| 2070 | 2070 | $post_option === 'attachments-decrypt' ? 'clear' : 'encrypted' |
| 2071 | 2071 | ); |
| 2072 | 2072 | |
| 2073 | - $message = langHdl('last_execution') . ' ' . |
|
| 2074 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) time()) . |
|
| 2073 | + $message = langHdl('last_execution').' '. |
|
| 2074 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) time()). |
|
| 2075 | 2075 | '<i class="fas fa-check text-success ml-2 mr-3"></i>'; |
| 2076 | 2076 | } |
| 2077 | 2077 | |
@@ -2157,7 +2157,7 @@ discard block |
||
| 2157 | 2157 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
| 2158 | 2158 | |
| 2159 | 2159 | DB::query( |
| 2160 | - 'DELETE FROM ' . prefixTable('api') . ' WHERE id = %i', |
|
| 2160 | + 'DELETE FROM '.prefixTable('api').' WHERE id = %i', |
|
| 2161 | 2161 | $post_id |
| 2162 | 2162 | ); |
| 2163 | 2163 | } |
@@ -2249,7 +2249,7 @@ discard block |
||
| 2249 | 2249 | // Delete existing key |
| 2250 | 2250 | } elseif (null !== $post_action && $post_action === 'delete') { |
| 2251 | 2251 | $post_id = filter_var($dataReceived['id'], FILTER_SANITIZE_STRING); |
| 2252 | - DB::query('DELETE FROM ' . prefixTable('api') . ' WHERE id=%i', $post_id); |
|
| 2252 | + DB::query('DELETE FROM '.prefixTable('api').' WHERE id=%i', $post_id); |
|
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | 2255 | echo prepareExchangedData( |
@@ -2264,7 +2264,7 @@ discard block |
||
| 2264 | 2264 | |
| 2265 | 2265 | case 'save_api_status': |
| 2266 | 2266 | // Do query |
| 2267 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
| 2267 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'api'); |
|
| 2268 | 2268 | $counter = DB::count(); |
| 2269 | 2269 | if ($counter === 0) { |
| 2270 | 2270 | DB::insert( |
@@ -2290,7 +2290,7 @@ discard block |
||
| 2290 | 2290 | break; |
| 2291 | 2291 | |
| 2292 | 2292 | case 'save_duo_status': |
| 2293 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
| 2293 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'duo'); |
|
| 2294 | 2294 | $counter = DB::count(); |
| 2295 | 2295 | if ($counter === 0) { |
| 2296 | 2296 | DB::insert( |
@@ -2333,7 +2333,7 @@ discard block |
||
| 2333 | 2333 | foreach ($dataReceived as $key => $value) { |
| 2334 | 2334 | DB::query( |
| 2335 | 2335 | 'SELECT * |
| 2336 | - FROM ' . prefixTable('misc') . ' |
|
| 2336 | + FROM ' . prefixTable('misc').' |
|
| 2337 | 2337 | WHERE type = %s AND intitule = %s', |
| 2338 | 2338 | 'admin', |
| 2339 | 2339 | $key |
@@ -2401,7 +2401,7 @@ discard block |
||
| 2401 | 2401 | } else { |
| 2402 | 2402 | $tmp = 1; |
| 2403 | 2403 | } |
| 2404 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
| 2404 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'google_authentication'); |
|
| 2405 | 2405 | $counter = DB::count(); |
| 2406 | 2406 | if ($counter === 0) { |
| 2407 | 2407 | DB::insert( |
@@ -2427,7 +2427,7 @@ discard block |
||
| 2427 | 2427 | |
| 2428 | 2428 | // ga_website_name |
| 2429 | 2429 | if (is_null($dataReceived['ga_website_name']) === false) { |
| 2430 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
| 2430 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'ga_website_name'); |
|
| 2431 | 2431 | $counter = DB::count(); |
| 2432 | 2432 | if ($counter === 0) { |
| 2433 | 2433 | DB::insert( |
@@ -2458,7 +2458,7 @@ discard block |
||
| 2458 | 2458 | } |
| 2459 | 2459 | |
| 2460 | 2460 | // send data |
| 2461 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
| 2461 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
| 2462 | 2462 | break; |
| 2463 | 2463 | |
| 2464 | 2464 | case 'save_agses_options': |
@@ -2481,7 +2481,7 @@ discard block |
||
| 2481 | 2481 | |
| 2482 | 2482 | // agses_hosted_url |
| 2483 | 2483 | if (!is_null($dataReceived['agses_hosted_url'])) { |
| 2484 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
| 2484 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_url'); |
|
| 2485 | 2485 | $counter = DB::count(); |
| 2486 | 2486 | if ($counter === 0) { |
| 2487 | 2487 | DB::insert( |
@@ -2510,7 +2510,7 @@ discard block |
||
| 2510 | 2510 | |
| 2511 | 2511 | // agses_hosted_id |
| 2512 | 2512 | if (!is_null($dataReceived['agses_hosted_id'])) { |
| 2513 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
| 2513 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_id'); |
|
| 2514 | 2514 | $counter = DB::count(); |
| 2515 | 2515 | if ($counter === 0) { |
| 2516 | 2516 | DB::insert( |
@@ -2539,7 +2539,7 @@ discard block |
||
| 2539 | 2539 | |
| 2540 | 2540 | // agses_hosted_apikey |
| 2541 | 2541 | if (!is_null($dataReceived['agses_hosted_apikey'])) { |
| 2542 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
| 2542 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'agses_hosted_apikey'); |
|
| 2543 | 2543 | $counter = DB::count(); |
| 2544 | 2544 | if ($counter === 0) { |
| 2545 | 2545 | DB::insert( |
@@ -2567,7 +2567,7 @@ discard block |
||
| 2567 | 2567 | } |
| 2568 | 2568 | |
| 2569 | 2569 | // send data |
| 2570 | - echo '[{"result" : "' . addslashes($LANG['done']) . '" , "error" : ""}]'; |
|
| 2570 | + echo '[{"result" : "'.addslashes($LANG['done']).'" , "error" : ""}]'; |
|
| 2571 | 2571 | break; |
| 2572 | 2572 | |
| 2573 | 2573 | case 'save_option_change': |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | |
| 2604 | 2604 | // Check if setting is already in DB. If NO then insert, if YES then update. |
| 2605 | 2605 | $data = DB::query( |
| 2606 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 2606 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 2607 | 2607 | WHERE type = %s AND intitule = %s', |
| 2608 | 2608 | $type, |
| 2609 | 2609 | $dataReceived['field'] |
@@ -2625,7 +2625,7 @@ discard block |
||
| 2625 | 2625 | array( |
| 2626 | 2626 | 'valeur' => time(), |
| 2627 | 2627 | 'type' => $type, |
| 2628 | - 'intitule' => $dataReceived['field'] . '_time', |
|
| 2628 | + 'intitule' => $dataReceived['field'].'_time', |
|
| 2629 | 2629 | ) |
| 2630 | 2630 | ); |
| 2631 | 2631 | } |
@@ -2643,10 +2643,10 @@ discard block |
||
| 2643 | 2643 | if ($dataReceived['field'] === 'send_stats') { |
| 2644 | 2644 | // Check if previous time exists, if not them insert this value in DB |
| 2645 | 2645 | DB::query( |
| 2646 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 2646 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 2647 | 2647 | WHERE type = %s AND intitule = %s', |
| 2648 | 2648 | $type, |
| 2649 | - $dataReceived['field'] . '_time' |
|
| 2649 | + $dataReceived['field'].'_time' |
|
| 2650 | 2650 | ); |
| 2651 | 2651 | $counter = DB::count(); |
| 2652 | 2652 | if ($counter === 0) { |
@@ -2655,7 +2655,7 @@ discard block |
||
| 2655 | 2655 | array( |
| 2656 | 2656 | 'valeur' => 0, |
| 2657 | 2657 | 'type' => $type, |
| 2658 | - 'intitule' => $dataReceived['field'] . '_time', |
|
| 2658 | + 'intitule' => $dataReceived['field'].'_time', |
|
| 2659 | 2659 | ) |
| 2660 | 2660 | ); |
| 2661 | 2661 | } else { |
@@ -2675,13 +2675,13 @@ discard block |
||
| 2675 | 2675 | // special Cases |
| 2676 | 2676 | if ($dataReceived['field'] === 'cpassman_url') { |
| 2677 | 2677 | // update also jsUrl for CSFP protection |
| 2678 | - $jsUrl = $dataReceived['value'] . '/includes/libraries/csrfp/js/csrfprotector.js'; |
|
| 2678 | + $jsUrl = $dataReceived['value'].'/includes/libraries/csrfp/js/csrfprotector.js'; |
|
| 2679 | 2679 | $csrfp_file = '../includes/libraries/csrfp/libs/csrfp.config.php'; |
| 2680 | 2680 | $data = file_get_contents($csrfp_file); |
| 2681 | 2681 | $posJsUrl = strpos($data, '"jsUrl" => "'); |
| 2682 | 2682 | $posEndLine = strpos($data, '",', $posJsUrl); |
| 2683 | 2683 | $line = substr($data, $posJsUrl, ($posEndLine - $posJsUrl + 2)); |
| 2684 | - $newdata = str_replace($line, '"jsUrl" => "' . filter_var($jsUrl, FILTER_SANITIZE_STRING) . '",', $data); |
|
| 2684 | + $newdata = str_replace($line, '"jsUrl" => "'.filter_var($jsUrl, FILTER_SANITIZE_STRING).'",', $data); |
|
| 2685 | 2685 | file_put_contents($csrfp_file, $newdata); |
| 2686 | 2686 | } elseif ($dataReceived['field'] === 'restricted_to_input' && $dataReceived['value'] === '0') { |
| 2687 | 2687 | DB::update( |
@@ -2705,7 +2705,7 @@ discard block |
||
| 2705 | 2705 | echo prepareExchangedData( |
| 2706 | 2706 | array( |
| 2707 | 2707 | 'error' => false, |
| 2708 | - 'misc' => $counter . ' ; ' . $SETTINGS[$dataReceived['field']], |
|
| 2708 | + 'misc' => $counter.' ; '.$SETTINGS[$dataReceived['field']], |
|
| 2709 | 2709 | ), |
| 2710 | 2710 | 'encode' |
| 2711 | 2711 | ); |
@@ -2747,7 +2747,7 @@ discard block |
||
| 2747 | 2747 | |
| 2748 | 2748 | // send statistics |
| 2749 | 2749 | if (null !== $post_status) { |
| 2750 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
| 2750 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_stats'); |
|
| 2751 | 2751 | $counter = DB::count(); |
| 2752 | 2752 | if ($counter === 0) { |
| 2753 | 2753 | DB::insert( |
@@ -2779,7 +2779,7 @@ discard block |
||
| 2779 | 2779 | |
| 2780 | 2780 | // send statistics items |
| 2781 | 2781 | if (null !== $post_list) { |
| 2782 | - DB::query('SELECT * FROM ' . prefixTable('misc') . ' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
| 2782 | + DB::query('SELECT * FROM '.prefixTable('misc').' WHERE type = %s AND intitule = %s', 'admin', 'send_statistics_items'); |
|
| 2783 | 2783 | $counter = DB::count(); |
| 2784 | 2784 | if ($counter === 0) { |
| 2785 | 2785 | DB::insert( |
@@ -2826,7 +2826,7 @@ discard block |
||
| 2826 | 2826 | break; |
| 2827 | 2827 | } |
| 2828 | 2828 | |
| 2829 | - if (DB::query("SHOW TABLES LIKE '" . prefixTable('sk_reencrypt_backup') . "'")) { |
|
| 2829 | + if (DB::query("SHOW TABLES LIKE '".prefixTable('sk_reencrypt_backup')."'")) { |
|
| 2830 | 2830 | if (DB::count() === 1) { |
| 2831 | 2831 | echo 1; |
| 2832 | 2832 | } else { |
@@ -2864,7 +2864,7 @@ discard block |
||
| 2864 | 2864 | |
| 2865 | 2865 | $rows = DB::query( |
| 2866 | 2866 | 'SELECT id, title |
| 2867 | - FROM ' . prefixTable('roles_title') . ' |
|
| 2867 | + FROM ' . prefixTable('roles_title').' |
|
| 2868 | 2868 | ORDER BY title ASC' |
| 2869 | 2869 | ); |
| 2870 | 2870 | foreach ($rows as $record) { |
@@ -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'], 'folders', $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/config/settings.php'; |
|
| 58 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 59 | 59 | header('Content-type: text/html; charset=utf-8'); |
| 60 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 61 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 62 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 60 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 61 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 62 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.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 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 67 | 67 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 68 | 68 | } |
@@ -132,14 +132,14 @@ discard block |
||
| 132 | 132 | && $t->personal_folder == 0 |
| 133 | 133 | ) { |
| 134 | 134 | // get $t->parent_id |
| 135 | - $data = DB::queryFirstRow('SELECT title FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', $t->parent_id); |
|
| 135 | + $data = DB::queryFirstRow('SELECT title FROM '.prefixTable('nested_tree').' WHERE id = %i', $t->parent_id); |
|
| 136 | 136 | if ($t->nlevel == 1) { |
| 137 | 137 | $data['title'] = langHdl('root'); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // get rights on this folder |
| 141 | 141 | $arrayRights = array(); |
| 142 | - $rows = DB::query('SELECT fonction_id FROM ' . prefixTable('rights') . ' WHERE authorized=%i AND tree_id = %i', 1, $t->id); |
|
| 142 | + $rows = DB::query('SELECT fonction_id FROM '.prefixTable('rights').' WHERE authorized=%i AND tree_id = %i', 1, $t->id); |
|
| 143 | 143 | foreach ($rows as $record) { |
| 144 | 144 | array_push($arrayRights, $record['fonction_id']); |
| 145 | 145 | } |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | $node_data = DB::queryFirstRow( |
| 157 | 157 | 'SELECT m.valeur AS valeur, n.renewal_period AS renewal_period, |
| 158 | 158 | n.bloquer_creation AS bloquer_creation, n.bloquer_modification AS bloquer_modification |
| 159 | - FROM ' . prefixTable('misc') . ' AS m, |
|
| 160 | - ' . prefixTable('nested_tree') . ' AS n |
|
| 159 | + FROM ' . prefixTable('misc').' AS m, |
|
| 160 | + ' . prefixTable('nested_tree').' AS n |
|
| 161 | 161 | WHERE m.type=%s AND m.intitule = n.id AND m.intitule = %i', |
| 162 | 162 | 'complex', |
| 163 | 163 | $t->id |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | //col7 |
| 191 | 191 | $data7 = DB::queryFirstRow( |
| 192 | 192 | 'SELECT bloquer_creation,bloquer_modification |
| 193 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 193 | + FROM ' . prefixTable('nested_tree').' |
|
| 194 | 194 | WHERE id = %i', |
| 195 | 195 | intval($t->id) |
| 196 | 196 | ); |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | // Get info about this folder |
| 326 | 326 | $dataFolder = DB::queryfirstrow( |
| 327 | 327 | 'SELECT * |
| 328 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 328 | + FROM ' . prefixTable('nested_tree').' |
|
| 329 | 329 | WHERE id = %i', |
| 330 | 330 | $post_folder_id |
| 331 | 331 | ); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | //check if parent folder is personal |
| 362 | 362 | $dataParent = DB::queryfirstrow( |
| 363 | 363 | 'SELECT personal_folder, bloquer_creation, bloquer_modification |
| 364 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 364 | + FROM ' . prefixTable('nested_tree').' |
|
| 365 | 365 | WHERE id = %i', |
| 366 | 366 | $post_parent_id |
| 367 | 367 | ); |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | // get complexity level for this folder |
| 391 | 391 | $data = DB::queryfirstrow( |
| 392 | 392 | 'SELECT valeur |
| 393 | - FROM ' . prefixTable('misc') . ' |
|
| 393 | + FROM ' . prefixTable('misc').' |
|
| 394 | 394 | WHERE intitule = %i AND type = %s', |
| 395 | 395 | $post_parent_id, |
| 396 | 396 | 'complex' |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | array( |
| 402 | 402 | 'error' => true, |
| 403 | 403 | 'message' => langHdl('error_folder_complexity_lower_than_top_folder') |
| 404 | - . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]', |
|
| 404 | + . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]', |
|
| 405 | 405 | ), |
| 406 | 406 | 'encode' |
| 407 | 407 | ); |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | ) { |
| 555 | 555 | DB::query( |
| 556 | 556 | 'SELECT * |
| 557 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 557 | + FROM ' . prefixTable('nested_tree').' |
|
| 558 | 558 | WHERE title = %s', |
| 559 | 559 | $post_title |
| 560 | 560 | ); |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | //check if parent folder is personal |
| 575 | 575 | $data = DB::queryfirstrow( |
| 576 | 576 | 'SELECT personal_folder, bloquer_creation, bloquer_modification |
| 577 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 577 | + FROM ' . prefixTable('nested_tree').' |
|
| 578 | 578 | WHERE id = %i', |
| 579 | 579 | $post_parent_id |
| 580 | 580 | ); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | // get complexity level for this folder |
| 604 | 604 | $data = DB::queryfirstrow( |
| 605 | 605 | 'SELECT valeur |
| 606 | - FROM ' . prefixTable('misc') . ' |
|
| 606 | + FROM ' . prefixTable('misc').' |
|
| 607 | 607 | WHERE intitule = %i AND type = %s', |
| 608 | 608 | $post_parent_id, |
| 609 | 609 | 'complex' |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | array( |
| 614 | 614 | 'error' => true, |
| 615 | 615 | 'message' => langHdl('error_folder_complexity_lower_than_top_folder') |
| 616 | - . ' [<b>' . TP_PW_COMPLEXITY[$data['valeur']][1] . '</b>]', |
|
| 616 | + . ' [<b>'.TP_PW_COMPLEXITY[$data['valeur']][1].'</b>]', |
|
| 617 | 617 | ), |
| 618 | 618 | 'encode' |
| 619 | 619 | ); |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | && (int) $SETTINGS['subfolder_rights_as_parent'] === 1 |
| 688 | 688 | ) { |
| 689 | 689 | //If it is a subfolder, then give access to it for all roles that allows the parent folder |
| 690 | - $rows = DB::query('SELECT role_id, type FROM ' . prefixTable('roles_values') . ' WHERE folder_id = %i', $post_parent_id); |
|
| 690 | + $rows = DB::query('SELECT role_id, type FROM '.prefixTable('roles_values').' WHERE folder_id = %i', $post_parent_id); |
|
| 691 | 691 | foreach ($rows as $record) { |
| 692 | 692 | //add access to this subfolder |
| 693 | 693 | DB::insert( |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | } |
| 703 | 703 | |
| 704 | 704 | // if parent folder has Custom Fields Categories then add to this child one too |
| 705 | - $rows = DB::query('SELECT id_category FROM ' . prefixTable('categories_folders') . ' WHERE id_folder = %i', $post_parent_id); |
|
| 705 | + $rows = DB::query('SELECT id_category FROM '.prefixTable('categories_folders').' WHERE id_folder = %i', $post_parent_id); |
|
| 706 | 706 | foreach ($rows as $record) { |
| 707 | 707 | //add CF Category to this subfolder |
| 708 | 708 | DB::insert( |
@@ -779,17 +779,17 @@ discard block |
||
| 779 | 779 | prefixTable('misc'), |
| 780 | 780 | array( |
| 781 | 781 | 'type' => 'folder_deleted', |
| 782 | - 'intitule' => 'f' . $folder->id, |
|
| 783 | - 'valeur' => $folder->id . ', ' . $folder->parent_id . ', ' . |
|
| 784 | - $folder->title . ', ' . $folder->nleft . ', ' . $folder->nright . ', ' . |
|
| 785 | - $folder->nlevel . ', 0, 0, 0, 0', |
|
| 782 | + 'intitule' => 'f'.$folder->id, |
|
| 783 | + 'valeur' => $folder->id.', '.$folder->parent_id.', '. |
|
| 784 | + $folder->title.', '.$folder->nleft.', '.$folder->nright.', '. |
|
| 785 | + $folder->nlevel.', 0, 0, 0, 0', |
|
| 786 | 786 | ) |
| 787 | 787 | ); |
| 788 | 788 | //array for delete folder |
| 789 | 789 | $folderForDel[] = $folder->id; |
| 790 | 790 | |
| 791 | 791 | //delete items & logs |
| 792 | - $items = DB::query('SELECT id FROM ' . prefixTable('items') . ' WHERE id_tree=%i', $folder->id); |
|
| 792 | + $items = DB::query('SELECT id FROM '.prefixTable('items').' WHERE id_tree=%i', $folder->id); |
|
| 793 | 793 | foreach ($items as $item) { |
| 794 | 794 | DB::update( |
| 795 | 795 | prefixTable('items'), |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | $tree->rebuild(); |
| 847 | 847 | |
| 848 | 848 | // reload cache table |
| 849 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 849 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 850 | 850 | updateCacheTable('reload', $SETTINGS, null); |
| 851 | 851 | |
| 852 | 852 | echo prepareExchangedData( |
@@ -932,7 +932,7 @@ discard block |
||
| 932 | 932 | // get complexity of current node |
| 933 | 933 | $nodeComplexity = DB::queryfirstrow( |
| 934 | 934 | 'SELECT valeur |
| 935 | - FROM ' . prefixTable('misc') . ' |
|
| 935 | + FROM ' . prefixTable('misc').' |
|
| 936 | 936 | WHERE intitule = %i AND type= %s', |
| 937 | 937 | $nodeInfo->id, |
| 938 | 938 | 'complex' |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | // If it is a subfolder, then give access to it for all roles that allows the parent folder |
| 1008 | 1008 | $rows = DB::query( |
| 1009 | 1009 | 'SELECT role_id, type |
| 1010 | - FROM ' . prefixTable('roles_values') . ' |
|
| 1010 | + FROM ' . prefixTable('roles_values').' |
|
| 1011 | 1011 | WHERE folder_id = %i', |
| 1012 | 1012 | $parentId |
| 1013 | 1013 | ); |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | // Add access to this subfolder after checking that it is not already set |
| 1016 | 1016 | DB::query( |
| 1017 | 1017 | 'SELECT * |
| 1018 | - FROM ' . prefixTable('roles_values') . ' |
|
| 1018 | + FROM ' . prefixTable('roles_values').' |
|
| 1019 | 1019 | WHERE folder_id = %i AND role_id = %i', |
| 1020 | 1020 | $newFolderId, |
| 1021 | 1021 | $record['role_id'] |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // if parent folder has Custom Fields Categories then add to this child one too |
| 1036 | 1036 | $rows = DB::query( |
| 1037 | 1037 | 'SELECT id_category |
| 1038 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 1038 | + FROM ' . prefixTable('categories_folders').' |
|
| 1039 | 1039 | WHERE id_folder = %i', |
| 1040 | 1040 | $nodeInfo->id |
| 1041 | 1041 | ); |
@@ -1054,7 +1054,7 @@ discard block |
||
| 1054 | 1054 | |
| 1055 | 1055 | $rows = DB::query( |
| 1056 | 1056 | 'SELECT * |
| 1057 | - FROM ' . prefixTable('items') . ' |
|
| 1057 | + FROM ' . prefixTable('items').' |
|
| 1058 | 1058 | WHERE id_tree = %i', |
| 1059 | 1059 | $nodeInfo->id |
| 1060 | 1060 | ); |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | // if it is then don't copy it |
| 1064 | 1064 | $item_deleted = DB::queryFirstRow( |
| 1065 | 1065 | 'SELECT * |
| 1066 | - FROM ' . prefixTable('log_items') . ' |
|
| 1066 | + FROM ' . prefixTable('log_items').' |
|
| 1067 | 1067 | WHERE id_item = %i AND action = %s |
| 1068 | 1068 | ORDER BY date DESC |
| 1069 | 1069 | LIMIT 0, 1', |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | |
| 1075 | 1075 | $item_restored = DB::queryFirstRow( |
| 1076 | 1076 | 'SELECT * |
| 1077 | - FROM ' . prefixTable('log_items') . ' |
|
| 1077 | + FROM ' . prefixTable('log_items').' |
|
| 1078 | 1078 | WHERE id_item = %i AND action = %s |
| 1079 | 1079 | ORDER BY date DESC |
| 1080 | 1080 | LIMIT 0, 1', |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | // Get the ITEM object key for the user |
| 1090 | 1090 | $userKey = DB::queryFirstRow( |
| 1091 | 1091 | 'SELECT share_key |
| 1092 | - FROM ' . prefixTable('sharekeys_items') . ' |
|
| 1092 | + FROM ' . prefixTable('sharekeys_items').' |
|
| 1093 | 1093 | WHERE user_id = %i AND object_id = %i', |
| 1094 | 1094 | $_SESSION['user_id'], |
| 1095 | 1095 | $record['id'] |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | // Manage Custom Fields |
| 1164 | 1164 | $categories = DB::query( |
| 1165 | 1165 | 'SELECT * |
| 1166 | - FROM ' . prefixTable('categories_items') . ' |
|
| 1166 | + FROM ' . prefixTable('categories_items').' |
|
| 1167 | 1167 | WHERE item_id = %i', |
| 1168 | 1168 | $record['id'] |
| 1169 | 1169 | ); |
@@ -1211,15 +1211,15 @@ discard block |
||
| 1211 | 1211 | $files = DB::query( |
| 1212 | 1212 | 'SELECT f.id AS id, f.file AS file, f.name AS name, f.status AS status, f.extension AS extension, |
| 1213 | 1213 | f.size AS size, f.type AS type, s.share_key AS share_key |
| 1214 | - FROM ' . prefixTable('files') . ' AS f |
|
| 1215 | - INNER JOIN ' . prefixTable('sharekeys_files') . ' AS s ON (f.id = s.object_id) |
|
| 1214 | + FROM ' . prefixTable('files').' AS f |
|
| 1215 | + INNER JOIN ' . prefixTable('sharekeys_files').' AS s ON (f.id = s.object_id) |
|
| 1216 | 1216 | WHERE s.user_id = %i AND f.id_item = %i', |
| 1217 | 1217 | $_SESSION['user_id'], |
| 1218 | 1218 | $record['id'] |
| 1219 | 1219 | ); |
| 1220 | 1220 | foreach ($files as $file) { |
| 1221 | 1221 | // Check if file still exists |
| 1222 | - if (file_exists($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . TP_FILE_PREFIX . base64_decode($file['file'])) === true) { |
|
| 1222 | + if (file_exists($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.TP_FILE_PREFIX.base64_decode($file['file'])) === true) { |
|
| 1223 | 1223 | // Step1 - decrypt the file |
| 1224 | 1224 | $fileContent = decryptFile( |
| 1225 | 1225 | $file['file'], |
@@ -1228,9 +1228,9 @@ discard block |
||
| 1228 | 1228 | ); |
| 1229 | 1229 | |
| 1230 | 1230 | // Step2 - create file |
| 1231 | - $newFileName = md5(time() . '_' . $file['id']) . '.' . $file['extension']; |
|
| 1231 | + $newFileName = md5(time().'_'.$file['id']).'.'.$file['extension']; |
|
| 1232 | 1232 | |
| 1233 | - $outstream = fopen($SETTINGS['path_to_upload_folder'] . DIRECTORY_SEPARATOR . $newFileName, 'ab'); |
|
| 1233 | + $outstream = fopen($SETTINGS['path_to_upload_folder'].DIRECTORY_SEPARATOR.$newFileName, 'ab'); |
|
| 1234 | 1234 | if ($outstream === false) { |
| 1235 | 1235 | echo prepareExchangedData( |
| 1236 | 1236 | array( |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | $tree->rebuild(); |
| 1306 | 1306 | |
| 1307 | 1307 | // reload cache table |
| 1308 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1308 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1309 | 1309 | updateCacheTable('reload', $SETTINGS, NULL); |
| 1310 | 1310 | |
| 1311 | 1311 | $data = array( |
@@ -1367,7 +1367,7 @@ discard block |
||
| 1367 | 1367 | // Get path |
| 1368 | 1368 | $text = ''; |
| 1369 | 1369 | foreach ($tree->getPath($folder->id, false) as $fld) { |
| 1370 | - $text .= empty($text) === true ? ' [<i>' . $fld->title : ' > ' . $fld->title; |
|
| 1370 | + $text .= empty($text) === true ? ' [<i>'.$fld->title : ' > '.$fld->title; |
|
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | 1373 | // Save array |
@@ -1377,7 +1377,7 @@ discard block |
||
| 1377 | 1377 | 'id' => (int) $folder->id, |
| 1378 | 1378 | 'label' => $folder->title, |
| 1379 | 1379 | 'level' => $folder->nlevel, |
| 1380 | - 'path' => empty($text) === true ? '' : $text . '</i>]' |
|
| 1380 | + 'path' => empty($text) === true ? '' : $text.'</i>]' |
|
| 1381 | 1381 | ) |
| 1382 | 1382 | ); |
| 1383 | 1383 | } |
@@ -44,23 +44,23 @@ discard block |
||
| 44 | 44 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
| 47 | +if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
| 48 | 48 | $SETTINGS = []; |
| 49 | 49 | $SETTINGS['cpassman_dir'] = '..'; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 53 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 54 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 52 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 53 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 54 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 55 | 55 | |
| 56 | 56 | // If Debug then clean the files |
| 57 | 57 | if (DEBUGLDAP === true) { |
| 58 | - define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt'); |
|
| 58 | + define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt'); |
|
| 59 | 59 | $fp = fopen(DEBUGLDAPFILE, 'w'); |
| 60 | 60 | fclose($fp); |
| 61 | 61 | } |
| 62 | 62 | if (DEBUGDUO === true) { |
| 63 | - define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'] . '/duo.debug.txt'); |
|
| 63 | + define('DEBUGDUOFILE', $SETTINGS['path_to_files_folder'].'/duo.debug.txt'); |
|
| 64 | 64 | $fp = fopen(DEBUGDUOFILE, 'w'); |
| 65 | 65 | fclose($fp); |
| 66 | 66 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 77 | 77 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 78 | 78 | } |
| 79 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 79 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 80 | 80 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 81 | 81 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 82 | 82 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // Get DUO keys |
| 96 | 96 | $duoData = DB::query( |
| 97 | 97 | 'SELECT intitule, valeur |
| 98 | - FROM ' . prefixTable('misc') . ' |
|
| 98 | + FROM ' . prefixTable('misc').' |
|
| 99 | 99 | WHERE type = %s', |
| 100 | 100 | 'duoSecurity' |
| 101 | 101 | ); |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // load library |
| 108 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
| 108 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
| 109 | 109 | $sig_request = Duo::signRequest( |
| 110 | 110 | $_GLOBALS['IKEY'], |
| 111 | 111 | $_GLOBALS['SKEY'], |
@@ -116,16 +116,16 @@ discard block |
||
| 116 | 116 | debugIdentify( |
| 117 | 117 | DEBUGDUO, |
| 118 | 118 | DEBUGDUOFILE, |
| 119 | - "\n\n-----\n\n" . |
|
| 120 | - 'sig request : ' . $post_login . "\n" . |
|
| 121 | - 'resp : ' . $sig_request . "\n" |
|
| 119 | + "\n\n-----\n\n". |
|
| 120 | + 'sig request : '.$post_login."\n". |
|
| 121 | + 'resp : '.$sig_request."\n" |
|
| 122 | 122 | ); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | // load csrfprotector |
| 126 | - $csrfp_config = include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
| 126 | + $csrfp_config = include_once $SETTINGS['cpassman_dir'].'/includes/libraries/csrfp/libs/csrfp.config.php'; |
|
| 127 | 127 | // return result |
| 128 | - echo '[{"sig_request" : "' . $sig_request . '" , "csrfp_token" : "' . $csrfp_config['CSRFP_TOKEN'] . '" , "csrfp_key" : "' . filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING) . '"}]'; |
|
| 128 | + echo '[{"sig_request" : "'.$sig_request.'" , "csrfp_token" : "'.$csrfp_config['CSRFP_TOKEN'].'" , "csrfp_key" : "'.filter_var($_COOKIE[$csrfp_config['CSRFP_TOKEN']], FILTER_SANITIZE_STRING).'"}]'; |
|
| 129 | 129 | // --- |
| 130 | 130 | // --- |
| 131 | 131 | } elseif ($post_type === 'identify_duo_user_check') { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | //-------- |
| 136 | 136 | |
| 137 | 137 | // load library |
| 138 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
| 138 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/DuoSecurity/Duo.php'; |
|
| 139 | 139 | $authenticated_username = Duo::verifyResponse( |
| 140 | 140 | $SETTINGS['duo_ikey'], |
| 141 | 141 | $SETTINGS['duo_skey'], |
@@ -146,9 +146,9 @@ discard block |
||
| 146 | 146 | debugIdentify( |
| 147 | 147 | DEBUGDUO, |
| 148 | 148 | DEBUGDUOFILE, |
| 149 | - "\n\n-----\n\n" . |
|
| 150 | - 'sig response : ' . $post_sig_response . "\n" . |
|
| 151 | - 'resp : ' . $authenticated_username . "\n" |
|
| 149 | + "\n\n-----\n\n". |
|
| 150 | + 'sig response : '.$post_sig_response."\n". |
|
| 151 | + 'resp : '.$authenticated_username."\n" |
|
| 152 | 152 | ); |
| 153 | 153 | } |
| 154 | 154 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | // is user in Teampass? |
| 160 | 160 | DB::queryfirstrow( |
| 161 | 161 | 'SELECT id |
| 162 | - FROM ' . prefixTable('users') . ' |
|
| 162 | + FROM ' . prefixTable('users').' |
|
| 163 | 163 | WHERE login = %s', |
| 164 | 164 | $post_login |
| 165 | 165 | ); |
@@ -169,9 +169,9 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
| 172 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
| 173 | 173 | } else { |
| 174 | - echo '[{"authenticated_username" : "' . $authenticated_username . '"}]'; |
|
| 174 | + echo '[{"authenticated_username" : "'.$authenticated_username.'"}]'; |
|
| 175 | 175 | } |
| 176 | 176 | // --- |
| 177 | 177 | // --- |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | //-------- |
| 182 | 182 | |
| 183 | 183 | // Load superGlobals |
| 184 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 184 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 185 | 185 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 186 | 186 | // Prepare GET variables |
| 187 | 187 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
@@ -284,19 +284,19 @@ discard block |
||
| 284 | 284 | } else { |
| 285 | 285 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
| 286 | 286 | } |
| 287 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 288 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 289 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 287 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 288 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 289 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 290 | 290 | |
| 291 | 291 | header('Content-type: text/html; charset=utf-8'); |
| 292 | 292 | error_reporting(E_ERROR); |
| 293 | 293 | |
| 294 | 294 | // Load AntiXSS |
| 295 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 295 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 296 | 296 | $antiXss = new voku\helper\AntiXSS(); |
| 297 | 297 | |
| 298 | 298 | // Load superGlobals |
| 299 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 299 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 300 | 300 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 301 | 301 | |
| 302 | 302 | // Prepare GET variables |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
| 311 | 311 | |
| 312 | 312 | // connect to the server |
| 313 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 313 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 314 | 314 | DB::$host = DB_HOST; |
| 315 | 315 | DB::$user = DB_USER; |
| 316 | 316 | DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | DB::$port = DB_PORT; |
| 319 | 319 | DB::$encoding = DB_ENCODING; |
| 320 | 320 | // User's language loading |
| 321 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $sessionUserLanguage . '.php'; |
|
| 321 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$sessionUserLanguage.'.php'; |
|
| 322 | 322 | |
| 323 | 323 | // decrypt and retreive data in JSON format |
| 324 | 324 | if (empty($sessionKey) === true) { |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | //$arrAttempts = array(); |
| 444 | 444 | $rows = DB::query( |
| 445 | 445 | 'SELECT date |
| 446 | - FROM ' . prefixTable('log_system') . " |
|
| 446 | + FROM ' . prefixTable('log_system')." |
|
| 447 | 447 | WHERE field_1 = %s |
| 448 | 448 | AND type = 'failed_auth' |
| 449 | 449 | AND label = 'user_password_not_correct' |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | foreach ($rows as $record) { |
| 460 | 460 | array_push( |
| 461 | 461 | $arrAttempts, |
| 462 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
| 462 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
| 463 | 463 | ); |
| 464 | 464 | } |
| 465 | 465 | } |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $superGlobal->put('user_upgrade_needed', $userInfo['upgrade_needed'], 'SESSION'); |
| 496 | 496 | $superGlobal->put('user_force_relog', $userInfo['force-relog'], 'SESSION'); |
| 497 | 497 | // get personal settings |
| 498 | - if (! isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) { |
|
| 498 | + if (!isset($userInfo['treeloadstrategy']) || empty($userInfo['treeloadstrategy'])) { |
|
| 499 | 499 | $userInfo['treeloadstrategy'] = 'full'; |
| 500 | 500 | } |
| 501 | 501 | $superGlobal->put('treeloadstrategy', $userInfo['treeloadstrategy'], 'SESSION', 'user'); |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | foreach ($superGlobal->get('user_roles', 'SESSION') as $role) { |
| 598 | 598 | $resRoles = DB::queryFirstRow( |
| 599 | 599 | 'SELECT title, complexity |
| 600 | - FROM ' . prefixTable('roles_title') . ' |
|
| 600 | + FROM ' . prefixTable('roles_title').' |
|
| 601 | 601 | WHERE id=%i', |
| 602 | 602 | $role |
| 603 | 603 | ); |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | |
| 619 | 619 | // build complete array of roles |
| 620 | 620 | $superGlobal->put('arr_roles_full', [], 'SESSION'); |
| 621 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
| 621 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
| 622 | 622 | foreach ($rows as $record) { |
| 623 | 623 | $superGlobal->put( |
| 624 | 624 | $record['id'], |
@@ -708,10 +708,10 @@ discard block |
||
| 708 | 708 | $superGlobal->put('latest_items_tab', [], 'SESSION'); |
| 709 | 709 | $superGlobal->put('nb_roles', 0, 'SESSION'); |
| 710 | 710 | foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
| 711 | - if (! empty($item)) { |
|
| 711 | + if (!empty($item)) { |
|
| 712 | 712 | $dataLastItems = DB::queryFirstRow( |
| 713 | 713 | 'SELECT id,label,id_tree |
| 714 | - FROM ' . prefixTable('items') . ' |
|
| 714 | + FROM ' . prefixTable('items').' |
|
| 715 | 715 | WHERE id=%i', |
| 716 | 716 | $item |
| 717 | 717 | ); |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | [ |
| 721 | 721 | 'id' => $item, |
| 722 | 722 | 'label' => $dataLastItems['label'], |
| 723 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
| 723 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
| 724 | 724 | ], |
| 725 | 725 | 'SESSION', |
| 726 | 726 | 'latest_items_tab' |
@@ -737,12 +737,12 @@ discard block |
||
| 737 | 737 | ) { |
| 738 | 738 | // get all Admin users |
| 739 | 739 | $receivers = ''; |
| 740 | - $rows = DB::query('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
| 740 | + $rows = DB::query('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
| 741 | 741 | foreach ($rows as $record) { |
| 742 | 742 | if (empty($receivers)) { |
| 743 | 743 | $receivers = $record['email']; |
| 744 | 744 | } else { |
| 745 | - $receivers = ',' . $record['email']; |
|
| 745 | + $receivers = ','.$record['email']; |
|
| 746 | 746 | } |
| 747 | 747 | } |
| 748 | 748 | // Add email to table |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | '#tp_time#', |
| 759 | 759 | ], |
| 760 | 760 | [ |
| 761 | - ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
| 761 | + ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
| 762 | 762 | date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
| 763 | 763 | date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
| 764 | 764 | ], |
@@ -903,8 +903,8 @@ discard block |
||
| 903 | 903 | debugIdentify( |
| 904 | 904 | DEBUGDUO, |
| 905 | 905 | DEBUGDUOFILE, |
| 906 | - "\n\n----\n" . |
|
| 907 | - 'Identified : ' . filter_var($return, FILTER_SANITIZE_STRING) . "\n\n" |
|
| 906 | + "\n\n----\n". |
|
| 907 | + 'Identified : '.filter_var($return, FILTER_SANITIZE_STRING)."\n\n" |
|
| 908 | 908 | ); |
| 909 | 909 | echo prepareExchangedData( |
| 910 | 910 | [ |
@@ -970,44 +970,44 @@ discard block |
||
| 970 | 970 | ], |
| 971 | 971 | ]; |
| 972 | 972 | // Load expected libraries |
| 973 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
| 974 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
| 975 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 976 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
| 977 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 978 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
| 979 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
| 980 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
| 981 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
| 982 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 983 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
| 984 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
| 985 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 986 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
| 987 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 988 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 989 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 990 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 991 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 992 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
| 993 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 994 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 995 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 996 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 997 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 998 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 999 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 1000 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 1001 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 1002 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 1003 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
| 1004 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 1005 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
| 1006 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 1007 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 1008 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 1009 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 1010 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 973 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
| 974 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
| 975 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 976 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
| 977 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 978 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
| 979 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
| 980 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
| 981 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
| 982 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 983 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
| 984 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
| 985 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 986 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
| 987 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 988 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 989 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 990 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 991 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 992 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
| 993 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 994 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 995 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 996 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 997 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 998 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 999 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 1000 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 1001 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 1002 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 1003 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
| 1004 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 1005 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
| 1006 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 1007 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 1008 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 1009 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 1010 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 1011 | 1011 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 1012 | 1012 | $ad->register(); |
| 1013 | 1013 | $connection = new Connection($config); |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | $error = $e->getDetailedError(); |
| 1020 | 1020 | return [ |
| 1021 | 1021 | 'error' => true, |
| 1022 | - 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage(). '<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
| 1022 | + 'message' => langHdl('error').' : '.$error->getErrorCode().' - '.$error->getErrorMessage().'<br>'.$error->getDiagnosticMessage().' '.$config['username'], |
|
| 1023 | 1023 | |
| 1024 | 1024 | ]; |
| 1025 | 1025 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | // load passwordLib library |
| 1050 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1050 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1051 | 1051 | $pwdlib->register(); |
| 1052 | 1052 | $pwdlib = new PasswordLib\PasswordLib(); |
| 1053 | 1053 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
| 1113 | 1113 | { |
| 1114 | 1114 | // Load superGlobals |
| 1115 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1115 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1116 | 1116 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1117 | 1117 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
| 1118 | 1118 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
@@ -1151,7 +1151,7 @@ discard block |
||
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | 1153 | // Now check yubico validity |
| 1154 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
| 1154 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
| 1155 | 1155 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
| 1156 | 1156 | $auth = $yubi->verify($yubico_key); |
| 1157 | 1157 | //, null, null, null, 60 |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | 'gestionnaire' => '0', |
| 1204 | 1204 | 'can_manage_all_users' => '0', |
| 1205 | 1205 | 'personal_folder' => $SETTINGS['enable_pf_feature'] === '1' ? '1' : '0', |
| 1206 | - 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'] . ';' : '') . (isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
| 1206 | + 'fonction_id' => (empty($retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass']) === false ? $retLDAP['user_info_from_ad'][0]['commonGroupsLdapVsTeampass'].';' : '').(isset($SETTINGS['ldap_new_user_role']) === true ? $SETTINGS['ldap_new_user_role'] : '0'), |
|
| 1207 | 1207 | 'groupes_interdits' => '', |
| 1208 | 1208 | 'groupes_visibles' => '', |
| 1209 | 1209 | 'last_pw_change' => (int) time(), |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | ] |
| 1229 | 1229 | ); |
| 1230 | 1230 | // Rebuild tree |
| 1231 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1231 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1232 | 1232 | $tree->register(); |
| 1233 | 1233 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1234 | 1234 | $tree->rebuild(); |
@@ -1259,13 +1259,13 @@ discard block |
||
| 1259 | 1259 | && empty($dataReceived['GACode']) === false |
| 1260 | 1260 | ) { |
| 1261 | 1261 | // Load superGlobals |
| 1262 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1262 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1263 | 1263 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1264 | 1264 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
| 1265 | 1265 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
| 1266 | 1266 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
| 1267 | 1267 | // load library |
| 1268 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
| 1268 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
| 1269 | 1269 | // create new instance |
| 1270 | 1270 | $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
| 1271 | 1271 | // Init |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | $mfaMessage = langHdl('ga_flash_qr_and_login'); |
| 1288 | 1288 | // generate new QR |
| 1289 | 1289 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
| 1290 | - 'Teampass - ' . $username, |
|
| 1290 | + 'Teampass - '.$username, |
|
| 1291 | 1291 | $userInfo['ga'] |
| 1292 | 1292 | ); |
| 1293 | 1293 | // clear temporary code from DB |
@@ -1300,7 +1300,7 @@ discard block |
||
| 1300 | 1300 | $userInfo['id'] |
| 1301 | 1301 | ); |
| 1302 | 1302 | $firstTime = [ |
| 1303 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
| 1303 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
| 1304 | 1304 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
| 1305 | 1305 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
| 1306 | 1306 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1352,8 +1352,8 @@ discard block |
||
| 1352 | 1352 | // Set to false |
| 1353 | 1353 | $userPasswordVerified = false; |
| 1354 | 1354 | // load passwordLib library |
| 1355 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1356 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1355 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1356 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1357 | 1357 | $pwdlib->register(); |
| 1358 | 1358 | $pwdlib = new PasswordLib\PasswordLib(); |
| 1359 | 1359 | // Check if old encryption used |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | // Brute force management |
| 1485 | 1485 | if ($sessionPwdAttempts > 3) { |
| 1486 | 1486 | // Load superGlobals |
| 1487 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1487 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1488 | 1488 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1489 | 1489 | $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
| 1490 | 1490 | $superGlobal->put('pwd_attempts', 0, 'SESSION'); |
@@ -1526,7 +1526,7 @@ discard block |
||
| 1526 | 1526 | // Check if user exists |
| 1527 | 1527 | $userInfo = DB::queryFirstRow( |
| 1528 | 1528 | 'SELECT * |
| 1529 | - FROM ' . prefixTable('users') . ' WHERE login=%s', |
|
| 1529 | + FROM ' . prefixTable('users').' WHERE login=%s', |
|
| 1530 | 1530 | $username |
| 1531 | 1531 | ); |
| 1532 | 1532 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | // includes |
| 45 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 46 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 47 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 48 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 49 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 45 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 46 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 47 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 48 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 49 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 50 | 50 | |
| 51 | 51 | // header |
| 52 | 52 | header('Content-type: text/html; charset=utf-8'); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Connect to mysql server |
| 63 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 63 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 64 | 64 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 65 | 65 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 66 | 66 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | DB::$encoding = DB_ENCODING; |
| 73 | 73 | |
| 74 | 74 | // Superglobal load |
| 75 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 75 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 76 | 76 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 77 | 77 | $get = []; |
| 78 | 78 | $get['user_tree_structure'] = $superGlobal->get('user_tree_structure', 'GET'); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $session['personal_visible_groups'] = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 93 | 93 | |
| 94 | 94 | $lastFolderChange = DB::query( |
| 95 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 95 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 96 | 96 | WHERE type = %s AND intitule = %s', |
| 97 | 97 | 'timestamp', |
| 98 | 98 | 'last_folder_change' |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | || (isset($get['force_refresh']) === true && (int) $get['force_refresh'] === 1) |
| 104 | 104 | ) { |
| 105 | 105 | // Build tree |
| 106 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 106 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 107 | 107 | $tree->register(); |
| 108 | 108 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 109 | 109 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | $SETTINGS |
| 214 | 214 | ) { |
| 215 | 215 | // Load library |
| 216 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 216 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 217 | 217 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 218 | 218 | |
| 219 | 219 | // Prepare superGlobal variables |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | // get count of Items in this folder |
| 268 | 268 | DB::query( |
| 269 | 269 | 'SELECT * |
| 270 | - FROM ' . prefixTable('items') . ' |
|
| 270 | + FROM ' . prefixTable('items').' |
|
| 271 | 271 | WHERE inactif=%i AND id_tree = %i', |
| 272 | 272 | 0, |
| 273 | 273 | $node->id |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | // get info about current folder |
| 278 | 278 | DB::query( |
| 279 | 279 | 'SELECT * |
| 280 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 280 | + FROM ' . prefixTable('nested_tree').' |
|
| 281 | 281 | WHERE parent_id = %i', |
| 282 | 282 | $node->id |
| 283 | 283 | ); |
@@ -285,11 +285,10 @@ discard block |
||
| 285 | 285 | |
| 286 | 286 | // If personal Folder, convert id into user name |
| 287 | 287 | $node->title = $node->title === $session_user_id && (int) $node->nlevel === 1 ? |
| 288 | - $session_login : |
|
| 289 | - ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES)); |
|
| 288 | + $session_login : ($node->title === null ? '' : htmlspecialchars_decode($node->title, ENT_QUOTES)); |
|
| 290 | 289 | |
| 291 | 290 | // prepare json return for current node |
| 292 | - $parent = $node->parent_id === 0 ? '#' : 'li_' . $node->parent_id; |
|
| 291 | + $parent = $node->parent_id === 0 ? '#' : 'li_'.$node->parent_id; |
|
| 293 | 292 | |
| 294 | 293 | // special case for READ-ONLY folder |
| 295 | 294 | $title = $session_user_read_only === true && in_array($node->id, $session_personal_folders) === false ? langHdl('read_only_account') : $title; |
@@ -299,33 +298,30 @@ discard block |
||
| 299 | 298 | |
| 300 | 299 | if (in_array($node->id, $session_groupes_visibles)) { |
| 301 | 300 | if (in_array($node->id, $session_read_only_folders)) { |
| 302 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 301 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 303 | 302 | $title = langHdl('read_only_account'); |
| 304 | 303 | $restricted = 1; |
| 305 | 304 | $folderClass = 'folder_not_droppable'; |
| 306 | 305 | } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) { |
| 307 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 306 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 308 | 307 | } |
| 309 | 308 | $text .= |
| 310 | - ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>' |
|
| 309 | + ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>' |
|
| 311 | 310 | .(isset($SETTINGS['tree_counters']) && $SETTINGS['tree_counters'] === 1 ? |
| 312 | - '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : |
|
| 313 | - '') |
|
| 311 | + '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '') |
|
| 314 | 312 | .'</span>'; |
| 315 | 313 | } elseif (in_array($node->id, $listFoldersLimitedKeys)) { |
| 316 | 314 | $restricted = 1; |
| 317 | 315 | $text .= |
| 318 | 316 | $session_user_read_only === true ? |
| 319 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
| 320 | - '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_folders_limited[$node->id]) . '</span>'; |
|
| 317 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_folders_limited[$node->id]).'</span>'; |
|
| 321 | 318 | } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) { |
| 322 | 319 | $restricted = 1; |
| 323 | 320 | if ($session_user_read_only === true) { |
| 324 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 321 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 325 | 322 | } |
| 326 | 323 | $text .= $session_user_read_only === true ? |
| 327 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
| 328 | - '<span class="badge badge-danger ml-2 items_count" id="itcount_' . $node->id . '">' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>'; |
|
| 324 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '<span class="badge badge-danger ml-2 items_count" id="itcount_'.$node->id.'">'.count($session_list_restricted_folders_for_items[$node->id]).'</span>'; |
|
| 329 | 325 | } else { |
| 330 | 326 | $restricted = 1; |
| 331 | 327 | $folderClass = 'folder_not_droppable'; |
@@ -351,18 +347,18 @@ discard block |
||
| 351 | 347 | array_push( |
| 352 | 348 | $ret_json, |
| 353 | 349 | array( |
| 354 | - 'id' => 'li_' . $node->id, |
|
| 350 | + 'id' => 'li_'.$node->id, |
|
| 355 | 351 | 'parent' => $parent, |
| 356 | 352 | 'text' => $text, |
| 357 | 353 | 'children' => $childrenNb === 0 ? false : true, |
| 358 | 354 | 'li_attr' => array( |
| 359 | 355 | 'class' => 'jstreeopen', |
| 360 | - 'title' => 'ID [' . $node->id . '] ' . $title, |
|
| 356 | + 'title' => 'ID ['.$node->id.'] '.$title, |
|
| 361 | 357 | ), |
| 362 | 358 | 'a_attr' => array( |
| 363 | - 'id' => 'fld_' . $node->id, |
|
| 359 | + 'id' => 'fld_'.$node->id, |
|
| 364 | 360 | 'class' => $folderClass, |
| 365 | - 'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)', |
|
| 361 | + 'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)', |
|
| 366 | 362 | 'data-title' => $node->title, |
| 367 | 363 | ), |
| 368 | 364 | ) |
@@ -371,13 +367,13 @@ discard block |
||
| 371 | 367 | array_push( |
| 372 | 368 | $ret_json, |
| 373 | 369 | array( |
| 374 | - 'id' => 'li_' . $node->id, |
|
| 370 | + 'id' => 'li_'.$node->id, |
|
| 375 | 371 | 'parent' => $parent, |
| 376 | 372 | 'children' => $childrenNb === 0 ? false : true, |
| 377 | - 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text, |
|
| 373 | + 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text, |
|
| 378 | 374 | 'li_attr' => array( |
| 379 | 375 | 'class' => '', |
| 380 | - 'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'), |
|
| 376 | + 'title' => 'ID ['.$node->id.'] '.langHdl('no_access'), |
|
| 381 | 377 | ), |
| 382 | 378 | ) |
| 383 | 379 | ); |
@@ -470,7 +466,7 @@ discard block |
||
| 470 | 466 | ) === true |
| 471 | 467 | ) { |
| 472 | 468 | DB::query( |
| 473 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 469 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 474 | 470 | WHERE inactif=%i AND id_tree = %i', |
| 475 | 471 | 0, |
| 476 | 472 | $node |
@@ -557,7 +553,7 @@ discard block |
||
| 557 | 553 | { |
| 558 | 554 | // get info about current folder |
| 559 | 555 | DB::query( |
| 560 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 556 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 561 | 557 | WHERE inactif=%i AND id_tree = %i', |
| 562 | 558 | 0, |
| 563 | 559 | $completTree[$nodeId]->id |
@@ -658,7 +654,7 @@ discard block |
||
| 658 | 654 | */ |
| 659 | 655 | |
| 660 | 656 | // prepare json return for current node |
| 661 | - $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_' . $completTree[$nodeId]->parent_id; |
|
| 657 | + $parent = $completTree[$nodeId]->parent_id === '0' ? '#' : 'li_'.$completTree[$nodeId]->parent_id; |
|
| 662 | 658 | |
| 663 | 659 | // handle displaying |
| 664 | 660 | if ( |
@@ -678,17 +674,17 @@ discard block |
||
| 678 | 674 | array_push( |
| 679 | 675 | $ret_json, |
| 680 | 676 | array( |
| 681 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
| 677 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
| 682 | 678 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
| 683 | 679 | 'text' => $text.$completTree[$nodeId]->title.$nodeData['html'], |
| 684 | 680 | 'li_attr' => array( |
| 685 | 681 | 'class' => 'jstreeopen', |
| 686 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $nodeData['title'], |
|
| 682 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$nodeData['title'], |
|
| 687 | 683 | ), |
| 688 | 684 | 'a_attr' => array( |
| 689 | - 'id' => 'fld_' . $completTree[$nodeId]->id, |
|
| 685 | + 'id' => 'fld_'.$completTree[$nodeId]->id, |
|
| 690 | 686 | 'class' => $nodeData['folderClass'], |
| 691 | - 'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $nodeData['restricted'] . ', 0, 1)', |
|
| 687 | + 'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$nodeData['restricted'].', 0, 1)', |
|
| 692 | 688 | 'data-title' => $completTree[$nodeId]->title, |
| 693 | 689 | ), |
| 694 | 690 | ) |
@@ -697,12 +693,12 @@ discard block |
||
| 697 | 693 | array_push( |
| 698 | 694 | $ret_json, |
| 699 | 695 | array( |
| 700 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
| 696 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
| 701 | 697 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
| 702 | 698 | 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text.$completTree[$nodeId]->title.$nodeData['html'], |
| 703 | 699 | 'li_attr' => array( |
| 704 | 700 | 'class' => '', |
| 705 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'), |
|
| 701 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'), |
|
| 706 | 702 | ), |
| 707 | 703 | ) |
| 708 | 704 | ); |
@@ -765,8 +761,8 @@ discard block |
||
| 765 | 761 | if (in_array($nodeId, $session_groupes_visibles) === true) { |
| 766 | 762 | if (in_array($nodeId, $session_read_only_folders) === true) { |
| 767 | 763 | return [ |
| 768 | - 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
| 769 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
| 764 | + 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
| 765 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
| 770 | 766 | 'title' => langHdl('read_only_account'), |
| 771 | 767 | 'restricted' => 1, |
| 772 | 768 | 'folderClass' => 'folder_not_droppable', |
@@ -780,8 +776,8 @@ discard block |
||
| 780 | 776 | && in_array($nodeId, $session_personal_visible_groups) === false |
| 781 | 777 | ) { |
| 782 | 778 | return [ |
| 783 | - 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
| 784 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
| 779 | + 'html' => '<i class="far fa-eye fa-xs mr-1"></i><span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
| 780 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
| 785 | 781 | 'title' => $title, |
| 786 | 782 | 'restricted' => 0, |
| 787 | 783 | 'folderClass' => 'folder', |
@@ -791,8 +787,8 @@ discard block |
||
| 791 | 787 | } |
| 792 | 788 | |
| 793 | 789 | return [ |
| 794 | - 'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . $itemsNb . |
|
| 795 | - ($tree_counters === 1 ? '/'.$nbChildrenItems .'/'.(count($nodeDescendants) - 1) : '') . '</span>', |
|
| 790 | + 'html' => '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.$itemsNb. |
|
| 791 | + ($tree_counters === 1 ? '/'.$nbChildrenItems.'/'.(count($nodeDescendants) - 1) : '').'</span>', |
|
| 796 | 792 | 'title' => $title, |
| 797 | 793 | 'restricted' => 0, |
| 798 | 794 | 'folderClass' => 'folder', |
@@ -803,8 +799,8 @@ discard block |
||
| 803 | 799 | |
| 804 | 800 | if (in_array($nodeId, $listFoldersLimitedKeys) === true) { |
| 805 | 801 | return [ |
| 806 | - 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '') . |
|
| 807 | - '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_folders_limited[$nodeId]) . '</span>', |
|
| 802 | + 'html' => ($session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''). |
|
| 803 | + '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_folders_limited[$nodeId]).'</span>', |
|
| 808 | 804 | 'title' => $title, |
| 809 | 805 | 'restricted' => 1, |
| 810 | 806 | 'folderClass' => 'folder', |
@@ -815,8 +811,8 @@ discard block |
||
| 815 | 811 | |
| 816 | 812 | if (in_array($nodeId, $listRestrictedFoldersForItemsKeys) === true) { |
| 817 | 813 | return [ |
| 818 | - 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : '' . |
|
| 819 | - '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_' . $nodeId . '">' . count($session_list_restricted_folders_for_items[$nodeId]) . '</span>', |
|
| 814 | + 'html' => $session_user_read_only === true ? '<i class="far fa-eye fa-xs mr-1"></i>' : ''. |
|
| 815 | + '<span class="badge badge-pill badge-light ml-2 items_count" id="itcount_'.$nodeId.'">'.count($session_list_restricted_folders_for_items[$nodeId]).'</span>', |
|
| 820 | 816 | 'title' => $title, |
| 821 | 817 | 'restricted' => 1, |
| 822 | 818 | 'folderClass' => 'folder', |