@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
| 34 | 34 | |
| 35 | 35 | // Load library |
| 36 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 36 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 37 | 37 | require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | // Create a new scheduler |
| 41 | -$assert = new SplClassLoader('Webmozart\Assert', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 41 | +$assert = new SplClassLoader('Webmozart\Assert', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 42 | 42 | $assert->register(); |
| 43 | -$cron = new SplClassLoader('Cron', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 43 | +$cron = new SplClassLoader('Cron', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 44 | 44 | $cron->register(); |
| 45 | -$scheduler = new SplClassLoader('GO', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 45 | +$scheduler = new SplClassLoader('GO', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 46 | 46 | $scheduler->register(); |
| 47 | 47 | $scheduler = new scheduler(); |
| 48 | 48 | |
@@ -50,15 +50,15 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | // Build the scheduler jobs |
| 52 | 52 | // https://github.com/peppeocchi/php-cron-scheduler |
| 53 | -$scheduler->php($SETTINGS['cpassman_dir'] . '/scripts/background_tasks___user_keys_creation.php')->everyMinute($SETTINGS['user_keys_job_frequency'] ?? '1'); |
|
| 54 | -$scheduler->php($SETTINGS['cpassman_dir'] . '/scripts/background_tasks___sending_emails.php')->everyMinute($SETTINGS['sending_emails_job_frequency'] ?? '2'); |
|
| 55 | -$scheduler->php($SETTINGS['cpassman_dir'] . '/scripts/background_tasks___do_calculation.php')->everyMinute($SETTINGS['items_statistics_job_frequency'] ?? '5'); |
|
| 56 | -$scheduler->php($SETTINGS['cpassman_dir'] . '/scripts/background_tasks___user_task.php')->everyMinute($SETTINGS['user_keys_job_frequency'] ?? '1'); |
|
| 53 | +$scheduler->php($SETTINGS['cpassman_dir'].'/scripts/background_tasks___user_keys_creation.php')->everyMinute($SETTINGS['user_keys_job_frequency'] ?? '1'); |
|
| 54 | +$scheduler->php($SETTINGS['cpassman_dir'].'/scripts/background_tasks___sending_emails.php')->everyMinute($SETTINGS['sending_emails_job_frequency'] ?? '2'); |
|
| 55 | +$scheduler->php($SETTINGS['cpassman_dir'].'/scripts/background_tasks___do_calculation.php')->everyMinute($SETTINGS['items_statistics_job_frequency'] ?? '5'); |
|
| 56 | +$scheduler->php($SETTINGS['cpassman_dir'].'/scripts/background_tasks___user_task.php')->everyMinute($SETTINGS['user_keys_job_frequency'] ?? '1'); |
|
| 57 | 57 | |
| 58 | 58 | if (isset($SETTINGS['users_personal_folder_task']) === true && empty($SETTINGS['users_personal_folder_task']) === false) { |
| 59 | 59 | runTask( |
| 60 | 60 | explode(';', $SETTINGS['users_personal_folder_task']), |
| 61 | - $SETTINGS['cpassman_dir'] . '/scripts/task_maintenance_users_personal_folder.php', |
|
| 61 | + $SETTINGS['cpassman_dir'].'/scripts/task_maintenance_users_personal_folder.php', |
|
| 62 | 62 | $scheduler |
| 63 | 63 | ); |
| 64 | 64 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | if (isset($SETTINGS['clean_orphan_objects_task']) === true && empty($SETTINGS['clean_orphan_objects_task']) === false) { |
| 67 | 67 | runTask( |
| 68 | 68 | explode(';', $SETTINGS['clean_orphan_objects_task']), |
| 69 | - $SETTINGS['cpassman_dir'] . '/scripts/task_maintenance_clean_orphan_objects.php', |
|
| 69 | + $SETTINGS['cpassman_dir'].'/scripts/task_maintenance_clean_orphan_objects.php', |
|
| 70 | 70 | $scheduler |
| 71 | 71 | ); |
| 72 | 72 | } |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if (isset($SETTINGS['purge_temporary_files_task']) === true && empty($SETTINGS['purge_temporary_files_task']) === false) { |
| 75 | 75 | runTask( |
| 76 | 76 | explode(';', $SETTINGS['purge_temporary_files_task']), |
| 77 | - $SETTINGS['cpassman_dir'] . '/scripts/task_maintenance_purge_old_files.php', |
|
| 77 | + $SETTINGS['cpassman_dir'].'/scripts/task_maintenance_purge_old_files.php', |
|
| 78 | 78 | $scheduler |
| 79 | 79 | ); |
| 80 | 80 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | if (isset($SETTINGS['reload_cache_table_task']) === true && empty($SETTINGS['reload_cache_table_task']) === false) { |
| 83 | 83 | runTask( |
| 84 | 84 | explode(';', $SETTINGS['reload_cache_table_task']), |
| 85 | - $SETTINGS['cpassman_dir'] . '/scripts/task_maintenance_reload_cache_table.php', |
|
| 85 | + $SETTINGS['cpassman_dir'].'/scripts/task_maintenance_reload_cache_table.php', |
|
| 86 | 86 | $scheduler |
| 87 | 87 | ); |
| 88 | 88 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (isset($SETTINGS['rebuild_config_file_task']) === true && empty($SETTINGS['rebuild_config_file_task']) === false) { |
| 91 | 91 | runTask( |
| 92 | 92 | explode(';', $SETTINGS['rebuild_config_file_task']), |
| 93 | - $SETTINGS['cpassman_dir'] . '/scripts/task_maintenance_rebuild_config_file.php', |
|
| 93 | + $SETTINGS['cpassman_dir'].'/scripts/task_maintenance_rebuild_config_file.php', |
|
| 94 | 94 | $scheduler |
| 95 | 95 | ); |
| 96 | 96 | } |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -if (! isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
| 46 | +if (!isset($SETTINGS['cpassman_dir']) || empty($SETTINGS['cpassman_dir']) === true || $SETTINGS['cpassman_dir'] === '.') { |
|
| 47 | 47 | $SETTINGS = []; |
| 48 | 48 | $SETTINGS['cpassman_dir'] = '..'; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | // Load libraries |
| 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 | -include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.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 | +include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 56 | 56 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 57 | 57 | |
| 58 | 58 | // Prepare POST variables |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 65 | 65 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 66 | 66 | } |
| 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 | } |
@@ -86,12 +86,12 @@ discard block |
||
| 86 | 86 | defineComplexity(); |
| 87 | 87 | |
| 88 | 88 | // Load superGlobals |
| 89 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 89 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 90 | 90 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 91 | 91 | |
| 92 | 92 | // If Debug then clean the files |
| 93 | 93 | if (DEBUGLDAP === true) { |
| 94 | - define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'] . '/ldap.debug.txt'); |
|
| 94 | + define('DEBUGLDAPFILE', $SETTINGS['path_to_files_folder'].'/ldap.debug.txt'); |
|
| 95 | 95 | file_put_contents(DEBUGLDAPFILE, ''); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -178,21 +178,21 @@ discard block |
||
| 178 | 178 | if (findTpConfigFile() === false) { |
| 179 | 179 | throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1); |
| 180 | 180 | } |
| 181 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 182 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 183 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 181 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 182 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 183 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 184 | 184 | |
| 185 | 185 | header('Content-type: text/html; charset=utf-8'); |
| 186 | 186 | error_reporting(E_ERROR); |
| 187 | 187 | |
| 188 | 188 | // Load AntiXSS |
| 189 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 190 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 191 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 189 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-ascii-master/src/voku/helper/ASCII.php'; |
|
| 190 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/portable-utf8-master/src/voku/helper/UTF8.php'; |
|
| 191 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/anti-xss-master/src/voku/helper/AntiXSS.php'; |
|
| 192 | 192 | $antiXss = new voku\helper\AntiXSS(); |
| 193 | 193 | |
| 194 | 194 | // Load superGlobals |
| 195 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 195 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 196 | 196 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 197 | 197 | |
| 198 | 198 | // Prepare GET variables |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $server['PHP_AUTH_PW'] = $superGlobal->get('PHP_AUTH_PW', 'SERVER'); |
| 205 | 205 | |
| 206 | 206 | // connect to the server |
| 207 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 207 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 208 | 208 | DB::$host = DB_HOST; |
| 209 | 209 | DB::$user = DB_USER; |
| 210 | 210 | DB::$password = defined('DB_PASSWD_CLEAR') === false ? defuseReturnDecrypted(DB_PASSWD, $SETTINGS) : DB_PASSWD_CLEAR; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | DB::$ssl = DB_SSL; |
| 215 | 215 | DB::$connect_options = DB_CONNECT_OPTIONS; |
| 216 | 216 | // User's language loading |
| 217 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION', 'user') . '.php'; |
|
| 217 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION', 'user').'.php'; |
|
| 218 | 218 | |
| 219 | 219 | // decrypt and retreive data in JSON format |
| 220 | 220 | if (empty($superGlobal->get('key', 'SESSION')) === true) { |
@@ -230,18 +230,18 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Check if Duo auth is in progress and pass the pw and login back to the standard login process |
| 233 | - if( |
|
| 233 | + if ( |
|
| 234 | 234 | isKeyExistingAndEqual('duo', 1, $SETTINGS) === true |
| 235 | 235 | && $dataReceived['user_2fa_selection'] === 'duo' |
| 236 | - && $superGlobal->get('duo_status','SESSION') === 'IN_PROGRESS' |
|
| 236 | + && $superGlobal->get('duo_status', 'SESSION') === 'IN_PROGRESS' |
|
| 237 | 237 | && !empty($dataReceived['duo_state']) |
| 238 | - ){ |
|
| 238 | + ) { |
|
| 239 | 239 | $key = hash('sha256', $dataReceived['duo_state']); |
| 240 | 240 | $iv = substr(hash('sha256', $dataReceived['duo_state']), 0, 16); |
| 241 | - $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data','SESSION')), 'AES-256-CBC', $key, 0, $iv); |
|
| 241 | + $duo_data_dec = openssl_decrypt(base64_decode($superGlobal->get('duo_data', 'SESSION')), 'AES-256-CBC', $key, 0, $iv); |
|
| 242 | 242 | // Clear the data from the Duo process to continue clean with the standard login process |
| 243 | - $superGlobal->forget('duo_data','SESSION'); |
|
| 244 | - if($duo_data_dec === false){ |
|
| 243 | + $superGlobal->forget('duo_data', 'SESSION'); |
|
| 244 | + if ($duo_data_dec === false) { |
|
| 245 | 245 | echo prepareExchangedData( |
| 246 | 246 | $SETTINGS['cpassman_dir'], |
| 247 | 247 | [ |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $dataReceived['login'] = $duo_data['duo_login']; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | - if(isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
| 260 | + if (isset($dataReceived['pw']) === false || isset($dataReceived['login']) === false) { |
|
| 261 | 261 | echo json_encode([ |
| 262 | 262 | 'data' => prepareExchangedData( |
| 263 | 263 | $SETTINGS['cpassman_dir'], |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | // Append with roles from AD groups |
| 571 | 571 | if (is_null($userInfo['roles_from_ad_groups']) === false) { |
| 572 | - $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id']. ';' . $userInfo['roles_from_ad_groups']; |
|
| 572 | + $userInfo['fonction_id'] = empty($userInfo['fonction_id']) === true ? $userInfo['roles_from_ad_groups'] : $userInfo['fonction_id'].';'.$userInfo['roles_from_ad_groups']; |
|
| 573 | 573 | } |
| 574 | 574 | // store |
| 575 | 575 | $superGlobal->put('fonction_id', $userInfo['fonction_id'], 'SESSION'); |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | if (count($superGlobal->get('user_roles', 'SESSION')) > 0) { |
| 581 | 581 | $rolesList = DB::query( |
| 582 | 582 | 'SELECT id, title, complexity |
| 583 | - FROM ' . prefixTable('roles_title') . ' |
|
| 583 | + FROM ' . prefixTable('roles_title').' |
|
| 584 | 584 | WHERE id IN %li', |
| 585 | 585 | $superGlobal->get('user_roles', 'SESSION') |
| 586 | 586 | ); |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | |
| 646 | 646 | // build complete array of roles |
| 647 | 647 | $superGlobal->put('arr_roles_full', [], 'SESSION'); |
| 648 | - $rows = DB::query('SELECT id, title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
| 648 | + $rows = DB::query('SELECT id, title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
| 649 | 649 | foreach ($rows as $record) { |
| 650 | 650 | $superGlobal->put( |
| 651 | 651 | $record['id'], |
@@ -713,10 +713,10 @@ discard block |
||
| 713 | 713 | $superGlobal->put('latest_items_tab', [], 'SESSION'); |
| 714 | 714 | $superGlobal->put('nb_roles', 0, 'SESSION'); |
| 715 | 715 | foreach ($superGlobal->get('latest_items', 'SESSION') as $item) { |
| 716 | - if (! empty($item)) { |
|
| 716 | + if (!empty($item)) { |
|
| 717 | 717 | $dataLastItems = DB::queryFirstRow( |
| 718 | 718 | 'SELECT id,label,id_tree |
| 719 | - FROM ' . prefixTable('items') . ' |
|
| 719 | + FROM ' . prefixTable('items').' |
|
| 720 | 720 | WHERE id=%i', |
| 721 | 721 | $item |
| 722 | 722 | ); |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | [ |
| 726 | 726 | 'id' => $item, |
| 727 | 727 | 'label' => $dataLastItems['label'], |
| 728 | - 'url' => 'index.php?page=items&group=' . $dataLastItems['id_tree'] . '&id=' . $item, |
|
| 728 | + 'url' => 'index.php?page=items&group='.$dataLastItems['id_tree'].'&id='.$item, |
|
| 729 | 729 | ], |
| 730 | 730 | 'SESSION', |
| 731 | 731 | 'latest_items_tab' |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | // Get cahce tree info |
| 737 | 737 | $cacheTreeData = DB::queryFirstRow( |
| 738 | 738 | 'SELECT visible_folders |
| 739 | - FROM ' . prefixTable('cache_tree') . ' |
|
| 739 | + FROM ' . prefixTable('cache_tree').' |
|
| 740 | 740 | WHERE user_id=%i', |
| 741 | 741 | (int) $superGlobal->get('user_id', 'SESSION') |
| 742 | 742 | ); |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | && (int) $sessionAdmin !== 1 |
| 769 | 769 | ) { |
| 770 | 770 | // get all Admin users |
| 771 | - $val = DB::queryfirstrow('SELECT email FROM ' . prefixTable('users') . " WHERE admin = %i and email != ''", 1); |
|
| 771 | + $val = DB::queryfirstrow('SELECT email FROM '.prefixTable('users')." WHERE admin = %i and email != ''", 1); |
|
| 772 | 772 | if (DB::count() > 0) { |
| 773 | 773 | // Add email to table |
| 774 | 774 | prepareSendingEmail( |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | '#tp_time#', |
| 781 | 781 | ], |
| 782 | 782 | [ |
| 783 | - ' ' . $superGlobal->get('login', 'SESSION') . ' (IP: ' . getClientIpServer() . ')', |
|
| 783 | + ' '.$superGlobal->get('login', 'SESSION').' (IP: '.getClientIpServer().')', |
|
| 784 | 784 | date($SETTINGS['date_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
| 785 | 785 | date($SETTINGS['time_format'], (int) $superGlobal->get('last_connection', 'SESSION')), |
| 786 | 786 | ], |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | { |
| 935 | 935 | $rows = DB::query( |
| 936 | 936 | 'SELECT date |
| 937 | - FROM ' . prefixTable('log_system') . " |
|
| 937 | + FROM ' . prefixTable('log_system')." |
|
| 938 | 938 | WHERE field_1 = %s |
| 939 | 939 | AND type = 'failed_auth' |
| 940 | 940 | AND label = 'password_is_not_correct' |
@@ -948,7 +948,7 @@ discard block |
||
| 948 | 948 | foreach ($rows as $record) { |
| 949 | 949 | array_push( |
| 950 | 950 | $arrAttempts, |
| 951 | - date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], (int) $record['date']) |
|
| 951 | + date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], (int) $record['date']) |
|
| 952 | 952 | ); |
| 953 | 953 | } |
| 954 | 954 | } |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | $ldapConnection |
| 1003 | 1003 | ) : bool |
| 1004 | 1004 | { |
| 1005 | - include_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 1005 | + include_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 1006 | 1006 | |
| 1007 | 1007 | if ((int) $userInfoDisabled === 1) { |
| 1008 | 1008 | return false; |
@@ -1194,45 +1194,45 @@ discard block |
||
| 1194 | 1194 | function authenticateThroughAD(string $username, array $userInfo, string $passwordClear, array $SETTINGS): array |
| 1195 | 1195 | { |
| 1196 | 1196 | // Load expected libraries |
| 1197 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
| 1198 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Illuminate/Contracts/Support/Arrayable.php'; |
|
| 1199 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
| 1200 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 1201 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
| 1202 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 1203 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
| 1204 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
| 1205 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
| 1206 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
| 1207 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 1208 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
| 1209 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
| 1210 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 1211 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
| 1212 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 1213 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 1214 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 1215 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 1216 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 1217 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
| 1218 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 1219 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 1220 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 1221 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 1222 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 1223 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 1224 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 1225 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 1226 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 1227 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 1228 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
| 1229 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 1230 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
| 1231 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 1232 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 1233 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 1234 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
| 1235 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 1197 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Auth/Authenticatable.php'; |
|
| 1198 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Illuminate/Contracts/Support/Arrayable.php'; |
|
| 1199 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/EnumeratesValues.php'; |
|
| 1200 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 1201 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/helpers.php'; |
|
| 1202 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 1203 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Jsonable.php'; |
|
| 1204 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Contracts/Support/Arrayable.php'; |
|
| 1205 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Enumerable.php'; |
|
| 1206 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Collection.php'; |
|
| 1207 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 1208 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
| 1209 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
| 1210 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 1211 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
| 1212 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 1213 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 1214 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 1215 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 1216 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 1217 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
| 1218 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 1219 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 1220 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 1221 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 1222 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 1223 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 1224 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 1225 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 1226 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 1227 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 1228 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
| 1229 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 1230 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
| 1231 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 1232 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 1233 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 1234 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/HandlesConnection.php'; |
|
| 1235 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 1236 | 1236 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 1237 | 1237 | $ad->register(); |
| 1238 | 1238 | |
@@ -1269,7 +1269,7 @@ discard block |
||
| 1269 | 1269 | // Get user info from AD |
| 1270 | 1270 | // We want to isolate attribute ldap_user_attribute |
| 1271 | 1271 | $userADInfos = $connection->query() |
| 1272 | - ->where((isset($SETTINGS['ldap_user_attribute']) ===true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username) |
|
| 1272 | + ->where((isset($SETTINGS['ldap_user_attribute']) === true && empty($SETTINGS['ldap_user_attribute']) === false) ? strtolower($SETTINGS['ldap_user_attribute']) : 'distinguishedname', '=', $username) |
|
| 1273 | 1273 | ->firstOrFail(); |
| 1274 | 1274 | |
| 1275 | 1275 | } catch (\LdapRecord\Query\ObjectNotFoundException $e) { |
@@ -1295,8 +1295,7 @@ discard block |
||
| 1295 | 1295 | // User auth attempt |
| 1296 | 1296 | $userAuthAttempt = $connection->auth()->attempt( |
| 1297 | 1297 | $SETTINGS['ldap_type'] === 'ActiveDirectory' ? |
| 1298 | - $userADInfos[(isset($SETTINGS['ldap_user_dn_attribute']) === true && empty($SETTINGS['ldap_user_dn_attribute']) === false) ? $SETTINGS['ldap_user_dn_attribute'] : 'cn'][0] : |
|
| 1299 | - $userADInfos['dn'], |
|
| 1298 | + $userADInfos[(isset($SETTINGS['ldap_user_dn_attribute']) === true && empty($SETTINGS['ldap_user_dn_attribute']) === false) ? $SETTINGS['ldap_user_dn_attribute'] : 'cn'][0] : $userADInfos['dn'], |
|
| 1300 | 1299 | $passwordClear |
| 1301 | 1300 | ); |
| 1302 | 1301 | |
@@ -1346,8 +1345,7 @@ discard block |
||
| 1346 | 1345 | } |
| 1347 | 1346 | $ret = getUserADGroups( |
| 1348 | 1347 | $SETTINGS['ldap_type'] === 'ActiveDirectory' ? |
| 1349 | - $userADInfos[(isset($SETTINGS['ldap_user_dn_attribute']) === true && empty($SETTINGS['ldap_user_dn_attribute']) === false) ? $SETTINGS['ldap_user_dn_attribute'] : 'cn'][0] : |
|
| 1350 | - $userADInfos['dn'], |
|
| 1348 | + $userADInfos[(isset($SETTINGS['ldap_user_dn_attribute']) === true && empty($SETTINGS['ldap_user_dn_attribute']) === false) ? $SETTINGS['ldap_user_dn_attribute'] : 'cn'][0] : $userADInfos['dn'], |
|
| 1351 | 1349 | $connection, |
| 1352 | 1350 | $SETTINGS |
| 1353 | 1351 | ); |
@@ -1383,12 +1381,12 @@ discard block |
||
| 1383 | 1381 | if (isset($SETTINGS['enable_ad_users_with_ad_groups']) === true && (int) $SETTINGS['enable_ad_users_with_ad_groups'] === 1) { |
| 1384 | 1382 | // Get user groups from AD |
| 1385 | 1383 | $user_ad_groups = []; |
| 1386 | - foreach($groups as $group) { |
|
| 1384 | + foreach ($groups as $group) { |
|
| 1387 | 1385 | //print_r($group); |
| 1388 | 1386 | // get relation role id for AD group |
| 1389 | 1387 | $role = DB::queryFirstRow( |
| 1390 | 1388 | 'SELECT lgr.role_id |
| 1391 | - FROM ' . prefixTable('ldap_groups_roles') . ' AS lgr |
|
| 1389 | + FROM ' . prefixTable('ldap_groups_roles').' AS lgr |
|
| 1392 | 1390 | WHERE lgr.ldap_group_id = %i', |
| 1393 | 1391 | $group |
| 1394 | 1392 | ); |
@@ -1449,7 +1447,7 @@ discard block |
||
| 1449 | 1447 | ): void |
| 1450 | 1448 | { |
| 1451 | 1449 | // load passwordLib library |
| 1452 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1450 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1453 | 1451 | $pwdlib->register(); |
| 1454 | 1452 | $pwdlib = new PasswordLib\PasswordLib(); |
| 1455 | 1453 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1502,7 +1500,7 @@ discard block |
||
| 1502 | 1500 | function yubicoMFACheck($dataReceived, string $userInfo, array $SETTINGS): array |
| 1503 | 1501 | { |
| 1504 | 1502 | // Load superGlobals |
| 1505 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1503 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1506 | 1504 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1507 | 1505 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
| 1508 | 1506 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
@@ -1541,7 +1539,7 @@ discard block |
||
| 1541 | 1539 | } |
| 1542 | 1540 | |
| 1543 | 1541 | // Now check yubico validity |
| 1544 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
| 1542 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/Yubico/Yubico.php'; |
|
| 1545 | 1543 | $yubi = new Auth_Yubico($yubico_user_id, $yubico_user_key); |
| 1546 | 1544 | $auth = $yubi->verify($yubico_key); |
| 1547 | 1545 | //, null, null, null, 60 |
@@ -1582,7 +1580,7 @@ discard block |
||
| 1582 | 1580 | $userKeys = generateUserKeys($passwordClear); |
| 1583 | 1581 | |
| 1584 | 1582 | // load passwordLib library |
| 1585 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1583 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1586 | 1584 | $pwdlib->register(); |
| 1587 | 1585 | $pwdlib = new PasswordLib\PasswordLib(); |
| 1588 | 1586 | $hashedPassword = $pwdlib->createPasswordHash($passwordClear); |
@@ -1641,7 +1639,7 @@ discard block |
||
| 1641 | 1639 | ] |
| 1642 | 1640 | ); |
| 1643 | 1641 | // Rebuild tree |
| 1644 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1642 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1645 | 1643 | $tree->register(); |
| 1646 | 1644 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1647 | 1645 | $tree->rebuild(); |
@@ -1673,13 +1671,13 @@ discard block |
||
| 1673 | 1671 | && empty($dataReceived['GACode']) === false |
| 1674 | 1672 | ) { |
| 1675 | 1673 | // Load superGlobals |
| 1676 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1674 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1677 | 1675 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1678 | 1676 | $sessionAdmin = $superGlobal->get('user_admin', 'SESSION'); |
| 1679 | 1677 | $sessionUrl = $superGlobal->get('initial_url', 'SESSION'); |
| 1680 | 1678 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
| 1681 | 1679 | // load library |
| 1682 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
| 1680 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php'; |
|
| 1683 | 1681 | // create new instance |
| 1684 | 1682 | $tfa = new Authentication\TwoFactorAuth\TwoFactorAuth($SETTINGS['ga_website_name']); |
| 1685 | 1683 | // Init |
@@ -1702,7 +1700,7 @@ discard block |
||
| 1702 | 1700 | $mfaMessage = langHdl('ga_flash_qr_and_login'); |
| 1703 | 1701 | // generate new QR |
| 1704 | 1702 | $new_2fa_qr = $tfa->getQRCodeImageAsDataUri( |
| 1705 | - 'Teampass - ' . $username, |
|
| 1703 | + 'Teampass - '.$username, |
|
| 1706 | 1704 | $userInfo['ga'] |
| 1707 | 1705 | ); |
| 1708 | 1706 | // clear temporary code from DB |
@@ -1715,7 +1713,7 @@ discard block |
||
| 1715 | 1713 | $userInfo['id'] |
| 1716 | 1714 | ); |
| 1717 | 1715 | $firstTime = [ |
| 1718 | - 'value' => '<img src="' . $new_2fa_qr . '">', |
|
| 1716 | + 'value' => '<img src="'.$new_2fa_qr.'">', |
|
| 1719 | 1717 | 'user_admin' => isset($sessionAdmin) ? (int) $sessionAdmin : '', |
| 1720 | 1718 | 'initial_url' => isset($sessionUrl) === true ? $sessionUrl : '', |
| 1721 | 1719 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
@@ -1770,12 +1768,12 @@ discard block |
||
| 1770 | 1768 | ): array |
| 1771 | 1769 | { |
| 1772 | 1770 | // Load superGlobals |
| 1773 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1771 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1774 | 1772 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1775 | 1773 | |
| 1776 | 1774 | $sessionPwdAttempts = $superGlobal->get('pwd_attempts', 'SESSION'); |
| 1777 | - $saved_state = null !== $superGlobal->get('duo_state','SESSION') ? $superGlobal->get('duo_state','SESSION') : ''; |
|
| 1778 | - $duo_status = null !== $superGlobal->get('duo_status','SESSION') ? $superGlobal->get('duo_status','SESSION') : ''; |
|
| 1775 | + $saved_state = null !== $superGlobal->get('duo_state', 'SESSION') ? $superGlobal->get('duo_state', 'SESSION') : ''; |
|
| 1776 | + $duo_status = null !== $superGlobal->get('duo_status', 'SESSION') ? $superGlobal->get('duo_status', 'SESSION') : ''; |
|
| 1779 | 1777 | |
| 1780 | 1778 | // Ensure state and login are set |
| 1781 | 1779 | if ( |
@@ -1833,7 +1831,7 @@ discard block |
||
| 1833 | 1831 | ): array |
| 1834 | 1832 | { |
| 1835 | 1833 | // Load superGlobals |
| 1836 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1834 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1837 | 1835 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1838 | 1836 | |
| 1839 | 1837 | // load libraries |
@@ -1879,7 +1877,7 @@ discard block |
||
| 1879 | 1877 | }*/ |
| 1880 | 1878 | return [ |
| 1881 | 1879 | 'error' => true, |
| 1882 | - 'message' => $duo_error . langHdl('duo_error_check_config'), |
|
| 1880 | + 'message' => $duo_error.langHdl('duo_error_check_config'), |
|
| 1883 | 1881 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
| 1884 | 1882 | 'debug_message' => $e->getMessage(), |
| 1885 | 1883 | 'proceedIdentification' => false, |
@@ -1895,7 +1893,7 @@ discard block |
||
| 1895 | 1893 | } catch (Duo\DuoUniversal\DuoException $e) { |
| 1896 | 1894 | return [ |
| 1897 | 1895 | 'error' => true, |
| 1898 | - 'message' => $duo_error . langHdl('duo_error_url'), |
|
| 1896 | + 'message' => $duo_error.langHdl('duo_error_url'), |
|
| 1899 | 1897 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
| 1900 | 1898 | 'debug_message' => $e->getMessage(), |
| 1901 | 1899 | 'proceedIdentification' => false, |
@@ -1903,7 +1901,7 @@ discard block |
||
| 1903 | 1901 | } |
| 1904 | 1902 | |
| 1905 | 1903 | // Somethimes Duo return success but fail to return a URL, double check if the URL has been created |
| 1906 | - if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url,FILTER_SANITIZE_URL)) { |
|
| 1904 | + if (!empty($duo_redirect_url) && isset($duo_redirect_url) && filter_var($duo_redirect_url, FILTER_SANITIZE_URL)) { |
|
| 1907 | 1905 | // Since Duo Universal requires a redirect, let's store some info when the user get's back after completing the Duo prompt |
| 1908 | 1906 | $key = hash('sha256', $duo_state); |
| 1909 | 1907 | $iv = substr(hash('sha256', $duo_state), 0, 16); |
@@ -1929,7 +1927,7 @@ discard block |
||
| 1929 | 1927 | } else { |
| 1930 | 1928 | return [ |
| 1931 | 1929 | 'error' => true, |
| 1932 | - 'message' => $duo_error . langHdl('duo_error_url'), |
|
| 1930 | + 'message' => $duo_error.langHdl('duo_error_url'), |
|
| 1933 | 1931 | 'pwd_attempts' => (int) $sessionPwdAttempts, |
| 1934 | 1932 | 'proceedIdentification' => false, |
| 1935 | 1933 | ]; |
@@ -1950,8 +1948,8 @@ discard block |
||
| 1950 | 1948 | // return the response (which should be the user name) |
| 1951 | 1949 | if ($decoded_token['preferred_username'] === $username) { |
| 1952 | 1950 | $superGlobal->put('duo_status', 'COMPLET', 'SESSION'); |
| 1953 | - $superGlobal->forget('duo_state','SESSION'); |
|
| 1954 | - $superGlobal->forget('duo_data','SESSION'); |
|
| 1951 | + $superGlobal->forget('duo_state', 'SESSION'); |
|
| 1952 | + $superGlobal->forget('duo_data', 'SESSION'); |
|
| 1955 | 1953 | unset($superGlobal); |
| 1956 | 1954 | |
| 1957 | 1955 | return [ |
@@ -1962,9 +1960,9 @@ discard block |
||
| 1962 | 1960 | ]; |
| 1963 | 1961 | } else { |
| 1964 | 1962 | // Something wrong, username from the original Duo request is different than the one received now |
| 1965 | - $superGlobal->forget('duo_status','SESSION'); |
|
| 1966 | - $superGlobal->forget('duo_state','SESSION'); |
|
| 1967 | - $superGlobal->forget('duo_data','SESSION'); |
|
| 1963 | + $superGlobal->forget('duo_status', 'SESSION'); |
|
| 1964 | + $superGlobal->forget('duo_state', 'SESSION'); |
|
| 1965 | + $superGlobal->forget('duo_data', 'SESSION'); |
|
| 1968 | 1966 | unset($superGlobal); |
| 1969 | 1967 | |
| 1970 | 1968 | return [ |
@@ -1976,9 +1974,9 @@ discard block |
||
| 1976 | 1974 | } |
| 1977 | 1975 | } |
| 1978 | 1976 | // If we are here something wrong |
| 1979 | - $superGlobal->forget('duo_status','SESSION'); |
|
| 1980 | - $superGlobal->forget('duo_state','SESSION'); |
|
| 1981 | - $superGlobal->forget('duo_data','SESSION'); |
|
| 1977 | + $superGlobal->forget('duo_status', 'SESSION'); |
|
| 1978 | + $superGlobal->forget('duo_state', 'SESSION'); |
|
| 1979 | + $superGlobal->forget('duo_data', 'SESSION'); |
|
| 1982 | 1980 | unset($superGlobal); |
| 1983 | 1981 | return [ |
| 1984 | 1982 | 'error' => true, |
@@ -2004,8 +2002,8 @@ discard block |
||
| 2004 | 2002 | // Set to false |
| 2005 | 2003 | $userPasswordVerified = false; |
| 2006 | 2004 | // load passwordLib library |
| 2007 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2008 | - $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 2005 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2006 | + $pwdlib = new SplClassLoader('PasswordLib', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 2009 | 2007 | $pwdlib->register(); |
| 2010 | 2008 | $pwdlib = new PasswordLib\PasswordLib(); |
| 2011 | 2009 | // Check if old encryption used |
@@ -2138,8 +2136,8 @@ discard block |
||
| 2138 | 2136 | public function get_user_info($login, $enable_ad_user_auto_creation) { |
| 2139 | 2137 | $data = DB::queryFirstRow( |
| 2140 | 2138 | 'SELECT u.*, a.value AS api_key |
| 2141 | - FROM ' . prefixTable('users') . ' AS u |
|
| 2142 | - LEFT JOIN ' . prefixTable('api') . ' AS a ON (u.id = a.user_id) |
|
| 2139 | + FROM ' . prefixTable('users').' AS u |
|
| 2140 | + LEFT JOIN ' . prefixTable('api').' AS a ON (u.id = a.user_id) |
|
| 2143 | 2141 | WHERE login = %s', |
| 2144 | 2142 | $login |
| 2145 | 2143 | ); |
@@ -2240,7 +2238,7 @@ discard block |
||
| 2240 | 2238 | $checks->get_is_too_much_attempts($sessionPwdAttempts); |
| 2241 | 2239 | } catch (Exception $e) { |
| 2242 | 2240 | // Load superGlobals |
| 2243 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2241 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2244 | 2242 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2245 | 2243 | $superGlobal->put('next_possible_pwd_attempts', time() + 10, 'SESSION'); |
| 2246 | 2244 | $superGlobal->put('pwd_attempts', 0, 'SESSION'); |
@@ -2487,19 +2485,19 @@ discard block |
||
| 2487 | 2485 | if ($ret['error'] !== false) { |
| 2488 | 2486 | logEvents($SETTINGS, 'failed_auth', 'bad_duo_mfa', '', stripslashes($username), stripslashes($username)); |
| 2489 | 2487 | // Load superGlobals |
| 2490 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2488 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2491 | 2489 | # Retrieve the previously stored state and username from the session |
| 2492 | 2490 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2493 | - $superGlobal->forget('duo_state','SESSION'); |
|
| 2494 | - $superGlobal->forget('duo_data','SESSION'); |
|
| 2495 | - $superGlobal->forget('duo_status','SESSION'); |
|
| 2491 | + $superGlobal->forget('duo_state', 'SESSION'); |
|
| 2492 | + $superGlobal->forget('duo_data', 'SESSION'); |
|
| 2493 | + $superGlobal->forget('duo_status', 'SESSION'); |
|
| 2496 | 2494 | unset($superGlobal); |
| 2497 | 2495 | return [ |
| 2498 | 2496 | 'error' => true, |
| 2499 | 2497 | 'mfaData' => $ret, |
| 2500 | 2498 | 'mfaQRCodeInfos' => false, |
| 2501 | 2499 | ]; |
| 2502 | - } else if ($ret['duo_url_ready'] === true){ |
|
| 2500 | + } else if ($ret['duo_url_ready'] === true) { |
|
| 2503 | 2501 | return [ |
| 2504 | 2502 | 'error' => false, |
| 2505 | 2503 | 'mfaData' => $ret, |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | DB::debugmode(false); |
| 64 | 64 | $rows = DB::query( |
| 65 | 65 | 'SELECT * |
| 66 | - FROM ' . prefixTable('processes') . ' |
|
| 66 | + FROM ' . prefixTable('processes').' |
|
| 67 | 67 | WHERE is_in_progress = %i AND process_type = %s |
| 68 | 68 | ORDER BY increment_id ASC LIMIT 0,10', |
| 69 | 69 | 0, |
@@ -101,17 +101,17 @@ discard block |
||
| 101 | 101 | $html = []; |
| 102 | 102 | |
| 103 | 103 | // rebuild tree |
| 104 | - require_once __DIR__. '/../sources/SplClassLoader.php'; |
|
| 105 | - require_once __DIR__. '/../includes/libraries/Tree/NestedTree/NestedTree.php'; |
|
| 104 | + require_once __DIR__.'/../sources/SplClassLoader.php'; |
|
| 105 | + require_once __DIR__.'/../includes/libraries/Tree/NestedTree/NestedTree.php'; |
|
| 106 | 106 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 107 | 107 | $tree->rebuild(); |
| 108 | 108 | |
| 109 | 109 | // get current folders visible for user |
| 110 | 110 | $cache_tree = DB::queryFirstRow( |
| 111 | - 'SELECT increment_id, data FROM ' . prefixTable('cache_tree') . ' WHERE user_id = %i', |
|
| 111 | + 'SELECT increment_id, data FROM '.prefixTable('cache_tree').' WHERE user_id = %i', |
|
| 112 | 112 | $user_id |
| 113 | 113 | ); |
| 114 | - $folders = json_decode($cache_tree['data'], true);//print_r($folders); |
|
| 114 | + $folders = json_decode($cache_tree['data'], true); //print_r($folders); |
|
| 115 | 115 | foreach ($folders as $folder) { |
| 116 | 116 | $idFolder = (int) explode("li_", $folder['id'])[1]; |
| 117 | 117 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | |
| 125 | 125 | // get folder info |
| 126 | 126 | $folder = DB::queryFirstRow( |
| 127 | - 'SELECT title, parent_id, personal_folder FROM ' . prefixTable('nested_tree') . ' WHERE id = %i', |
|
| 127 | + 'SELECT title, parent_id, personal_folder FROM '.prefixTable('nested_tree').' WHERE id = %i', |
|
| 128 | 128 | $idFolder |
| 129 | 129 | ); |
| 130 | 130 | |