@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /* do checks */ |
| 48 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 49 | -require_once $SETTINGS['cpassman_dir'] . '/sources/checks.php'; |
|
| 48 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 49 | +require_once $SETTINGS['cpassman_dir'].'/sources/checks.php'; |
|
| 50 | 50 | $isprofileupdate = filter_input(INPUT_POST, 'isprofileupdate', FILTER_SANITIZE_STRING); |
| 51 | 51 | if ( |
| 52 | 52 | checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | || $isprofileupdate === false |
| 58 | 58 | ) { |
| 59 | 59 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
| 60 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 60 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 61 | 61 | exit(); |
| 62 | 62 | } else { |
| 63 | 63 | // Do special check to allow user to change attributes of his profile |
@@ -66,20 +66,20 @@ discard block |
||
| 66 | 66 | || checkUser($_SESSION['user_id'], $_SESSION['key'], 'profile', $SETTINGS) === false |
| 67 | 67 | ) { |
| 68 | 68 | $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page |
| 69 | - include $SETTINGS['cpassman_dir'] . '/error.php'; |
|
| 69 | + include $SETTINGS['cpassman_dir'].'/error.php'; |
|
| 70 | 70 | exit(); |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 75 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 76 | 76 | header('Content-type: text/html; charset=utf-8'); |
| 77 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 78 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 79 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 77 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 78 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 79 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 80 | 80 | |
| 81 | 81 | // Connect to mysql server |
| 82 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 82 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 83 | 83 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 84 | 84 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 85 | 85 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | // Prepare variables |
| 137 | 137 | $login = filter_var($dataReceived['login'], FILTER_SANITIZE_STRING); |
| 138 | 138 | $email = filter_var($dataReceived['email'], FILTER_SANITIZE_EMAIL); |
| 139 | - $password = '';//filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING); |
|
| 139 | + $password = ''; //filter_var($dataReceived['pw'], FILTER_SANITIZE_STRING); |
|
| 140 | 140 | $lastname = filter_var($dataReceived['lastname'], FILTER_SANITIZE_STRING); |
| 141 | 141 | $name = filter_var($dataReceived['name'], FILTER_SANITIZE_STRING); |
| 142 | 142 | $is_admin = filter_var($dataReceived['admin'], FILTER_SANITIZE_NUMBER_INT); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | // Check if user already exists |
| 166 | 166 | $data = DB::query( |
| 167 | 167 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 168 | - FROM ' . prefixTable('users') . ' |
|
| 168 | + FROM ' . prefixTable('users').' |
|
| 169 | 169 | WHERE login = %s', |
| 170 | 170 | $login |
| 171 | 171 | ); |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | |
| 388 | 388 | // Get info about user to delete |
| 389 | 389 | $data_user = DB::queryfirstrow( |
| 390 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 390 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 391 | 391 | WHERE id = %i', |
| 392 | 392 | $post_id |
| 393 | 393 | ); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | ); |
| 407 | 407 | // delete personal folder and subfolders |
| 408 | 408 | $data = DB::queryfirstrow( |
| 409 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 409 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 410 | 410 | WHERE title = %s AND personal_folder = %i', |
| 411 | 411 | $post_id, |
| 412 | 412 | '1' |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 420 | 420 | // delete items & logs |
| 421 | 421 | $items = DB::query( |
| 422 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 422 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 423 | 423 | WHERE id_tree=%i AND perso = %i', |
| 424 | 424 | $folder->id, |
| 425 | 425 | '1' |
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | // Get info about user to delete |
| 478 | 478 | $data_user = DB::queryfirstrow( |
| 479 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 479 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 480 | 480 | WHERE id = %i', |
| 481 | 481 | $post_id |
| 482 | 482 | ); |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // Get info about user to delete |
| 520 | 520 | $data_user = DB::queryfirstrow( |
| 521 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 521 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 522 | 522 | WHERE id = %i', |
| 523 | 523 | $post_id |
| 524 | 524 | ); |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | // Get info about user to delete |
| 562 | 562 | $data_user = DB::queryfirstrow( |
| 563 | 563 | 'SELECT admin, isAdministratedByRole, can_manage_all_users, gestionnaire |
| 564 | - FROM ' . prefixTable('users') . ' |
|
| 564 | + FROM ' . prefixTable('users').' |
|
| 565 | 565 | WHERE id = %i', |
| 566 | 566 | $post_id |
| 567 | 567 | ); |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | // Get info about user to delete |
| 607 | 607 | $data_user = DB::queryfirstrow( |
| 608 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 608 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 609 | 609 | WHERE id = %i', |
| 610 | 610 | $post_id |
| 611 | 611 | ); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | // Get info about user to delete |
| 649 | 649 | $data_user = DB::queryfirstrow( |
| 650 | 650 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 651 | - FROM ' . prefixTable('users') . ' |
|
| 651 | + FROM ' . prefixTable('users').' |
|
| 652 | 652 | WHERE id = %i', |
| 653 | 653 | $post_id |
| 654 | 654 | ); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | // Get info about user to delete |
| 692 | 692 | $data_user = DB::queryfirstrow( |
| 693 | 693 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 694 | - FROM ' . prefixTable('users') . ' |
|
| 694 | + FROM ' . prefixTable('users').' |
|
| 695 | 695 | WHERE id = %i', |
| 696 | 696 | $post_id |
| 697 | 697 | ); |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | // Get info about user to delete |
| 732 | 732 | $data_user = DB::queryfirstrow( |
| 733 | 733 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 734 | - FROM ' . prefixTable('users') . ' |
|
| 734 | + FROM ' . prefixTable('users').' |
|
| 735 | 735 | WHERE id = %i', |
| 736 | 736 | $post_id |
| 737 | 737 | ); |
@@ -770,7 +770,7 @@ discard block |
||
| 770 | 770 | $return = array(); |
| 771 | 771 | // Check if folder exists |
| 772 | 772 | $data = DB::query( |
| 773 | - 'SELECT * FROM ' . prefixTable('nested_tree') . ' |
|
| 773 | + 'SELECT * FROM '.prefixTable('nested_tree').' |
|
| 774 | 774 | WHERE title = %s AND parent_id = %i', |
| 775 | 775 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING), |
| 776 | 776 | '0' |
@@ -783,7 +783,7 @@ discard block |
||
| 783 | 783 | } |
| 784 | 784 | // Check if role exists |
| 785 | 785 | $data = DB::query( |
| 786 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 786 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 787 | 787 | WHERE title = %s', |
| 788 | 788 | filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_STRING) |
| 789 | 789 | ); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | case 'user_log_items': |
| 804 | 804 | $nb_pages = 1; |
| 805 | 805 | $logs = $sql_filter = ''; |
| 806 | - $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>' . langHdl('pages') . ' : </td>'; |
|
| 806 | + $pages = '<table style=\'border-top:1px solid #969696;\'><tr><td>'.langHdl('pages').' : </td>'; |
|
| 807 | 807 | |
| 808 | 808 | // Prepare POST variables |
| 809 | 809 | $post_nb_items_by_page = filter_input(INPUT_POST, 'nb_items_by_page', FILTER_SANITIZE_NUMBER_INT); |
@@ -815,14 +815,14 @@ discard block |
||
| 815 | 815 | && !empty(filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)) |
| 816 | 816 | && filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) !== 'all' |
| 817 | 817 | ) { |
| 818 | - $sql_filter = " AND l.action = '" . filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING) . "'"; |
|
| 818 | + $sql_filter = " AND l.action = '".filter_input(INPUT_POST, 'filter', FILTER_SANITIZE_STRING)."'"; |
|
| 819 | 819 | } |
| 820 | 820 | // get number of pages |
| 821 | 821 | DB::query( |
| 822 | 822 | 'SELECT * |
| 823 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 824 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
| 825 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 823 | + FROM ' . prefixTable('log_items').' as l |
|
| 824 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
| 825 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 826 | 826 | WHERE l.id_user = %i ' . $sql_filter, |
| 827 | 827 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
| 828 | 828 | ); |
@@ -840,19 +840,19 @@ discard block |
||
| 840 | 840 | // launch query |
| 841 | 841 | $rows = DB::query( |
| 842 | 842 | 'SELECT l.date as date, u.login as login, i.label as label, l.action as action |
| 843 | - FROM ' . prefixTable('log_items') . ' as l |
|
| 844 | - INNER JOIN ' . prefixTable('items') . ' as i ON (l.id_item=i.id) |
|
| 845 | - INNER JOIN ' . prefixTable('users') . ' as u ON (l.id_user=u.id) |
|
| 846 | - WHERE l.id_user = %i ' . $sql_filter . ' |
|
| 843 | + FROM ' . prefixTable('log_items').' as l |
|
| 844 | + INNER JOIN ' . prefixTable('items').' as i ON (l.id_item=i.id) |
|
| 845 | + INNER JOIN ' . prefixTable('users').' as u ON (l.id_user=u.id) |
|
| 846 | + WHERE l.id_user = %i ' . $sql_filter.' |
|
| 847 | 847 | ORDER BY date DESC |
| 848 | - LIMIT ' . intval($start) . ',' . intval($post_nb_items_by_page), |
|
| 848 | + LIMIT ' . intval($start).','.intval($post_nb_items_by_page), |
|
| 849 | 849 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
| 850 | 850 | ); |
| 851 | 851 | } else { |
| 852 | 852 | // get number of pages |
| 853 | 853 | DB::query( |
| 854 | 854 | 'SELECT * |
| 855 | - FROM ' . prefixTable('log_system') . ' |
|
| 855 | + FROM ' . prefixTable('log_system').' |
|
| 856 | 856 | WHERE type = %s AND field_1=%i', |
| 857 | 857 | 'user_mngt', |
| 858 | 858 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | // launch query |
| 872 | 872 | $rows = DB::query( |
| 873 | 873 | 'SELECT * |
| 874 | - FROM ' . prefixTable('log_system') . ' |
|
| 874 | + FROM ' . prefixTable('log_system').' |
|
| 875 | 875 | WHERE type = %s AND field_1 = %i |
| 876 | 876 | ORDER BY date DESC |
| 877 | 877 | LIMIT %i, %i', |
@@ -885,7 +885,7 @@ discard block |
||
| 885 | 885 | if (isset($counter) && $counter != 0) { |
| 886 | 886 | $nb_pages = ceil($counter / intval($post_nb_items_by_page)); |
| 887 | 887 | for ($i = 1; $i <= $nb_pages; ++$i) { |
| 888 | - $pages .= '<td onclick=\'displayLogs(' . $i . ',\"' . $post_scope . '\")\'><span style=\'cursor:pointer;' . (filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>' . $i : '\'>' . $i) . '</span></td>'; |
|
| 888 | + $pages .= '<td onclick=\'displayLogs('.$i.',\"'.$post_scope.'\")\'><span style=\'cursor:pointer;'.(filter_input(INPUT_POST, 'page', FILTER_SANITIZE_NUMBER_INT) === $i ? 'font-weight:bold;font-size:18px;\'>'.$i : '\'>'.$i).'</span></td>'; |
|
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | $pages .= '</tr></table>'; |
@@ -894,13 +894,13 @@ discard block |
||
| 894 | 894 | if ($post_scope === 'user_mngt') { |
| 895 | 895 | $user = DB::queryfirstrow( |
| 896 | 896 | 'SELECT login |
| 897 | - from ' . prefixTable('users') . ' |
|
| 897 | + from ' . prefixTable('users').' |
|
| 898 | 898 | WHERE id=%i', |
| 899 | 899 | $record['qui'] |
| 900 | 900 | ); |
| 901 | 901 | $user_1 = DB::queryfirstrow( |
| 902 | 902 | 'SELECT login |
| 903 | - from ' . prefixTable('users') . ' |
|
| 903 | + from ' . prefixTable('users').' |
|
| 904 | 904 | WHERE id=%i', |
| 905 | 905 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT) |
| 906 | 906 | ); |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | if ($tmp[0] == 'at_user_initial_pwd_changed') { |
| 911 | 911 | $label = langHdl('log_user_initial_pwd_changed'); |
| 912 | 912 | } elseif ($tmp[0] == 'at_user_email_changed') { |
| 913 | - $label = langHdl('log_user_email_changed') . $tmp[1]; |
|
| 913 | + $label = langHdl('log_user_email_changed').$tmp[1]; |
|
| 914 | 914 | } elseif ($tmp[0] == 'at_user_added') { |
| 915 | 915 | $label = langHdl('log_user_created'); |
| 916 | 916 | } elseif ($tmp[0] == 'at_user_locked') { |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | $label = langHdl('log_user_pwd_changed'); |
| 922 | 922 | } |
| 923 | 923 | // prepare log |
| 924 | - $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . $label . '</td><td align=\"center\">' . $user['login'] . '</td><td align=\"center\"></td></tr>'; |
|
| 924 | + $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.$label.'</td><td align=\"center\">'.$user['login'].'</td><td align=\"center\"></td></tr>'; |
|
| 925 | 925 | } else { |
| 926 | - $logs .= '<tr><td>' . date($SETTINGS['date_format'] . ' ' . $SETTINGS['time_format'], $record['date']) . '</td><td align=\"center\">' . str_replace('"', '\"', $record['label']) . '</td><td align=\"center\">' . $record['login'] . '</td><td align=\"center\">' . langHdl($record['action']) . '</td></tr>'; |
|
| 926 | + $logs .= '<tr><td>'.date($SETTINGS['date_format'].' '.$SETTINGS['time_format'], $record['date']).'</td><td align=\"center\">'.str_replace('"', '\"', $record['label']).'</td><td align=\"center\">'.$record['login'].'</td><td align=\"center\">'.langHdl($record['action']).'</td></tr>'; |
|
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | |
| 931 | - echo '[ { "table_logs": "' . ($logs) . '", "pages": "' . ($pages) . '", "error" : "no" } ]'; |
|
| 931 | + echo '[ { "table_logs": "'.($logs).'", "pages": "'.($pages).'", "error" : "no" } ]'; |
|
| 932 | 932 | break; |
| 933 | 933 | |
| 934 | 934 | /* |
@@ -953,14 +953,14 @@ discard block |
||
| 953 | 953 | } else { |
| 954 | 954 | // Get folder id for Admin |
| 955 | 955 | $admin_folder = DB::queryFirstRow( |
| 956 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 956 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 957 | 957 | WHERE title = %i AND personal_folder = %i', |
| 958 | 958 | intval($_SESSION['user_id']), |
| 959 | 959 | '1' |
| 960 | 960 | ); |
| 961 | 961 | // Get folder id for User |
| 962 | 962 | $user_folder = DB::queryFirstRow( |
| 963 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 963 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 964 | 964 | WHERE title=%i AND personal_folder = %i', |
| 965 | 965 | intval($user_id), |
| 966 | 966 | '1' |
@@ -970,15 +970,15 @@ discard block |
||
| 970 | 970 | // Get each Items in PF |
| 971 | 971 | $rows = DB::query( |
| 972 | 972 | 'SELECT i.pw, i.label, l.id_user |
| 973 | - FROM ' . prefixTable('items') . ' as i |
|
| 974 | - LEFT JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item=i.id) |
|
| 973 | + FROM ' . prefixTable('items').' as i |
|
| 974 | + LEFT JOIN ' . prefixTable('log_items').' as l ON (l.id_item=i.id) |
|
| 975 | 975 | WHERE l.action = %s AND i.perso=%i AND i.id_tree=%i', |
| 976 | 976 | 'at_creation', |
| 977 | 977 | '1', |
| 978 | 978 | intval($folder->id) |
| 979 | 979 | ); |
| 980 | 980 | foreach ($rows as $record) { |
| 981 | - echo $record['label'] . ' - '; |
|
| 981 | + echo $record['label'].' - '; |
|
| 982 | 982 | // Change user |
| 983 | 983 | DB::update( |
| 984 | 984 | prefixTable('log_items'), |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | // Get info about user to delete |
| 1014 | 1014 | $data_user = DB::queryfirstrow( |
| 1015 | 1015 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 1016 | - FROM ' . prefixTable('users') . ' |
|
| 1016 | + FROM ' . prefixTable('users').' |
|
| 1017 | 1017 | WHERE id = %i', |
| 1018 | 1018 | $post_user_id |
| 1019 | 1019 | ); |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | // Do |
| 1052 | 1052 | $rows = DB::query( |
| 1053 | - 'SELECT id FROM ' . prefixTable('users') . ' |
|
| 1053 | + 'SELECT id FROM '.prefixTable('users').' |
|
| 1054 | 1054 | WHERE timestamp != %s AND admin != %i', |
| 1055 | 1055 | '', |
| 1056 | 1056 | '1' |
@@ -1059,7 +1059,7 @@ discard block |
||
| 1059 | 1059 | // Get info about user to delete |
| 1060 | 1060 | $data_user = DB::queryfirstrow( |
| 1061 | 1061 | 'SELECT admin, isAdministratedByRole, gestionnaire |
| 1062 | - FROM ' . prefixTable('users') . ' |
|
| 1062 | + FROM ' . prefixTable('users').' |
|
| 1063 | 1063 | WHERE id = %i', |
| 1064 | 1064 | $record['id'] |
| 1065 | 1065 | ); |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | // Get info about user |
| 1114 | 1114 | $rowUser = DB::queryfirstrow( |
| 1115 | 1115 | 'SELECT * |
| 1116 | - FROM ' . prefixTable('users') . ' |
|
| 1116 | + FROM ' . prefixTable('users').' |
|
| 1117 | 1117 | WHERE id = %i', |
| 1118 | 1118 | $post_id |
| 1119 | 1119 | ); |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | $arrFldAllowed = array(); |
| 1132 | 1132 | |
| 1133 | 1133 | //Build tree |
| 1134 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1134 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1135 | 1135 | $tree->register(); |
| 1136 | 1136 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1137 | 1137 | |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | // array of roles for actual user |
| 1143 | 1143 | $my_functions = explode(';', $_SESSION['fonction_id']); |
| 1144 | 1144 | |
| 1145 | - $rows = DB::query('SELECT id,title,creator_id FROM ' . prefixTable('roles_title')); |
|
| 1145 | + $rows = DB::query('SELECT id,title,creator_id FROM '.prefixTable('roles_title')); |
|
| 1146 | 1146 | foreach ($rows as $record) { |
| 1147 | 1147 | if ( |
| 1148 | 1148 | (int) $_SESSION['is_admin'] === 1 |
@@ -1178,7 +1178,7 @@ discard block |
||
| 1178 | 1178 | $rolesList = array(); |
| 1179 | 1179 | $managedBy = array(); |
| 1180 | 1180 | $selected = ''; |
| 1181 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title') . ' ORDER BY title ASC'); |
|
| 1181 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title').' ORDER BY title ASC'); |
|
| 1182 | 1182 | foreach ($rows as $reccord) { |
| 1183 | 1183 | $rolesList[$reccord['id']] = array('id' => $reccord['id'], 'title' => $reccord['title']); |
| 1184 | 1184 | } |
@@ -1209,7 +1209,7 @@ discard block |
||
| 1209 | 1209 | array_push( |
| 1210 | 1210 | $managedBy, |
| 1211 | 1211 | array( |
| 1212 | - 'title' => langHdl('managers_of') . ' ' . $fonction['title'], |
|
| 1212 | + 'title' => langHdl('managers_of').' '.$fonction['title'], |
|
| 1213 | 1213 | 'id' => $fonction['id'], |
| 1214 | 1214 | 'selected' => $selected, |
| 1215 | 1215 | ) |
@@ -1291,9 +1291,9 @@ discard block |
||
| 1291 | 1291 | |
| 1292 | 1292 | // get USER STATUS |
| 1293 | 1293 | if ($rowUser['disabled'] == 1) { |
| 1294 | - $arrData['info'] = langHdl('user_info_locked') . '<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">' . langHdl('user_info_unlock_question') . '</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">' . langHdl('user_info_delete_question') . '</label>'; |
|
| 1294 | + $arrData['info'] = langHdl('user_info_locked').'<br><input type="checkbox" value="unlock" name="1" class="chk"> <label for="1">'.langHdl('user_info_unlock_question').'</label><br><input type="checkbox" value="delete" id="account_delete" class="chk mr-2" name="2" onclick="confirmDeletion()">label for="2">'.langHdl('user_info_delete_question').'</label>'; |
|
| 1295 | 1295 | } else { |
| 1296 | - $arrData['info'] = langHdl('user_info_active') . '<br><input type="checkbox" value="lock" class="chk"> ' . langHdl('user_info_lock_question'); |
|
| 1296 | + $arrData['info'] = langHdl('user_info_active').'<br><input type="checkbox" value="lock" class="chk"> '.langHdl('user_info_lock_question'); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | $arrData['error'] = false; |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | // count number of admins |
| 1388 | 1388 | $users = DB::query( |
| 1389 | 1389 | 'SELECT id |
| 1390 | - FROM ' . prefixTable('users') . ' |
|
| 1390 | + FROM ' . prefixTable('users').' |
|
| 1391 | 1391 | WHERE admin = 1 AND email != "" AND pw != ""' |
| 1392 | 1392 | ); |
| 1393 | 1393 | if (DB::count() === 1) { |
@@ -1473,7 +1473,7 @@ discard block |
||
| 1473 | 1473 | |
| 1474 | 1474 | // Get info about user to delete |
| 1475 | 1475 | $data_user = DB::queryfirstrow( |
| 1476 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 1476 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 1477 | 1477 | WHERE id = %i', |
| 1478 | 1478 | $post_id |
| 1479 | 1479 | ); |
@@ -1494,7 +1494,7 @@ discard block |
||
| 1494 | 1494 | ); |
| 1495 | 1495 | // delete personal folder and subfolders |
| 1496 | 1496 | $data = DB::queryfirstrow( |
| 1497 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' |
|
| 1497 | + 'SELECT id FROM '.prefixTable('nested_tree').' |
|
| 1498 | 1498 | WHERE title = %s AND personal_folder = %i', |
| 1499 | 1499 | $post_id, |
| 1500 | 1500 | '1' |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | DB::delete(prefixTable('nested_tree'), 'id = %i AND personal_folder = %i', $folder->id, '1'); |
| 1508 | 1508 | // delete items & logs |
| 1509 | 1509 | $items = DB::query( |
| 1510 | - 'SELECT id FROM ' . prefixTable('items') . ' |
|
| 1510 | + 'SELECT id FROM '.prefixTable('items').' |
|
| 1511 | 1511 | WHERE id_tree=%i AND perso = %i', |
| 1512 | 1512 | $folder->id, |
| 1513 | 1513 | '1' |
@@ -1528,7 +1528,7 @@ discard block |
||
| 1528 | 1528 | } else { |
| 1529 | 1529 | // Get old data about user |
| 1530 | 1530 | $oldData = DB::queryfirstrow( |
| 1531 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1531 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1532 | 1532 | WHERE id = %i', |
| 1533 | 1533 | $post_id |
| 1534 | 1534 | ); |
@@ -1558,7 +1558,7 @@ discard block |
||
| 1558 | 1558 | |
| 1559 | 1559 | // update LOG |
| 1560 | 1560 | if ($oldData['email'] !== $post_email) { |
| 1561 | - logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:' . $oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id); |
|
| 1561 | + logEvents($SETTINGS, 'user_mngt', 'at_user_email_changed:'.$oldData['email'], intval($_SESSION['user_id']), $_SESSION['login'], $post_id); |
|
| 1562 | 1562 | } |
| 1563 | 1563 | } |
| 1564 | 1564 | echo prepareExchangedData( |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | |
| 1614 | 1614 | // Get info about user to delete |
| 1615 | 1615 | $data_user = DB::queryfirstrow( |
| 1616 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 1616 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 1617 | 1617 | WHERE id = %i', |
| 1618 | 1618 | $post_id |
| 1619 | 1619 | ); |
@@ -1663,7 +1663,7 @@ discard block |
||
| 1663 | 1663 | } |
| 1664 | 1664 | |
| 1665 | 1665 | DB::queryfirstrow( |
| 1666 | - 'SELECT * FROM ' . prefixTable('users') . ' |
|
| 1666 | + 'SELECT * FROM '.prefixTable('users').' |
|
| 1667 | 1667 | WHERE login = %s', |
| 1668 | 1668 | filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING) |
| 1669 | 1669 | ); |
@@ -1712,14 +1712,14 @@ discard block |
||
| 1712 | 1712 | $arrData = array(); |
| 1713 | 1713 | |
| 1714 | 1714 | //Build tree |
| 1715 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1715 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1716 | 1716 | $tree->register(); |
| 1717 | 1717 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1718 | 1718 | |
| 1719 | 1719 | // get User info |
| 1720 | 1720 | $rowUser = DB::queryFirstRow( |
| 1721 | 1721 | 'SELECT login, name, lastname, email, disabled, fonction_id, groupes_interdits, groupes_visibles, isAdministratedByRole, avatar_thumb |
| 1722 | - FROM ' . prefixTable('users') . ' |
|
| 1722 | + FROM ' . prefixTable('users').' |
|
| 1723 | 1723 | WHERE id = %i', |
| 1724 | 1724 | $post_id |
| 1725 | 1725 | ); |
@@ -1738,7 +1738,7 @@ discard block |
||
| 1738 | 1738 | // refine folders based upon roles |
| 1739 | 1739 | $rows = DB::query( |
| 1740 | 1740 | 'SELECT folder_id, type |
| 1741 | - FROM ' . prefixTable('roles_values') . ' |
|
| 1741 | + FROM ' . prefixTable('roles_values').' |
|
| 1742 | 1742 | WHERE role_id IN %ls |
| 1743 | 1743 | ORDER BY folder_id ASC', |
| 1744 | 1744 | $arrData['functions'] |
@@ -1767,7 +1767,7 @@ discard block |
||
| 1767 | 1767 | // get folder name |
| 1768 | 1768 | $row = DB::queryFirstRow( |
| 1769 | 1769 | 'SELECT title, nlevel, id |
| 1770 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1770 | + FROM ' . prefixTable('nested_tree').' |
|
| 1771 | 1771 | WHERE id = %i', |
| 1772 | 1772 | $fld['id'] |
| 1773 | 1773 | ); |
@@ -1780,37 +1780,37 @@ discard block |
||
| 1780 | 1780 | |
| 1781 | 1781 | // manage right icon |
| 1782 | 1782 | if ($fld['type'] == 'W') { |
| 1783 | - $label = '<i class="fas fa-indent infotip text-success mr-2" title="' . langHdl('write') . '"></i>' . |
|
| 1784 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' . |
|
| 1785 | - '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>'; |
|
| 1783 | + $label = '<i class="fas fa-indent infotip text-success mr-2" title="'.langHdl('write').'"></i>'. |
|
| 1784 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'. |
|
| 1785 | + '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>'; |
|
| 1786 | 1786 | } elseif ($fld['type'] == 'ND') { |
| 1787 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
| 1788 | - '<i class="fas fa-edit infotip text-success mr-2" title="' . langHdl('edit') . '"></i>' . |
|
| 1789 | - '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>'; |
|
| 1787 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
| 1788 | + '<i class="fas fa-edit infotip text-success mr-2" title="'.langHdl('edit').'"></i>'. |
|
| 1789 | + '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>'; |
|
| 1790 | 1790 | } elseif ($fld['type'] == 'NE') { |
| 1791 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
| 1792 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' . |
|
| 1793 | - '<i class="fas fa-eraser infotip text-success" title="' . langHdl('delete') . '"></i>'; |
|
| 1791 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
| 1792 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'. |
|
| 1793 | + '<i class="fas fa-eraser infotip text-success" title="'.langHdl('delete').'"></i>'; |
|
| 1794 | 1794 | } elseif ($fld['type'] == 'NDNE') { |
| 1795 | - $label = '<i class="fas fa-indent infotip text-warning mr-2" title="' . langHdl('write') . '"></i>' . |
|
| 1796 | - '<i class="fas fa-edit infotip text-danger mr-2" title="' . langHdl('no_edit') . '"></i>' . |
|
| 1797 | - '<i class="fas fa-eraser infotip text-danger" title="' . langHdl('no_delete') . '"></i>'; |
|
| 1795 | + $label = '<i class="fas fa-indent infotip text-warning mr-2" title="'.langHdl('write').'"></i>'. |
|
| 1796 | + '<i class="fas fa-edit infotip text-danger mr-2" title="'.langHdl('no_edit').'"></i>'. |
|
| 1797 | + '<i class="fas fa-eraser infotip text-danger" title="'.langHdl('no_delete').'"></i>'; |
|
| 1798 | 1798 | } else { |
| 1799 | 1799 | $color = '#FEBC11'; |
| 1800 | 1800 | $allowed = 'R'; |
| 1801 | 1801 | $title = langHdl('read'); |
| 1802 | - $label = '<i class="fas fa-eye infotip text-info mr-2" title="' . langHdl('read') . '"></i>'; |
|
| 1802 | + $label = '<i class="fas fa-eye infotip text-info mr-2" title="'.langHdl('read').'"></i>'; |
|
| 1803 | 1803 | } |
| 1804 | 1804 | |
| 1805 | - $html .= '<tr><td>' . $ident . $row['title'] . |
|
| 1806 | - ' <small>[' . $row['id'] . ']</small></td><td>' . $label . '</td></tr>'; |
|
| 1805 | + $html .= '<tr><td>'.$ident.$row['title']. |
|
| 1806 | + ' <small>['.$row['id'].']</small></td><td>'.$label.'</td></tr>'; |
|
| 1807 | 1807 | break; |
| 1808 | 1808 | } |
| 1809 | 1809 | } |
| 1810 | 1810 | } |
| 1811 | 1811 | |
| 1812 | - $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>' . |
|
| 1813 | - $html . '</tbody></table>'; |
|
| 1812 | + $html_full = '<table id="table-folders" class="table table-bordered table-striped dt-responsive nowrap" style="width:100%"><tbody>'. |
|
| 1813 | + $html.'</tbody></table>'; |
|
| 1814 | 1814 | } else { |
| 1815 | 1815 | $html_full = ''; |
| 1816 | 1816 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | if ((int) $_SESSION['is_admin'] === 0 && (int) $_SESSION['user_can_manage_all_users'] === 0) { |
| 1857 | 1857 | $rows = DB::query( |
| 1858 | 1858 | 'SELECT * |
| 1859 | - FROM ' . prefixTable('users') . ' |
|
| 1859 | + FROM ' . prefixTable('users').' |
|
| 1860 | 1860 | WHERE admin = %i AND isAdministratedByRole IN %ls', |
| 1861 | 1861 | '0', |
| 1862 | 1862 | array_filter($_SESSION['user_roles']) |
@@ -1864,7 +1864,7 @@ discard block |
||
| 1864 | 1864 | } else { |
| 1865 | 1865 | $rows = DB::query( |
| 1866 | 1866 | 'SELECT * |
| 1867 | - FROM ' . prefixTable('users') . ' |
|
| 1867 | + FROM ' . prefixTable('users').' |
|
| 1868 | 1868 | WHERE admin = %i', |
| 1869 | 1869 | '0' |
| 1870 | 1870 | ); |
@@ -1876,7 +1876,7 @@ discard block |
||
| 1876 | 1876 | $groupIds = []; |
| 1877 | 1877 | foreach (explode(';', $record['fonction_id']) as $group) { |
| 1878 | 1878 | $tmp = DB::queryfirstrow( |
| 1879 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1879 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1880 | 1880 | WHERE id = %i', |
| 1881 | 1881 | $group |
| 1882 | 1882 | ); |
@@ -1888,7 +1888,7 @@ discard block |
||
| 1888 | 1888 | |
| 1889 | 1889 | // Get managed_by |
| 1890 | 1890 | $managedBy = DB::queryfirstrow( |
| 1891 | - 'SELECT id, title FROM ' . prefixTable('roles_title') . ' |
|
| 1891 | + 'SELECT id, title FROM '.prefixTable('roles_title').' |
|
| 1892 | 1892 | WHERE id = %i', |
| 1893 | 1893 | $record['isAdministratedByRole'] |
| 1894 | 1894 | ); |
@@ -1898,7 +1898,7 @@ discard block |
||
| 1898 | 1898 | $foldersAllowedIds = []; |
| 1899 | 1899 | foreach (explode(';', $record['groupes_visibles']) as $role) { |
| 1900 | 1900 | $tmp = DB::queryfirstrow( |
| 1901 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1901 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1902 | 1902 | WHERE id = %i', |
| 1903 | 1903 | $role |
| 1904 | 1904 | ); |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | $foldersForbiddenIds = []; |
| 1912 | 1912 | foreach (explode(';', $record['groupes_interdits']) as $role) { |
| 1913 | 1913 | $tmp = DB::queryfirstrow( |
| 1914 | - 'SELECT id, title FROM ' . prefixTable('nested_tree') . ' |
|
| 1914 | + 'SELECT id, title FROM '.prefixTable('nested_tree').' |
|
| 1915 | 1915 | WHERE id = %i', |
| 1916 | 1916 | $role |
| 1917 | 1917 | ); |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | 'login' => $record['login'], |
| 1930 | 1930 | 'groups' => implode(', ', $groups), |
| 1931 | 1931 | 'groupIds' => $groupIds, |
| 1932 | - 'managedBy' => $managedBy=== null ? langHdl('administrator') : $managedBy['title'], |
|
| 1932 | + 'managedBy' => $managedBy === null ? langHdl('administrator') : $managedBy['title'], |
|
| 1933 | 1933 | 'managedById' => $managedBy === null ? 0 : $managedBy['id'], |
| 1934 | 1934 | 'foldersAllowed' => implode(', ', $foldersAllowed), |
| 1935 | 1935 | 'foldersAllowedIds' => $foldersAllowedIds, |
@@ -2007,7 +2007,7 @@ discard block |
||
| 2007 | 2007 | |
| 2008 | 2008 | // Get info about user |
| 2009 | 2009 | $data_user = DB::queryfirstrow( |
| 2010 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 2010 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 2011 | 2011 | WHERE id = %i', |
| 2012 | 2012 | $post_source_id |
| 2013 | 2013 | ); |
@@ -2167,14 +2167,14 @@ discard block |
||
| 2167 | 2167 | if (empty($post_context) === false && $post_context = 'add_one_role_to_user') { |
| 2168 | 2168 | $data_user = DB::queryfirstrow( |
| 2169 | 2169 | 'SELECT fonction_id |
| 2170 | - FROM ' . prefixTable('users') . ' |
|
| 2170 | + FROM ' . prefixTable('users').' |
|
| 2171 | 2171 | WHERE id = %i', |
| 2172 | 2172 | $post_user_id |
| 2173 | 2173 | ); |
| 2174 | 2174 | |
| 2175 | 2175 | if ($data_user) { |
| 2176 | 2176 | // Ensure array is unique |
| 2177 | - $post_new_value = str_replace(',', ';', $data_user['fonction_id']) . ';' . $post_new_value; |
|
| 2177 | + $post_new_value = str_replace(',', ';', $data_user['fonction_id']).';'.$post_new_value; |
|
| 2178 | 2178 | $post_new_value = implode(';', array_unique(explode(';', $post_new_value))); |
| 2179 | 2179 | } else { |
| 2180 | 2180 | // User not found |
@@ -2229,7 +2229,7 @@ discard block |
||
| 2229 | 2229 | if (filter_input(INPUT_POST, 'step', FILTER_SANITIZE_STRING) === 'refresh') { |
| 2230 | 2230 | $record = DB::queryFirstRow( |
| 2231 | 2231 | 'SELECT user_ip_lastdate |
| 2232 | - FROM ' . prefixTable('users') . ' |
|
| 2232 | + FROM ' . prefixTable('users').' |
|
| 2233 | 2233 | WHERE id = %i', |
| 2234 | 2234 | $_SESSION['user_id'] |
| 2235 | 2235 | ); |
@@ -2321,38 +2321,38 @@ discard block |
||
| 2321 | 2321 | ]; |
| 2322 | 2322 | |
| 2323 | 2323 | // Load expected libraries |
| 2324 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 2325 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 2326 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
| 2327 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 2328 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Units.php'; |
|
| 2329 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Week.php'; |
|
| 2330 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 2331 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Test.php'; |
|
| 2332 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 2333 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 2334 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 2335 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 2336 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 2337 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Options.php'; |
|
| 2338 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 2339 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 2340 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 2341 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 2342 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 2343 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 2344 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 2345 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 2346 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 2347 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 2348 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Traits/Date.php'; |
|
| 2349 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 2350 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Carbon/Carbon.php'; |
|
| 2351 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 2352 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 2353 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 2354 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 2355 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 2324 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 2325 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 2326 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Symfony/contracts/Translation/TranslatorInterface.php'; |
|
| 2327 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonTimeZone.php'; |
|
| 2328 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Units.php'; |
|
| 2329 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Week.php'; |
|
| 2330 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Timestamp.php'; |
|
| 2331 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Test.php'; |
|
| 2332 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/ObjectInitialisation.php'; |
|
| 2333 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Serialization.php'; |
|
| 2334 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/IntervalRounding.php'; |
|
| 2335 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Rounding.php'; |
|
| 2336 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Localization.php'; |
|
| 2337 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Options.php'; |
|
| 2338 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Cast.php'; |
|
| 2339 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mutability.php'; |
|
| 2340 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Modifiers.php'; |
|
| 2341 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Mixin.php'; |
|
| 2342 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Macro.php'; |
|
| 2343 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Difference.php'; |
|
| 2344 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Creator.php'; |
|
| 2345 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Converter.php'; |
|
| 2346 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Comparison.php'; |
|
| 2347 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Boundaries.php'; |
|
| 2348 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Traits/Date.php'; |
|
| 2349 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/CarbonInterface.php'; |
|
| 2350 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Carbon/Carbon.php'; |
|
| 2351 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 2352 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 2353 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 2354 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 2355 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 2356 | 2356 | |
| 2357 | 2357 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 2358 | 2358 | $ad->register(); |
@@ -2368,7 +2368,7 @@ discard block |
||
| 2368 | 2368 | echo prepareExchangedData( |
| 2369 | 2369 | array( |
| 2370 | 2370 | 'error' => true, |
| 2371 | - 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(), |
|
| 2371 | + 'message' => "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(), |
|
| 2372 | 2372 | ), |
| 2373 | 2373 | 'encode' |
| 2374 | 2374 | ); |
@@ -2388,11 +2388,11 @@ discard block |
||
| 2388 | 2388 | ['objectclass', '=', 'inetorgperson'], |
| 2389 | 2389 | ])->get(); |
| 2390 | 2390 | |
| 2391 | - foreach($users as $i => $adUser) { |
|
| 2391 | + foreach ($users as $i => $adUser) { |
|
| 2392 | 2392 | //print_r($user); |
| 2393 | 2393 | |
| 2394 | 2394 | // Build the list of all groups in AD |
| 2395 | - foreach($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2395 | + foreach ($adUser['memberof'] as $j => $adUserGroup) { |
|
| 2396 | 2396 | if (empty($adUserGroup) === false) { |
| 2397 | 2397 | $adGroup = substr($adUserGroup, 3, strpos($adUserGroup, ',') - 3); |
| 2398 | 2398 | if (in_array($adGroup, $adRoles) === false && empty($adGroup) === false) { |
@@ -2407,7 +2407,7 @@ discard block |
||
| 2407 | 2407 | // Get his ID |
| 2408 | 2408 | $user = DB::queryfirstrow( |
| 2409 | 2409 | 'SELECT id, fonction_id, auth_type |
| 2410 | - FROM ' . prefixTable('users') . ' |
|
| 2410 | + FROM ' . prefixTable('users').' |
|
| 2411 | 2411 | WHERE login = %s', |
| 2412 | 2412 | $userLogin |
| 2413 | 2413 | ); |
@@ -2442,7 +2442,7 @@ discard block |
||
| 2442 | 2442 | } |
| 2443 | 2443 | |
| 2444 | 2444 | // Get all groups in Teampass |
| 2445 | - $rows = DB::query('SELECT id,title FROM ' . prefixTable('roles_title')); |
|
| 2445 | + $rows = DB::query('SELECT id,title FROM '.prefixTable('roles_title')); |
|
| 2446 | 2446 | foreach ($rows as $record) { |
| 2447 | 2447 | array_push( |
| 2448 | 2448 | $teampassRoles, |
@@ -2508,7 +2508,7 @@ discard block |
||
| 2508 | 2508 | // Check if user already exists |
| 2509 | 2509 | $data = DB::query( |
| 2510 | 2510 | 'SELECT id, fonction_id, groupes_interdits, groupes_visibles |
| 2511 | - FROM ' . prefixTable('users') . ' |
|
| 2511 | + FROM ' . prefixTable('users').' |
|
| 2512 | 2512 | WHERE login = %s', |
| 2513 | 2513 | $post_login |
| 2514 | 2514 | ); |
@@ -2612,7 +2612,7 @@ discard block |
||
| 2612 | 2612 | ); |
| 2613 | 2613 | |
| 2614 | 2614 | // Rebuild tree |
| 2615 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 2615 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 2616 | 2616 | $tree->register(); |
| 2617 | 2617 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 2618 | 2618 | $tree->rebuild(); |
@@ -2680,7 +2680,7 @@ discard block |
||
| 2680 | 2680 | // Check if user already exists |
| 2681 | 2681 | $data = DB::query( |
| 2682 | 2682 | 'SELECT id |
| 2683 | - FROM ' . prefixTable('users') . ' |
|
| 2683 | + FROM ' . prefixTable('users').' |
|
| 2684 | 2684 | WHERE id = %i', |
| 2685 | 2685 | $post_id |
| 2686 | 2686 | ); |
@@ -2756,7 +2756,7 @@ discard block |
||
| 2756 | 2756 | // Check if user already exists |
| 2757 | 2757 | $userInfo = DB::queryfirstrow( |
| 2758 | 2758 | 'SELECT id, private_key, public_key |
| 2759 | - FROM ' . prefixTable('users') . ' |
|
| 2759 | + FROM ' . prefixTable('users').' |
|
| 2760 | 2760 | WHERE id = %i', |
| 2761 | 2761 | $post_userid |
| 2762 | 2762 | ); |
@@ -2791,7 +2791,7 @@ discard block |
||
| 2791 | 2791 | if (count($_SESSION['personal_folders']) > 0) { |
| 2792 | 2792 | DB::query( |
| 2793 | 2793 | 'SELECT id |
| 2794 | - FROM ' . prefixTable('items') . ' |
|
| 2794 | + FROM ' . prefixTable('items').' |
|
| 2795 | 2795 | WHERE id_tree IN %ls', |
| 2796 | 2796 | $_SESSION['personal_folders'] |
| 2797 | 2797 | ); |
@@ -2869,7 +2869,7 @@ discard block |
||
| 2869 | 2869 | // Check if user already exists |
| 2870 | 2870 | $data = DB::query( |
| 2871 | 2871 | 'SELECT id |
| 2872 | - FROM ' . prefixTable('users') . ' |
|
| 2872 | + FROM ' . prefixTable('users').' |
|
| 2873 | 2873 | WHERE id = %i', |
| 2874 | 2874 | $post_id |
| 2875 | 2875 | ); |
@@ -2923,7 +2923,7 @@ discard block |
||
| 2923 | 2923 | |
| 2924 | 2924 | // Get info about user |
| 2925 | 2925 | $data_user = DB::queryfirstrow( |
| 2926 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 2926 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 2927 | 2927 | WHERE id = %i', |
| 2928 | 2928 | $value[1] |
| 2929 | 2929 | ); |
@@ -2956,7 +2956,7 @@ discard block |
||
| 2956 | 2956 | logEvents( |
| 2957 | 2957 | $SETTINGS, |
| 2958 | 2958 | 'user_mngt', |
| 2959 | - 'at_user_new_' . $value[0] . ':' . $value[1], |
|
| 2959 | + 'at_user_new_'.$value[0].':'.$value[1], |
|
| 2960 | 2960 | $_SESSION['user_id'], |
| 2961 | 2961 | $_SESSION['login'], |
| 2962 | 2962 | filter_input(INPUT_POST, 'id', FILTER_SANITIZE_STRING) |
@@ -2988,7 +2988,7 @@ discard block |
||
| 2988 | 2988 | |
| 2989 | 2989 | // Get info about user |
| 2990 | 2990 | $data_user = DB::queryfirstrow( |
| 2991 | - 'SELECT admin, isAdministratedByRole FROM ' . prefixTable('users') . ' |
|
| 2991 | + 'SELECT admin, isAdministratedByRole FROM '.prefixTable('users').' |
|
| 2992 | 2992 | WHERE id = %i', |
| 2993 | 2993 | $value[1] |
| 2994 | 2994 | ); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $var_dk = ''; // Derived key |
| 108 | 108 | |
| 109 | 109 | for ($block = 1; $block <= $var_kb; ++$block) { // Create key |
| 110 | - $var_ib = $var_h = hash_hmac($var_a, $var_s . pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 110 | + $var_ib = $var_h = hash_hmac($var_a, $var_s.pack('N', $block), $var_p, true); // Initial hash for this block |
|
| 111 | 111 | for ($var_i = 1; $var_i < $var_c; ++$var_i) { // Perform block iterations |
| 112 | 112 | $var_ib ^= ($var_h = hash_hmac($var_a, $var_h, $var_p, true)); // XOR each iterate |
| 113 | 113 | } |
@@ -341,25 +341,25 @@ discard block |
||
| 341 | 341 | */ |
| 342 | 342 | function cryption($message, $ascii_key, $type, $SETTINGS) |
| 343 | 343 | { |
| 344 | - $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH . '/teampass-seckey.txt') : $ascii_key; |
|
| 344 | + $ascii_key = (empty($ascii_key) === true) ? file_get_contents(SECUREPATH.'/teampass-seckey.txt') : $ascii_key; |
|
| 345 | 345 | $err = false; |
| 346 | 346 | |
| 347 | 347 | // load PhpEncryption library |
| 348 | 348 | if (isset($SETTINGS['cpassman_dir']) === false || empty($SETTINGS['cpassman_dir']) === true) { |
| 349 | 349 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 350 | 350 | } else { |
| 351 | - $path = $SETTINGS['cpassman_dir'] . '/includes/libraries/Encryption/Encryption/'; |
|
| 351 | + $path = $SETTINGS['cpassman_dir'].'/includes/libraries/Encryption/Encryption/'; |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - include_once $path . 'Crypto.php'; |
|
| 355 | - include_once $path . 'Encoding.php'; |
|
| 356 | - include_once $path . 'DerivedKeys.php'; |
|
| 357 | - include_once $path . 'Key.php'; |
|
| 358 | - include_once $path . 'KeyOrPassword.php'; |
|
| 359 | - include_once $path . 'File.php'; |
|
| 360 | - include_once $path . 'RuntimeTests.php'; |
|
| 361 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 362 | - include_once $path . 'Core.php'; |
|
| 354 | + include_once $path.'Crypto.php'; |
|
| 355 | + include_once $path.'Encoding.php'; |
|
| 356 | + include_once $path.'DerivedKeys.php'; |
|
| 357 | + include_once $path.'Key.php'; |
|
| 358 | + include_once $path.'KeyOrPassword.php'; |
|
| 359 | + include_once $path.'File.php'; |
|
| 360 | + include_once $path.'RuntimeTests.php'; |
|
| 361 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 362 | + include_once $path.'Core.php'; |
|
| 363 | 363 | |
| 364 | 364 | // convert KEY |
| 365 | 365 | $key = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
@@ -405,15 +405,15 @@ discard block |
||
| 405 | 405 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - include_once $path . 'Crypto.php'; |
|
| 409 | - include_once $path . 'Encoding.php'; |
|
| 410 | - include_once $path . 'DerivedKeys.php'; |
|
| 411 | - include_once $path . 'Key.php'; |
|
| 412 | - include_once $path . 'KeyOrPassword.php'; |
|
| 413 | - include_once $path . 'File.php'; |
|
| 414 | - include_once $path . 'RuntimeTests.php'; |
|
| 415 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 416 | - include_once $path . 'Core.php'; |
|
| 408 | + include_once $path.'Crypto.php'; |
|
| 409 | + include_once $path.'Encoding.php'; |
|
| 410 | + include_once $path.'DerivedKeys.php'; |
|
| 411 | + include_once $path.'Key.php'; |
|
| 412 | + include_once $path.'KeyOrPassword.php'; |
|
| 413 | + include_once $path.'File.php'; |
|
| 414 | + include_once $path.'RuntimeTests.php'; |
|
| 415 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 416 | + include_once $path.'Core.php'; |
|
| 417 | 417 | |
| 418 | 418 | $key = \Defuse\Crypto\Key::createNewRandomKey(); |
| 419 | 419 | $key = $key->saveToAsciiSafeString(); |
@@ -439,15 +439,15 @@ discard block |
||
| 439 | 439 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - include_once $path . 'Crypto.php'; |
|
| 443 | - include_once $path . 'Encoding.php'; |
|
| 444 | - include_once $path . 'DerivedKeys.php'; |
|
| 445 | - include_once $path . 'Key.php'; |
|
| 446 | - include_once $path . 'KeyOrPassword.php'; |
|
| 447 | - include_once $path . 'File.php'; |
|
| 448 | - include_once $path . 'RuntimeTests.php'; |
|
| 449 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 450 | - include_once $path . 'Core.php'; |
|
| 442 | + include_once $path.'Crypto.php'; |
|
| 443 | + include_once $path.'Encoding.php'; |
|
| 444 | + include_once $path.'DerivedKeys.php'; |
|
| 445 | + include_once $path.'Key.php'; |
|
| 446 | + include_once $path.'KeyOrPassword.php'; |
|
| 447 | + include_once $path.'File.php'; |
|
| 448 | + include_once $path.'RuntimeTests.php'; |
|
| 449 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 450 | + include_once $path.'Core.php'; |
|
| 451 | 451 | |
| 452 | 452 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::createRandomPasswordProtectedKey($psk); |
| 453 | 453 | $protected_key_encoded = $protected_key->saveToAsciiSafeString(); |
@@ -474,15 +474,15 @@ discard block |
||
| 474 | 474 | $path = '../includes/libraries/Encryption/Encryption/'; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - include_once $path . 'Crypto.php'; |
|
| 478 | - include_once $path . 'Encoding.php'; |
|
| 479 | - include_once $path . 'DerivedKeys.php'; |
|
| 480 | - include_once $path . 'Key.php'; |
|
| 481 | - include_once $path . 'KeyOrPassword.php'; |
|
| 482 | - include_once $path . 'File.php'; |
|
| 483 | - include_once $path . 'RuntimeTests.php'; |
|
| 484 | - include_once $path . 'KeyProtectedByPassword.php'; |
|
| 485 | - include_once $path . 'Core.php'; |
|
| 477 | + include_once $path.'Crypto.php'; |
|
| 478 | + include_once $path.'Encoding.php'; |
|
| 479 | + include_once $path.'DerivedKeys.php'; |
|
| 480 | + include_once $path.'Key.php'; |
|
| 481 | + include_once $path.'KeyOrPassword.php'; |
|
| 482 | + include_once $path.'File.php'; |
|
| 483 | + include_once $path.'RuntimeTests.php'; |
|
| 484 | + include_once $path.'KeyProtectedByPassword.php'; |
|
| 485 | + include_once $path.'Core.php'; |
|
| 486 | 486 | |
| 487 | 487 | try { |
| 488 | 488 | $protected_key = \Defuse\Crypto\KeyProtectedByPassword::loadFromAsciiSafeString($protected_key_encoded); |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | */ |
| 570 | 570 | function db_error_handler($params) |
| 571 | 571 | { |
| 572 | - echo 'Error: ' . $params['error'] . "<br>\n"; |
|
| 573 | - echo 'Query: ' . $params['query'] . "<br>\n"; |
|
| 572 | + echo 'Error: '.$params['error']."<br>\n"; |
|
| 573 | + echo 'Query: '.$params['query']."<br>\n"; |
|
| 574 | 574 | throw new Exception('Error - Query', 1); |
| 575 | 575 | } |
| 576 | 576 | |
@@ -592,14 +592,14 @@ discard block |
||
| 592 | 592 | $SETTINGS |
| 593 | 593 | ) { |
| 594 | 594 | //load ClassLoader |
| 595 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 595 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 596 | 596 | |
| 597 | 597 | // Load superglobal |
| 598 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 598 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 599 | 599 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 600 | 600 | |
| 601 | 601 | //Connect to DB |
| 602 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 602 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 603 | 603 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 604 | 604 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 605 | 605 | } |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | DB::$encoding = DB_ENCODING; |
| 612 | 612 | |
| 613 | 613 | //Build tree |
| 614 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 614 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 615 | 615 | $tree->register(); |
| 616 | 616 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 617 | 617 | |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | function identAdmin($idFonctions, $SETTINGS, $tree) |
| 654 | 654 | { |
| 655 | 655 | // Load superglobal |
| 656 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 656 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 657 | 657 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 658 | 658 | |
| 659 | 659 | // Init |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | $globalsPersonalVisibleFolders = $superGlobal->get('personal_visible_groups', 'SESSION'); |
| 676 | 676 | |
| 677 | 677 | // Get list of Folders |
| 678 | - $rows = DB::query('SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', 0); |
|
| 678 | + $rows = DB::query('SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', 0); |
|
| 679 | 679 | foreach ($rows as $record) { |
| 680 | 680 | array_push($groupesVisibles, $record['id']); |
| 681 | 681 | } |
@@ -694,7 +694,7 @@ discard block |
||
| 694 | 694 | } |
| 695 | 695 | // Get ID of personal folder |
| 696 | 696 | $persfld = DB::queryfirstrow( |
| 697 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE title = %s', |
|
| 697 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE title = %s', |
|
| 698 | 698 | $globalsUserId |
| 699 | 699 | ); |
| 700 | 700 | if (empty($persfld['id']) === false) { |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | // get complete list of ROLES |
| 716 | 716 | $tmp = explode(';', $idFonctions); |
| 717 | 717 | $rows = DB::query( |
| 718 | - 'SELECT * FROM ' . prefixTable('roles_title') . ' |
|
| 718 | + 'SELECT * FROM '.prefixTable('roles_title').' |
|
| 719 | 719 | ORDER BY title ASC' |
| 720 | 720 | ); |
| 721 | 721 | foreach ($rows as $record) { |
@@ -727,9 +727,9 @@ discard block |
||
| 727 | 727 | $superGlobal->put('is_admin', 1, 'SESSION'); |
| 728 | 728 | |
| 729 | 729 | // Check if admin has created Folders and Roles |
| 730 | - DB::query('SELECT * FROM ' . prefixTable('nested_tree') . ''); |
|
| 730 | + DB::query('SELECT * FROM '.prefixTable('nested_tree').''); |
|
| 731 | 731 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 732 | - DB::query('SELECT * FROM ' . prefixTable('roles_title')); |
|
| 732 | + DB::query('SELECT * FROM '.prefixTable('roles_title')); |
|
| 733 | 733 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 734 | 734 | } |
| 735 | 735 | |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | $tree |
| 774 | 774 | ) { |
| 775 | 775 | // Load superglobal |
| 776 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 776 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 777 | 777 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 778 | 778 | |
| 779 | 779 | // Init |
@@ -806,7 +806,7 @@ discard block |
||
| 806 | 806 | // Get list of folders depending on Roles |
| 807 | 807 | $rows = DB::query( |
| 808 | 808 | 'SELECT * |
| 809 | - FROM ' . prefixTable('roles_values') . ' |
|
| 809 | + FROM ' . prefixTable('roles_values').' |
|
| 810 | 810 | WHERE role_id IN %li AND type IN %ls', |
| 811 | 811 | $userRoles, |
| 812 | 812 | array('W', 'ND', 'NE', 'NDNE', 'R') |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | // Does this user is allowed to see other items |
| 832 | 832 | $inc = 0; |
| 833 | 833 | $rows = DB::query( |
| 834 | - 'SELECT id, id_tree FROM ' . prefixTable('items') . ' |
|
| 834 | + 'SELECT id, id_tree FROM '.prefixTable('items').' |
|
| 835 | 835 | WHERE restricted_to LIKE %ss AND inactif = %s', |
| 836 | - $globalsUserId . ';', |
|
| 836 | + $globalsUserId.';', |
|
| 837 | 837 | '0' |
| 838 | 838 | ); |
| 839 | 839 | foreach ($rows as $record) { |
@@ -847,8 +847,8 @@ discard block |
||
| 847 | 847 | // Check for the users roles if some specific rights exist on items |
| 848 | 848 | $rows = DB::query( |
| 849 | 849 | 'SELECT i.id_tree, r.item_id |
| 850 | - FROM ' . prefixTable('items') . ' as i |
|
| 851 | - INNER JOIN ' . prefixTable('restriction_to_roles') . ' as r ON (r.item_id=i.id) |
|
| 850 | + FROM ' . prefixTable('items').' as i |
|
| 851 | + INNER JOIN ' . prefixTable('restriction_to_roles').' as r ON (r.item_id=i.id) |
|
| 852 | 852 | WHERE r.role_id IN %li |
| 853 | 853 | ORDER BY i.id_tree ASC', |
| 854 | 854 | $userRoles |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | ) { |
| 870 | 870 | $persoFld = DB::queryfirstrow( |
| 871 | 871 | 'SELECT id |
| 872 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 872 | + FROM ' . prefixTable('nested_tree').' |
|
| 873 | 873 | WHERE title = %s AND personal_folder = %i', |
| 874 | 874 | $globalsUserId, |
| 875 | 875 | 1 |
@@ -903,7 +903,7 @@ discard block |
||
| 903 | 903 | } |
| 904 | 904 | $persoFlds = DB::query( |
| 905 | 905 | 'SELECT id |
| 906 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 906 | + FROM ' . prefixTable('nested_tree').' |
|
| 907 | 907 | WHERE %l', |
| 908 | 908 | $where |
| 909 | 909 | ); |
@@ -946,17 +946,17 @@ discard block |
||
| 946 | 946 | ); |
| 947 | 947 | |
| 948 | 948 | // Folders and Roles numbers |
| 949 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('nested_tree') . ''); |
|
| 949 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('nested_tree').''); |
|
| 950 | 950 | $superGlobal->put('nb_folders', DB::count(), 'SESSION'); |
| 951 | - DB::queryfirstrow('SELECT id FROM ' . prefixTable('roles_title')); |
|
| 951 | + DB::queryfirstrow('SELECT id FROM '.prefixTable('roles_title')); |
|
| 952 | 952 | $superGlobal->put('nb_roles', DB::count(), 'SESSION'); |
| 953 | 953 | |
| 954 | 954 | // check if change proposals on User's items |
| 955 | 955 | if (isset($SETTINGS['enable_suggestion']) === true && (int) $SETTINGS['enable_suggestion'] === 1) { |
| 956 | 956 | DB::query( |
| 957 | 957 | 'SELECT * |
| 958 | - FROM ' . prefixTable('items_change') . ' AS c |
|
| 959 | - LEFT JOIN ' . prefixTable('log_items') . ' AS i ON (c.item_id = i.id_item) |
|
| 958 | + FROM ' . prefixTable('items_change').' AS c |
|
| 959 | + LEFT JOIN ' . prefixTable('log_items').' AS i ON (c.item_id = i.id_item) |
|
| 960 | 960 | WHERE i.action = %s AND i.id_user = %i', |
| 961 | 961 | 'at_creation', |
| 962 | 962 | $globalsUserId |
@@ -1000,10 +1000,10 @@ discard block |
||
| 1000 | 1000 | */ |
| 1001 | 1001 | function cacheTableRefresh($SETTINGS) |
| 1002 | 1002 | { |
| 1003 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1003 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1004 | 1004 | |
| 1005 | 1005 | //Connect to DB |
| 1006 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1006 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1007 | 1007 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1008 | 1008 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1009 | 1009 | } |
@@ -1020,13 +1020,13 @@ discard block |
||
| 1020 | 1020 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 1021 | 1021 | |
| 1022 | 1022 | // truncate table |
| 1023 | - DB::query('TRUNCATE TABLE ' . prefixTable('cache')); |
|
| 1023 | + DB::query('TRUNCATE TABLE '.prefixTable('cache')); |
|
| 1024 | 1024 | |
| 1025 | 1025 | // reload date |
| 1026 | 1026 | $rows = DB::query( |
| 1027 | 1027 | 'SELECT * |
| 1028 | - FROM ' . prefixTable('items') . ' as i |
|
| 1029 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1028 | + FROM ' . prefixTable('items').' as i |
|
| 1029 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1030 | 1030 | AND l.action = %s |
| 1031 | 1031 | AND i.inactif = %i', |
| 1032 | 1032 | 'at_creation', |
@@ -1038,18 +1038,18 @@ discard block |
||
| 1038 | 1038 | $tags = ''; |
| 1039 | 1039 | $itemTags = DB::query( |
| 1040 | 1040 | 'SELECT tag |
| 1041 | - FROM ' . prefixTable('tags') . ' |
|
| 1041 | + FROM ' . prefixTable('tags').' |
|
| 1042 | 1042 | WHERE item_id = %i AND tag != ""', |
| 1043 | 1043 | $record['id'] |
| 1044 | 1044 | ); |
| 1045 | 1045 | foreach ($itemTags as $itemTag) { |
| 1046 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1046 | + $tags .= $itemTag['tag'].' '; |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | 1049 | // Get renewal period |
| 1050 | 1050 | $resNT = DB::queryfirstrow( |
| 1051 | 1051 | 'SELECT renewal_period |
| 1052 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 1052 | + FROM ' . prefixTable('nested_tree').' |
|
| 1053 | 1053 | WHERE id = %i', |
| 1054 | 1054 | $record['id_tree'] |
| 1055 | 1055 | ); |
@@ -1063,7 +1063,7 @@ discard block |
||
| 1063 | 1063 | // Is this a User id? |
| 1064 | 1064 | $user = DB::queryfirstrow( |
| 1065 | 1065 | 'SELECT id, login |
| 1066 | - FROM ' . prefixTable('users') . ' |
|
| 1066 | + FROM ' . prefixTable('users').' |
|
| 1067 | 1067 | WHERE id = %i', |
| 1068 | 1068 | $elem->title |
| 1069 | 1069 | ); |
@@ -1105,14 +1105,14 @@ discard block |
||
| 1105 | 1105 | */ |
| 1106 | 1106 | function cacheTableUpdate($SETTINGS, $ident = null) |
| 1107 | 1107 | { |
| 1108 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1108 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1109 | 1109 | |
| 1110 | 1110 | // Load superglobal |
| 1111 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1111 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1112 | 1112 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1113 | 1113 | |
| 1114 | 1114 | //Connect to DB |
| 1115 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1115 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1116 | 1116 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1117 | 1117 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1118 | 1118 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
| 1131 | 1131 | // get new value from db |
| 1132 | 1132 | $data = DB::queryfirstrow( |
| 1133 | 1133 | 'SELECT label, description, id_tree, perso, restricted_to, login, url |
| 1134 | - FROM ' . prefixTable('items') . ' |
|
| 1134 | + FROM ' . prefixTable('items').' |
|
| 1135 | 1135 | WHERE id=%i', |
| 1136 | 1136 | $ident |
| 1137 | 1137 | ); |
@@ -1139,12 +1139,12 @@ discard block |
||
| 1139 | 1139 | $tags = ''; |
| 1140 | 1140 | $itemTags = DB::query( |
| 1141 | 1141 | 'SELECT tag |
| 1142 | - FROM ' . prefixTable('tags') . ' |
|
| 1142 | + FROM ' . prefixTable('tags').' |
|
| 1143 | 1143 | WHERE item_id = %i AND tag != ""', |
| 1144 | 1144 | $ident |
| 1145 | 1145 | ); |
| 1146 | 1146 | foreach ($itemTags as $itemTag) { |
| 1147 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1147 | + $tags .= $itemTag['tag'].' '; |
|
| 1148 | 1148 | } |
| 1149 | 1149 | // form id_tree to full foldername |
| 1150 | 1150 | $folder = array(); |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | // Is this a User id? |
| 1156 | 1156 | $user = DB::queryfirstrow( |
| 1157 | 1157 | 'SELECT id, login |
| 1158 | - FROM ' . prefixTable('users') . ' |
|
| 1158 | + FROM ' . prefixTable('users').' |
|
| 1159 | 1159 | WHERE id = %i', |
| 1160 | 1160 | $elem->title |
| 1161 | 1161 | ); |
@@ -1194,17 +1194,17 @@ discard block |
||
| 1194 | 1194 | */ |
| 1195 | 1195 | function cacheTableAdd($SETTINGS, $ident = null) |
| 1196 | 1196 | { |
| 1197 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1197 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1198 | 1198 | |
| 1199 | 1199 | // Load superglobal |
| 1200 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1200 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1201 | 1201 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1202 | 1202 | |
| 1203 | 1203 | // Get superglobals |
| 1204 | 1204 | $globalsUserId = $superGlobal->get('user_id', 'SESSION'); |
| 1205 | 1205 | |
| 1206 | 1206 | //Connect to DB |
| 1207 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1207 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1208 | 1208 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1209 | 1209 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1210 | 1210 | } |
@@ -1223,8 +1223,8 @@ discard block |
||
| 1223 | 1223 | // get new value from db |
| 1224 | 1224 | $data = DB::queryFirstRow( |
| 1225 | 1225 | 'SELECT i.label, i.description, i.id_tree as id_tree, i.perso, i.restricted_to, i.id, i.login, i.url, l.date |
| 1226 | - FROM ' . prefixTable('items') . ' as i |
|
| 1227 | - INNER JOIN ' . prefixTable('log_items') . ' as l ON (l.id_item = i.id) |
|
| 1226 | + FROM ' . prefixTable('items').' as i |
|
| 1227 | + INNER JOIN ' . prefixTable('log_items').' as l ON (l.id_item = i.id) |
|
| 1228 | 1228 | WHERE i.id = %i |
| 1229 | 1229 | AND l.action = %s', |
| 1230 | 1230 | $ident, |
@@ -1234,12 +1234,12 @@ discard block |
||
| 1234 | 1234 | $tags = ''; |
| 1235 | 1235 | $itemTags = DB::query( |
| 1236 | 1236 | 'SELECT tag |
| 1237 | - FROM ' . prefixTable('tags') . ' |
|
| 1237 | + FROM ' . prefixTable('tags').' |
|
| 1238 | 1238 | WHERE item_id = %i AND tag != ""', |
| 1239 | 1239 | $ident |
| 1240 | 1240 | ); |
| 1241 | 1241 | foreach ($itemTags as $itemTag) { |
| 1242 | - $tags .= $itemTag['tag'] . ' '; |
|
| 1242 | + $tags .= $itemTag['tag'].' '; |
|
| 1243 | 1243 | } |
| 1244 | 1244 | // form id_tree to full foldername |
| 1245 | 1245 | $folder = array(); |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | // Is this a User id? |
| 1251 | 1251 | $user = DB::queryfirstrow( |
| 1252 | 1252 | 'SELECT id, login |
| 1253 | - FROM ' . prefixTable('users') . ' |
|
| 1253 | + FROM ' . prefixTable('users').' |
|
| 1254 | 1254 | WHERE id = %i', |
| 1255 | 1255 | $elem->title |
| 1256 | 1256 | ); |
@@ -1291,48 +1291,48 @@ discard block |
||
| 1291 | 1291 | function getStatisticsData($SETTINGS) |
| 1292 | 1292 | { |
| 1293 | 1293 | DB::query( |
| 1294 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1294 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1295 | 1295 | 0 |
| 1296 | 1296 | ); |
| 1297 | 1297 | $counter_folders = DB::count(); |
| 1298 | 1298 | |
| 1299 | 1299 | DB::query( |
| 1300 | - 'SELECT id FROM ' . prefixTable('nested_tree') . ' WHERE personal_folder = %i', |
|
| 1300 | + 'SELECT id FROM '.prefixTable('nested_tree').' WHERE personal_folder = %i', |
|
| 1301 | 1301 | 1 |
| 1302 | 1302 | ); |
| 1303 | 1303 | $counter_folders_perso = DB::count(); |
| 1304 | 1304 | |
| 1305 | 1305 | DB::query( |
| 1306 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1306 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1307 | 1307 | 0 |
| 1308 | 1308 | ); |
| 1309 | 1309 | $counter_items = DB::count(); |
| 1310 | 1310 | |
| 1311 | 1311 | DB::query( |
| 1312 | - 'SELECT id FROM ' . prefixTable('items') . ' WHERE perso = %i', |
|
| 1312 | + 'SELECT id FROM '.prefixTable('items').' WHERE perso = %i', |
|
| 1313 | 1313 | 1 |
| 1314 | 1314 | ); |
| 1315 | 1315 | $counter_items_perso = DB::count(); |
| 1316 | 1316 | |
| 1317 | 1317 | DB::query( |
| 1318 | - 'SELECT id FROM ' . prefixTable('users') . '' |
|
| 1318 | + 'SELECT id FROM '.prefixTable('users').'' |
|
| 1319 | 1319 | ); |
| 1320 | 1320 | $counter_users = DB::count(); |
| 1321 | 1321 | |
| 1322 | 1322 | DB::query( |
| 1323 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE admin = %i', |
|
| 1323 | + 'SELECT id FROM '.prefixTable('users').' WHERE admin = %i', |
|
| 1324 | 1324 | 1 |
| 1325 | 1325 | ); |
| 1326 | 1326 | $admins = DB::count(); |
| 1327 | 1327 | |
| 1328 | 1328 | DB::query( |
| 1329 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE gestionnaire = %i', |
|
| 1329 | + 'SELECT id FROM '.prefixTable('users').' WHERE gestionnaire = %i', |
|
| 1330 | 1330 | 1 |
| 1331 | 1331 | ); |
| 1332 | 1332 | $managers = DB::count(); |
| 1333 | 1333 | |
| 1334 | 1334 | DB::query( |
| 1335 | - 'SELECT id FROM ' . prefixTable('users') . ' WHERE read_only = %i', |
|
| 1335 | + 'SELECT id FROM '.prefixTable('users').' WHERE read_only = %i', |
|
| 1336 | 1336 | 1 |
| 1337 | 1337 | ); |
| 1338 | 1338 | $readOnly = DB::count(); |
@@ -1340,11 +1340,11 @@ discard block |
||
| 1340 | 1340 | // list the languages |
| 1341 | 1341 | $usedLang = []; |
| 1342 | 1342 | $tp_languages = DB::query( |
| 1343 | - 'SELECT name FROM ' . prefixTable('languages') |
|
| 1343 | + 'SELECT name FROM '.prefixTable('languages') |
|
| 1344 | 1344 | ); |
| 1345 | 1345 | foreach ($tp_languages as $tp_language) { |
| 1346 | 1346 | DB::query( |
| 1347 | - 'SELECT * FROM ' . prefixTable('users') . ' WHERE user_language = %s', |
|
| 1347 | + 'SELECT * FROM '.prefixTable('users').' WHERE user_language = %s', |
|
| 1348 | 1348 | $tp_language['name'] |
| 1349 | 1349 | ); |
| 1350 | 1350 | $usedLang[$tp_language['name']] = round((DB::count() * 100 / $counter_users), 0); |
@@ -1353,7 +1353,7 @@ discard block |
||
| 1353 | 1353 | // get list of ips |
| 1354 | 1354 | $usedIp = []; |
| 1355 | 1355 | $tp_ips = DB::query( |
| 1356 | - 'SELECT user_ip FROM ' . prefixTable('users') |
|
| 1356 | + 'SELECT user_ip FROM '.prefixTable('users') |
|
| 1357 | 1357 | ); |
| 1358 | 1358 | foreach ($tp_ips as $ip) { |
| 1359 | 1359 | if (array_key_exists($ip['user_ip'], $usedIp)) { |
@@ -1415,21 +1415,21 @@ discard block |
||
| 1415 | 1415 | ) { |
| 1416 | 1416 | // CAse where email not defined |
| 1417 | 1417 | if ($email === 'none' || empty($email) === true) { |
| 1418 | - return '"error":"" , "message":"' . langHdl('forgot_my_pw_email_sent') . '"'; |
|
| 1418 | + return '"error":"" , "message":"'.langHdl('forgot_my_pw_email_sent').'"'; |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | // Load settings |
| 1422 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 1422 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 1423 | 1423 | |
| 1424 | 1424 | // Load superglobal |
| 1425 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1425 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1426 | 1426 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1427 | 1427 | |
| 1428 | 1428 | // Get user language |
| 1429 | - include_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $superGlobal->get('user_language', 'SESSION') . '.php'; |
|
| 1429 | + include_once $SETTINGS['cpassman_dir'].'/includes/language/'.$superGlobal->get('user_language', 'SESSION').'.php'; |
|
| 1430 | 1430 | |
| 1431 | 1431 | // Load library |
| 1432 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1432 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1433 | 1433 | |
| 1434 | 1434 | // load PHPMailer |
| 1435 | 1435 | $mail = new SplClassLoader('PHPMailer\PHPMailer', '../includes/libraries'); |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | $mail = new PHPMailer\PHPMailer\PHPMailer(true); |
| 1438 | 1438 | try { |
| 1439 | 1439 | // send to user |
| 1440 | - $mail->setLanguage('en', $SETTINGS['cpassman_dir'] . '/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1440 | + $mail->setLanguage('en', $SETTINGS['cpassman_dir'].'/includes/libraries/PHPMailer/PHPMailer/language/'); |
|
| 1441 | 1441 | $mail->SMTPDebug = 0; //value 1 can be used to debug - 4 for debuging connections |
| 1442 | 1442 | $mail->Port = $SETTINGS['email_port']; //COULD BE USED |
| 1443 | 1443 | $mail->CharSet = 'utf-8'; |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | <table width="600" cellpadding="0" cellspacing="0" border="0" class="container" bgcolor="#ffffff" style="border-spacing: 0; border-bottom: 1px solid #e0e0e0; box-shadow: 0 0 3px #ddd; color: #434343; font-family: Helvetica, Verdana, sans-serif;"> |
| 1524 | 1524 | <tr><td class="container-padding" bgcolor="#ffffff" style="border-collapse: collapse; border-left: 1px solid #e0e0e0; background-color: #ffffff; padding-left: 30px; padding-right: 30px;"> |
| 1525 | 1525 | <br><div style="float:right;">' . |
| 1526 | - $textMail . |
|
| 1526 | + $textMail. |
|
| 1527 | 1527 | '<br><br></td></tr></table> |
| 1528 | 1528 | </td></tr></table> |
| 1529 | 1529 | <br></body></html>'; |
@@ -1536,7 +1536,7 @@ discard block |
||
| 1536 | 1536 | */ |
| 1537 | 1537 | function generateKey() |
| 1538 | 1538 | { |
| 1539 | - return substr(md5(rand() . rand()), 0, 15); |
|
| 1539 | + return substr(md5(rand().rand()), 0, 15); |
|
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | /** |
@@ -1606,7 +1606,7 @@ discard block |
||
| 1606 | 1606 | { |
| 1607 | 1607 | array_walk_recursive( |
| 1608 | 1608 | $array, |
| 1609 | - function (&$item) { |
|
| 1609 | + function(&$item) { |
|
| 1610 | 1610 | if (mb_detect_encoding($item, 'utf-8', true) === false) { |
| 1611 | 1611 | $item = utf8_encode($item); |
| 1612 | 1612 | } |
@@ -1642,7 +1642,7 @@ discard block |
||
| 1642 | 1642 | } |
| 1643 | 1643 | |
| 1644 | 1644 | // Load superglobal |
| 1645 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1645 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1646 | 1646 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1647 | 1647 | |
| 1648 | 1648 | // Get superglobals |
@@ -1654,9 +1654,9 @@ discard block |
||
| 1654 | 1654 | } |
| 1655 | 1655 | |
| 1656 | 1656 | //load ClassLoader |
| 1657 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1657 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1658 | 1658 | //Load AES |
| 1659 | - $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1659 | + $aes = new SplClassLoader('Encryption\Crypt', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1660 | 1660 | $aes->register(); |
| 1661 | 1661 | |
| 1662 | 1662 | if ($type === 'encode' && is_array($data) === true) { |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | function makeThumbnail($src, $dest, $desired_width) |
| 1712 | 1712 | { |
| 1713 | 1713 | /* read the source image */ |
| 1714 | - if(is_file($src) === true && mime_content_type($src) === 'image/png'){ |
|
| 1714 | + if (is_file($src) === true && mime_content_type($src) === 'image/png') { |
|
| 1715 | 1715 | $source_image = imagecreatefrompng($src); |
| 1716 | 1716 | if ($source_image === false) { |
| 1717 | 1717 | return "Error: Not a valid PNG file! It's type is ".mime_content_type($src); |
@@ -1748,7 +1748,7 @@ discard block |
||
| 1748 | 1748 | */ |
| 1749 | 1749 | function prefixTable($table) |
| 1750 | 1750 | { |
| 1751 | - $safeTable = htmlspecialchars(DB_PREFIX . $table); |
|
| 1751 | + $safeTable = htmlspecialchars(DB_PREFIX.$table); |
|
| 1752 | 1752 | if (!empty($safeTable)) { |
| 1753 | 1753 | // sanitize string |
| 1754 | 1754 | return $safeTable; |
@@ -1780,14 +1780,14 @@ discard block |
||
| 1780 | 1780 | $lowercase = false, |
| 1781 | 1781 | $SETTINGS |
| 1782 | 1782 | ) { |
| 1783 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 1784 | - $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1783 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 1784 | + $generator = new SplClassLoader('PasswordGenerator\Generator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1785 | 1785 | $generator->register(); |
| 1786 | 1786 | $generator = new PasswordGenerator\Generator\ComputerPasswordGenerator(); |
| 1787 | 1787 | |
| 1788 | 1788 | // Is PHP7 being used? |
| 1789 | 1789 | if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
| 1790 | - $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 1790 | + $php7generator = new SplClassLoader('PasswordGenerator\RandomGenerator', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 1791 | 1791 | $php7generator->register(); |
| 1792 | 1792 | $generator->setRandomGenerator(new PasswordGenerator\RandomGenerator\Php7RandomGenerator()); |
| 1793 | 1793 | } |
@@ -1818,7 +1818,7 @@ discard block |
||
| 1818 | 1818 | function send_syslog($message, $host, $port, $component = 'teampass') |
| 1819 | 1819 | { |
| 1820 | 1820 | $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); |
| 1821 | - $syslog_message = '<123>' . date('M d H:i:s ') . $component . ': ' . $message; |
|
| 1821 | + $syslog_message = '<123>'.date('M d H:i:s ').$component.': '.$message; |
|
| 1822 | 1822 | socket_sendto($sock, $syslog_message, strlen($syslog_message), 0, $host, $port); |
| 1823 | 1823 | socket_close($sock); |
| 1824 | 1824 | } |
@@ -1842,7 +1842,7 @@ discard block |
||
| 1842 | 1842 | } |
| 1843 | 1843 | |
| 1844 | 1844 | // include librairies & connect to DB |
| 1845 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1845 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1846 | 1846 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1847 | 1847 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1848 | 1848 | } |
@@ -1868,14 +1868,14 @@ discard block |
||
| 1868 | 1868 | if (isset($SETTINGS['syslog_enable']) === true && (int) $SETTINGS['syslog_enable'] === 1) { |
| 1869 | 1869 | if ($type === 'user_mngt') { |
| 1870 | 1870 | send_syslog( |
| 1871 | - 'action=' . str_replace('at_', '', $label) . ' attribute=user user=' . $who . ' userid="' . $login . '" change="' . $field_1 . '" ', |
|
| 1871 | + 'action='.str_replace('at_', '', $label).' attribute=user user='.$who.' userid="'.$login.'" change="'.$field_1.'" ', |
|
| 1872 | 1872 | $SETTINGS['syslog_host'], |
| 1873 | 1873 | $SETTINGS['syslog_port'], |
| 1874 | 1874 | 'teampass' |
| 1875 | 1875 | ); |
| 1876 | 1876 | } else { |
| 1877 | 1877 | send_syslog( |
| 1878 | - 'action=' . $type . ' attribute=' . $label . ' user=' . $who . ' userid="' . $login . '" ', |
|
| 1878 | + 'action='.$type.' attribute='.$label.' user='.$who.' userid="'.$login.'" ', |
|
| 1879 | 1879 | $SETTINGS['syslog_host'], |
| 1880 | 1880 | $SETTINGS['syslog_port'], |
| 1881 | 1881 | 'teampass' |
@@ -1907,7 +1907,7 @@ discard block |
||
| 1907 | 1907 | $encryption_type = null |
| 1908 | 1908 | ) { |
| 1909 | 1909 | // include librairies & connect to DB |
| 1910 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1910 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 1911 | 1911 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 1912 | 1912 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 1913 | 1913 | } |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | if (empty($item_label) === true) { |
| 1954 | 1954 | $dataItem = DB::queryfirstrow( |
| 1955 | 1955 | 'SELECT id, id_tree, label |
| 1956 | - FROM ' . prefixTable('items') . ' |
|
| 1956 | + FROM ' . prefixTable('items').' |
|
| 1957 | 1957 | WHERE id = %i', |
| 1958 | 1958 | $item_id |
| 1959 | 1959 | ); |
@@ -1962,7 +1962,7 @@ discard block |
||
| 1962 | 1962 | } |
| 1963 | 1963 | |
| 1964 | 1964 | send_syslog( |
| 1965 | - 'action=' . str_replace('at_', '', $action) . ' attribute=' . str_replace('at_', '', $attribute[0]) . ' itemno=' . $item_id . ' user=' . addslashes($login) . ' itemname="' . addslashes($item_label) . '"', |
|
| 1965 | + 'action='.str_replace('at_', '', $action).' attribute='.str_replace('at_', '', $attribute[0]).' itemno='.$item_id.' user='.addslashes($login).' itemname="'.addslashes($item_label).'"', |
|
| 1966 | 1966 | $SETTINGS['syslog_host'], |
| 1967 | 1967 | $SETTINGS['syslog_port'], |
| 1968 | 1968 | 'teampass' |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | && $action === 'at_shown' |
| 1989 | 1989 | ) { |
| 1990 | 1990 | // Load superglobal |
| 1991 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1991 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 1992 | 1992 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 1993 | 1993 | |
| 1994 | 1994 | // Get superglobals |
@@ -1999,7 +1999,7 @@ discard block |
||
| 1999 | 1999 | // Get info about item |
| 2000 | 2000 | $dataItem = DB::queryfirstrow( |
| 2001 | 2001 | 'SELECT id, id_tree, label |
| 2002 | - FROM ' . prefixTable('items') . ' |
|
| 2002 | + FROM ' . prefixTable('items').' |
|
| 2003 | 2003 | WHERE id = %i', |
| 2004 | 2004 | $item_id |
| 2005 | 2005 | ); |
@@ -2014,9 +2014,9 @@ discard block |
||
| 2014 | 2014 | 'body' => str_replace( |
| 2015 | 2015 | array('#tp_user#', '#tp_item#', '#tp_link#'), |
| 2016 | 2016 | array( |
| 2017 | - addslashes($globalsName . ' ' . $globalsLastname), |
|
| 2017 | + addslashes($globalsName.' '.$globalsLastname), |
|
| 2018 | 2018 | addslashes($item_label), |
| 2019 | - $SETTINGS['cpassman_url'] . '/index.php?page=items&group=' . $dataItem['id_tree'] . '&id=' . $item_id, |
|
| 2019 | + $SETTINGS['cpassman_url'].'/index.php?page=items&group='.$dataItem['id_tree'].'&id='.$item_id, |
|
| 2020 | 2020 | ), |
| 2021 | 2021 | langHdl('email_on_open_notification_mail') |
| 2022 | 2022 | ), |
@@ -2038,7 +2038,7 @@ discard block |
||
| 2038 | 2038 | function notifyChangesToSubscribers($item_id, $label, $changes, $SETTINGS) |
| 2039 | 2039 | { |
| 2040 | 2040 | // Load superglobal |
| 2041 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2041 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2042 | 2042 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2043 | 2043 | |
| 2044 | 2044 | // Get superglobals |
@@ -2050,8 +2050,8 @@ discard block |
||
| 2050 | 2050 | $notification = DB::queryOneColumn( |
| 2051 | 2051 | 'email', |
| 2052 | 2052 | 'SELECT * |
| 2053 | - FROM ' . prefixTable('notification') . ' AS n |
|
| 2054 | - INNER JOIN ' . prefixTable('users') . ' AS u ON (n.user_id = u.id) |
|
| 2053 | + FROM ' . prefixTable('notification').' AS n |
|
| 2054 | + INNER JOIN ' . prefixTable('users').' AS u ON (n.user_id = u.id) |
|
| 2055 | 2055 | WHERE n.item_id = %i AND n.user_id != %i', |
| 2056 | 2056 | $item_id, |
| 2057 | 2057 | $globalsUserId |
@@ -2064,7 +2064,7 @@ discard block |
||
| 2064 | 2064 | // Get list of changes |
| 2065 | 2065 | $htmlChanges = '<ul>'; |
| 2066 | 2066 | foreach ($changes as $change) { |
| 2067 | - $htmlChanges .= '<li>' . $change . '</li>'; |
|
| 2067 | + $htmlChanges .= '<li>'.$change.'</li>'; |
|
| 2068 | 2068 | } |
| 2069 | 2069 | $htmlChanges .= '</ul>'; |
| 2070 | 2070 | |
@@ -2098,7 +2098,7 @@ discard block |
||
| 2098 | 2098 | function geItemReadablePath($id_tree, $label, $SETTINGS) |
| 2099 | 2099 | { |
| 2100 | 2100 | // Class loader |
| 2101 | - include_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 2101 | + include_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 2102 | 2102 | |
| 2103 | 2103 | //Load Tree |
| 2104 | 2104 | $tree = new SplClassLoader('Tree\NestedTree', '../includes/libraries'); |
@@ -2109,15 +2109,15 @@ discard block |
||
| 2109 | 2109 | $path = ''; |
| 2110 | 2110 | foreach ($arbo as $elem) { |
| 2111 | 2111 | if (empty($path) === true) { |
| 2112 | - $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES) . ' '; |
|
| 2112 | + $path = htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES).' '; |
|
| 2113 | 2113 | } else { |
| 2114 | - $path .= '→ ' . htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2114 | + $path .= '→ '.htmlspecialchars(stripslashes(htmlspecialchars_decode($elem->title, ENT_QUOTES)), ENT_QUOTES); |
|
| 2115 | 2115 | } |
| 2116 | 2116 | } |
| 2117 | 2117 | |
| 2118 | 2118 | // Build text to show user |
| 2119 | 2119 | if (empty($label) === false) { |
| 2120 | - return empty($path) === true ? addslashes($label) : addslashes($label) . ' (' . $path . ')'; |
|
| 2120 | + return empty($path) === true ? addslashes($label) : addslashes($label).' ('.$path.')'; |
|
| 2121 | 2121 | } else { |
| 2122 | 2122 | return empty($path) === true ? '' : $path; |
| 2123 | 2123 | } |
@@ -2176,10 +2176,10 @@ discard block |
||
| 2176 | 2176 | */ |
| 2177 | 2177 | function handleConfigFile($action, $SETTINGS, $field = null, $value = null) |
| 2178 | 2178 | { |
| 2179 | - $tp_config_file = $SETTINGS['cpassman_dir'] . '/includes/config/tp.config.php'; |
|
| 2179 | + $tp_config_file = $SETTINGS['cpassman_dir'].'/includes/config/tp.config.php'; |
|
| 2180 | 2180 | |
| 2181 | 2181 | // include librairies & connect to DB |
| 2182 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2182 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2183 | 2183 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2184 | 2184 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2185 | 2185 | } |
@@ -2193,8 +2193,8 @@ discard block |
||
| 2193 | 2193 | if (file_exists($tp_config_file) === false || $action === 'rebuild') { |
| 2194 | 2194 | // perform a copy |
| 2195 | 2195 | if (file_exists($tp_config_file)) { |
| 2196 | - if (!copy($tp_config_file, $tp_config_file . '.' . date('Y_m_d_His', time()))) { |
|
| 2197 | - return "ERROR: Could not copy file '" . $tp_config_file . "'"; |
|
| 2196 | + if (!copy($tp_config_file, $tp_config_file.'.'.date('Y_m_d_His', time()))) { |
|
| 2197 | + return "ERROR: Could not copy file '".$tp_config_file."'"; |
|
| 2198 | 2198 | } |
| 2199 | 2199 | } |
| 2200 | 2200 | |
@@ -2205,11 +2205,11 @@ discard block |
||
| 2205 | 2205 | $data[1] = "global \$SETTINGS;\n"; |
| 2206 | 2206 | $data[2] = "\$SETTINGS = array (\n"; |
| 2207 | 2207 | $rows = DB::query( |
| 2208 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s', |
|
| 2208 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s', |
|
| 2209 | 2209 | 'admin' |
| 2210 | 2210 | ); |
| 2211 | 2211 | foreach ($rows as $record) { |
| 2212 | - array_push($data, " '" . $record['intitule'] . "' => '" . $record['valeur'] . "',\n"); |
|
| 2212 | + array_push($data, " '".$record['intitule']."' => '".$record['valeur']."',\n"); |
|
| 2213 | 2213 | } |
| 2214 | 2214 | array_push($data, ");\n"); |
| 2215 | 2215 | $data = array_unique($data); |
@@ -2223,15 +2223,15 @@ discard block |
||
| 2223 | 2223 | break; |
| 2224 | 2224 | } |
| 2225 | 2225 | |
| 2226 | - if (stristr($line, "'" . $field . "' => '")) { |
|
| 2227 | - $data[$inc] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n"; |
|
| 2226 | + if (stristr($line, "'".$field."' => '")) { |
|
| 2227 | + $data[$inc] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n"; |
|
| 2228 | 2228 | $bFound = true; |
| 2229 | 2229 | break; |
| 2230 | 2230 | } |
| 2231 | 2231 | ++$inc; |
| 2232 | 2232 | } |
| 2233 | 2233 | if ($bFound === false) { |
| 2234 | - $data[($inc)] = " '" . $field . "' => '" . filter_var($value, FILTER_SANITIZE_STRING) . "',\n);\n"; |
|
| 2234 | + $data[($inc)] = " '".$field."' => '".filter_var($value, FILTER_SANITIZE_STRING)."',\n);\n"; |
|
| 2235 | 2235 | } |
| 2236 | 2236 | } |
| 2237 | 2237 | |
@@ -2269,7 +2269,7 @@ discard block |
||
| 2269 | 2269 | $settings = array(); |
| 2270 | 2270 | |
| 2271 | 2271 | $rows = DB::query( |
| 2272 | - 'SELECT * FROM ' . prefixTable('misc') . ' WHERE type=%s_type OR type=%s_type2', |
|
| 2272 | + 'SELECT * FROM '.prefixTable('misc').' WHERE type=%s_type OR type=%s_type2', |
|
| 2273 | 2273 | array( |
| 2274 | 2274 | 'type' => 'admin', |
| 2275 | 2275 | 'type2' => 'settings', |
@@ -2296,7 +2296,7 @@ discard block |
||
| 2296 | 2296 | $source_cf = array(); |
| 2297 | 2297 | $rows = DB::QUERY( |
| 2298 | 2298 | 'SELECT id_category |
| 2299 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2299 | + FROM ' . prefixTable('categories_folders').' |
|
| 2300 | 2300 | WHERE id_folder = %i', |
| 2301 | 2301 | $source_id |
| 2302 | 2302 | ); |
@@ -2307,7 +2307,7 @@ discard block |
||
| 2307 | 2307 | $target_cf = array(); |
| 2308 | 2308 | $rows = DB::QUERY( |
| 2309 | 2309 | 'SELECT id_category |
| 2310 | - FROM ' . prefixTable('categories_folders') . ' |
|
| 2310 | + FROM ' . prefixTable('categories_folders').' |
|
| 2311 | 2311 | WHERE id_folder = %i', |
| 2312 | 2312 | $target_id |
| 2313 | 2313 | ); |
@@ -2342,9 +2342,9 @@ discard block |
||
| 2342 | 2342 | $password = null |
| 2343 | 2343 | ) { |
| 2344 | 2344 | // Load AntiXSS |
| 2345 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2346 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2347 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2345 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2346 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2347 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2348 | 2348 | $antiXss = new voku\helper\AntiXSS(); |
| 2349 | 2349 | |
| 2350 | 2350 | // Protect against bad inputs |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | |
| 2359 | 2359 | if (empty($password) === true || is_null($password) === true) { |
| 2360 | 2360 | // get KEY to define password |
| 2361 | - $ascii_key = file_get_contents(SECUREPATH . '/teampass-seckey.txt'); |
|
| 2361 | + $ascii_key = file_get_contents(SECUREPATH.'/teampass-seckey.txt'); |
|
| 2362 | 2362 | $password = \Defuse\Crypto\Key::loadFromAsciiSafeString($ascii_key); |
| 2363 | 2363 | } |
| 2364 | 2364 | |
@@ -2404,15 +2404,15 @@ discard block |
||
| 2404 | 2404 | ) { |
| 2405 | 2405 | // load PhpEncryption library |
| 2406 | 2406 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2407 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2408 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2409 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2410 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2411 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2412 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2413 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2414 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2415 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2407 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2408 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2409 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2410 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2411 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2412 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2413 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2414 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2415 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2416 | 2416 | |
| 2417 | 2417 | try { |
| 2418 | 2418 | \Defuse\Crypto\File::encryptFileWithPassword( |
@@ -2450,15 +2450,15 @@ discard block |
||
| 2450 | 2450 | ) { |
| 2451 | 2451 | // load PhpEncryption library |
| 2452 | 2452 | $path_to_encryption = '/includes/libraries/Encryption/Encryption/'; |
| 2453 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Crypto.php'; |
|
| 2454 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Encoding.php'; |
|
| 2455 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'DerivedKeys.php'; |
|
| 2456 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Key.php'; |
|
| 2457 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyOrPassword.php'; |
|
| 2458 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'File.php'; |
|
| 2459 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'RuntimeTests.php'; |
|
| 2460 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'KeyProtectedByPassword.php'; |
|
| 2461 | - include_once $SETTINGS['cpassman_dir'] . $path_to_encryption . 'Core.php'; |
|
| 2453 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Crypto.php'; |
|
| 2454 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Encoding.php'; |
|
| 2455 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'DerivedKeys.php'; |
|
| 2456 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Key.php'; |
|
| 2457 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyOrPassword.php'; |
|
| 2458 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'File.php'; |
|
| 2459 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'RuntimeTests.php'; |
|
| 2460 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'KeyProtectedByPassword.php'; |
|
| 2461 | + include_once $SETTINGS['cpassman_dir'].$path_to_encryption.'Core.php'; |
|
| 2462 | 2462 | |
| 2463 | 2463 | try { |
| 2464 | 2464 | \Defuse\Crypto\File::decryptFileWithPassword( |
@@ -2504,9 +2504,9 @@ discard block |
||
| 2504 | 2504 | function fileDelete($file, $SETTINGS) |
| 2505 | 2505 | { |
| 2506 | 2506 | // Load AntiXSS |
| 2507 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/ASCII.php'; |
|
| 2508 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/UTF8.php'; |
|
| 2509 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2507 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/ASCII.php'; |
|
| 2508 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/UTF8.php'; |
|
| 2509 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/voku/helper/AntiXSS.php'; |
|
| 2510 | 2510 | $antiXss = new voku\helper\AntiXSS(); |
| 2511 | 2511 | |
| 2512 | 2512 | $file = $antiXss->xss_clean($file); |
@@ -2552,7 +2552,7 @@ discard block |
||
| 2552 | 2552 | continue; |
| 2553 | 2553 | } |
| 2554 | 2554 | |
| 2555 | - $fullPath = $dir . '/' . $file; |
|
| 2555 | + $fullPath = $dir.'/'.$file; |
|
| 2556 | 2556 | |
| 2557 | 2557 | if (is_dir($fullPath)) { |
| 2558 | 2558 | if ($res = @chmod($fullPath, $dirPermissions)) { |
@@ -2582,7 +2582,7 @@ discard block |
||
| 2582 | 2582 | */ |
| 2583 | 2583 | function accessToItemIsGranted($item_id, $SETTINGS) |
| 2584 | 2584 | { |
| 2585 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2585 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 2586 | 2586 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 2587 | 2587 | |
| 2588 | 2588 | // Prepare superGlobal variables |
@@ -2592,7 +2592,7 @@ discard block |
||
| 2592 | 2592 | // Load item data |
| 2593 | 2593 | $data = DB::queryFirstRow( |
| 2594 | 2594 | 'SELECT id_tree |
| 2595 | - FROM ' . prefixTable('items') . ' |
|
| 2595 | + FROM ' . prefixTable('items').' |
|
| 2596 | 2596 | WHERE id = %i', |
| 2597 | 2597 | $item_id |
| 2598 | 2598 | ); |
@@ -2674,8 +2674,8 @@ discard block |
||
| 2674 | 2674 | function performDBQuery($SETTINGS, $fields, $table) |
| 2675 | 2675 | { |
| 2676 | 2676 | // include librairies & connect to DB |
| 2677 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 2678 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2677 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 2678 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 2679 | 2679 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 2680 | 2680 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 2681 | 2681 | } |
@@ -2688,7 +2688,7 @@ discard block |
||
| 2688 | 2688 | |
| 2689 | 2689 | // Insert log in DB |
| 2690 | 2690 | return DB::query( |
| 2691 | - 'SELECT ' . $fields . ' |
|
| 2691 | + 'SELECT '.$fields.' |
|
| 2692 | 2692 | FROM ' . prefixTable($table) |
| 2693 | 2693 | ); |
| 2694 | 2694 | } |
@@ -2703,15 +2703,15 @@ discard block |
||
| 2703 | 2703 | function formatSizeUnits($bytes) |
| 2704 | 2704 | { |
| 2705 | 2705 | if ($bytes >= 1073741824) { |
| 2706 | - $bytes = number_format($bytes / 1073741824, 2) . ' GB'; |
|
| 2706 | + $bytes = number_format($bytes / 1073741824, 2).' GB'; |
|
| 2707 | 2707 | } elseif ($bytes >= 1048576) { |
| 2708 | - $bytes = number_format($bytes / 1048576, 2) . ' MB'; |
|
| 2708 | + $bytes = number_format($bytes / 1048576, 2).' MB'; |
|
| 2709 | 2709 | } elseif ($bytes >= 1024) { |
| 2710 | - $bytes = number_format($bytes / 1024, 2) . ' KB'; |
|
| 2710 | + $bytes = number_format($bytes / 1024, 2).' KB'; |
|
| 2711 | 2711 | } elseif ($bytes > 1) { |
| 2712 | - $bytes = $bytes . ' bytes'; |
|
| 2712 | + $bytes = $bytes.' bytes'; |
|
| 2713 | 2713 | } elseif ($bytes == 1) { |
| 2714 | - $bytes = $bytes . ' byte'; |
|
| 2714 | + $bytes = $bytes.' byte'; |
|
| 2715 | 2715 | } else { |
| 2716 | 2716 | $bytes = '0 bytes'; |
| 2717 | 2717 | } |
@@ -2891,7 +2891,7 @@ discard block |
||
| 2891 | 2891 | // Decrypt |
| 2892 | 2892 | try { |
| 2893 | 2893 | $ret = base64_encode($rsa->decrypt(base64_decode($key))); |
| 2894 | - } catch(Exception $e) { |
|
| 2894 | + } catch (Exception $e) { |
|
| 2895 | 2895 | return $e; |
| 2896 | 2896 | } |
| 2897 | 2897 | |
@@ -2933,16 +2933,16 @@ discard block |
||
| 2933 | 2933 | |
| 2934 | 2934 | // Encrypt the file content |
| 2935 | 2935 | $plaintext = file_get_contents( |
| 2936 | - filter_var($fileInPath . '/' . $fileInName, FILTER_SANITIZE_URL) |
|
| 2936 | + filter_var($fileInPath.'/'.$fileInName, FILTER_SANITIZE_URL) |
|
| 2937 | 2937 | ); |
| 2938 | 2938 | |
| 2939 | 2939 | $ciphertext = $cipher->encrypt($plaintext); |
| 2940 | 2940 | |
| 2941 | 2941 | // Save new file |
| 2942 | 2942 | $hash = md5($plaintext); |
| 2943 | - $fileOut = $fileInPath . '/' . TP_FILE_PREFIX . $hash; |
|
| 2943 | + $fileOut = $fileInPath.'/'.TP_FILE_PREFIX.$hash; |
|
| 2944 | 2944 | file_put_contents($fileOut, $ciphertext); |
| 2945 | - unlink($fileInPath . '/' . $fileInName); |
|
| 2945 | + unlink($fileInPath.'/'.$fileInName); |
|
| 2946 | 2946 | |
| 2947 | 2947 | return array( |
| 2948 | 2948 | 'fileHash' => base64_encode($hash), |
@@ -2985,7 +2985,7 @@ discard block |
||
| 2985 | 2985 | $cipher->disablePadding(); |
| 2986 | 2986 | |
| 2987 | 2987 | // Get file content |
| 2988 | - $ciphertext = file_get_contents($filePath . '/' . TP_FILE_PREFIX . $fileName); |
|
| 2988 | + $ciphertext = file_get_contents($filePath.'/'.TP_FILE_PREFIX.$fileName); |
|
| 2989 | 2989 | |
| 2990 | 2990 | // Decrypt file content and return |
| 2991 | 2991 | return base64_encode($cipher->decrypt($ciphertext)); |
@@ -3041,8 +3041,8 @@ discard block |
||
| 3041 | 3041 | $SETTINGS |
| 3042 | 3042 | ) { |
| 3043 | 3043 | // include librairies & connect to DB |
| 3044 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3045 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3044 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3045 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3046 | 3046 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3047 | 3047 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3048 | 3048 | } |
@@ -3061,7 +3061,7 @@ discard block |
||
| 3061 | 3061 | ); |
| 3062 | 3062 | |
| 3063 | 3063 | // Superglobals |
| 3064 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3064 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 3065 | 3065 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 3066 | 3066 | |
| 3067 | 3067 | // Prepare superGlobal variables |
@@ -3088,8 +3088,8 @@ discard block |
||
| 3088 | 3088 | // Create sharekey for each user |
| 3089 | 3089 | $users = DB::query( |
| 3090 | 3090 | 'SELECT id, public_key |
| 3091 | - FROM ' . prefixTable('users') . ' |
|
| 3092 | - WHERE id NOT IN ("' . OTV_USER_ID . '","' . SSH_USER_ID . '","' . API_USER_ID . '") |
|
| 3091 | + FROM ' . prefixTable('users').' |
|
| 3092 | + WHERE id NOT IN ("' . OTV_USER_ID.'","'.SSH_USER_ID.'","'.API_USER_ID.'") |
|
| 3093 | 3093 | AND public_key != ""' |
| 3094 | 3094 | ); |
| 3095 | 3095 | foreach ($users as $user) { |
@@ -3190,13 +3190,13 @@ discard block |
||
| 3190 | 3190 | ]; |
| 3191 | 3191 | |
| 3192 | 3192 | // Load expected libraries |
| 3193 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3194 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3195 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3196 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Connection.php'; |
|
| 3197 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3198 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 3199 | - require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3193 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Traits/Macroable.php'; |
|
| 3194 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Tightenco/Collect/Support/Arr.php'; |
|
| 3195 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/DetectsErrors.php'; |
|
| 3196 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Connection.php'; |
|
| 3197 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapInterface.php'; |
|
| 3198 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/LdapBase.php'; |
|
| 3199 | + require_once $SETTINGS['cpassman_dir'].'/includes/libraries/LdapRecord/Ldap.php'; |
|
| 3200 | 3200 | |
| 3201 | 3201 | $ad = new SplClassLoader('LdapRecord', '../includes/libraries'); |
| 3202 | 3202 | $ad->register(); |
@@ -3209,7 +3209,7 @@ discard block |
||
| 3209 | 3209 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3210 | 3210 | $error = $e->getDetailedError(); |
| 3211 | 3211 | |
| 3212 | - echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(); |
|
| 3212 | + echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(); |
|
| 3213 | 3213 | return false; |
| 3214 | 3214 | } |
| 3215 | 3215 | |
@@ -3220,7 +3220,7 @@ discard block |
||
| 3220 | 3220 | } catch (\LdapRecord\Auth\BindException $e) { |
| 3221 | 3221 | $error = $e->getDetailedError(); |
| 3222 | 3222 | |
| 3223 | - echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage(). "<br>".$error->getDiagnosticMessage(); |
|
| 3223 | + echo "Error : ".$error->getErrorCode()." - ".$error->getErrorMessage()."<br>".$error->getDiagnosticMessage(); |
|
| 3224 | 3224 | return false; |
| 3225 | 3225 | } |
| 3226 | 3226 | |
@@ -3241,8 +3241,8 @@ discard block |
||
| 3241 | 3241 | function deleteUserObjetsKeys($userId, $SETTINGS) |
| 3242 | 3242 | { |
| 3243 | 3243 | // include librairies & connect to DB |
| 3244 | - include_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 3245 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3244 | + include_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 3245 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 3246 | 3246 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 3247 | 3247 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 3248 | 3248 | } |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | // includes |
| 43 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/include.php'; |
|
| 44 | -require_once $SETTINGS['cpassman_dir'] . '/sources/SplClassLoader.php'; |
|
| 45 | -require_once $SETTINGS['cpassman_dir'] . '/sources/main.functions.php'; |
|
| 46 | -require_once $SETTINGS['cpassman_dir'] . '/includes/language/' . $_SESSION['user_language'] . '.php'; |
|
| 47 | -require_once $SETTINGS['cpassman_dir'] . '/includes/config/settings.php'; |
|
| 43 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php'; |
|
| 44 | +require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php'; |
|
| 45 | +require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php'; |
|
| 46 | +require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$_SESSION['user_language'].'.php'; |
|
| 47 | +require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php'; |
|
| 48 | 48 | |
| 49 | 49 | // header |
| 50 | 50 | header('Content-type: text/html; charset=utf-8'); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Connect to mysql server |
| 61 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 61 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/Database/Meekrodb/db.class.php'; |
|
| 62 | 62 | if (defined('DB_PASSWD_CLEAR') === false) { |
| 63 | 63 | define('DB_PASSWD_CLEAR', defuseReturnDecrypted(DB_PASSWD, $SETTINGS)); |
| 64 | 64 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | DB::$encoding = DB_ENCODING; |
| 71 | 71 | |
| 72 | 72 | // Superglobal load |
| 73 | -require_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 73 | +require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 74 | 74 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 75 | 75 | |
| 76 | 76 | $session_user_admin = $superGlobal->get('user_admin', 'GET'); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | |
| 81 | 81 | $lastFolderChange = DB::query( |
| 82 | - 'SELECT * FROM ' . prefixTable('misc') . ' |
|
| 82 | + 'SELECT * FROM '.prefixTable('misc').' |
|
| 83 | 83 | WHERE type = %s AND intitule = %s', |
| 84 | 84 | 'timestamp', |
| 85 | 85 | 'last_folder_change' |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | || (isset($_GET['force_refresh']) === true && (int) $_GET['force_refresh'] === 1) |
| 91 | 91 | ) { |
| 92 | 92 | // Build tree |
| 93 | - $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'] . '/includes/libraries'); |
|
| 93 | + $tree = new SplClassLoader('Tree\NestedTree', $SETTINGS['cpassman_dir'].'/includes/libraries'); |
|
| 94 | 94 | $tree->register(); |
| 95 | 95 | $tree = new Tree\NestedTree\NestedTree(prefixTable('nested_tree'), 'id', 'parent_id', 'title'); |
| 96 | 96 | |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $SETTINGS |
| 190 | 190 | ) { |
| 191 | 191 | // Load library |
| 192 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 192 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 193 | 193 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 194 | 194 | |
| 195 | 195 | // Prepare superGlobal variables |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | // get count of Items in this folder |
| 244 | 244 | DB::query( |
| 245 | 245 | 'SELECT * |
| 246 | - FROM ' . prefixTable('items') . ' |
|
| 246 | + FROM ' . prefixTable('items').' |
|
| 247 | 247 | WHERE inactif=%i AND id_tree = %i', |
| 248 | 248 | 0, |
| 249 | 249 | $node->id |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // get info about current folder |
| 254 | 254 | DB::query( |
| 255 | 255 | 'SELECT * |
| 256 | - FROM ' . prefixTable('nested_tree') . ' |
|
| 256 | + FROM ' . prefixTable('nested_tree').' |
|
| 257 | 257 | WHERE parent_id = %i', |
| 258 | 258 | $node->id |
| 259 | 259 | ); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $node->title = htmlspecialchars_decode($node->title, ENT_QUOTES); |
| 267 | 267 | |
| 268 | 268 | // prepare json return for current node |
| 269 | - $parent = ($node->parent_id == 0) ? '#' : 'li_' . $node->parent_id; |
|
| 269 | + $parent = ($node->parent_id == 0) ? '#' : 'li_'.$node->parent_id; |
|
| 270 | 270 | |
| 271 | 271 | // special case for READ-ONLY folder |
| 272 | 272 | $title = ($session_user_read_only === true && !in_array($node->id, $session_personal_folders)) ? langHdl('read_only_account') : $title; |
@@ -276,35 +276,32 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | if (in_array($node->id, $session_groupes_visibles)) { |
| 278 | 278 | if (in_array($node->id, $session_read_only_folders)) { |
| 279 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 279 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 280 | 280 | $title = langHdl('read_only_account'); |
| 281 | 281 | $restricted = 1; |
| 282 | 282 | $folderClass = 'folder_not_droppable'; |
| 283 | 283 | } elseif ($session_user_read_only === true && !in_array($node->id, $session_personal_visible_groups)) { |
| 284 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 284 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 285 | 285 | } |
| 286 | 286 | $text .= |
| 287 | - ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . $itemsNb . '</span>' |
|
| 287 | + ' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.$itemsNb.'</span>' |
|
| 288 | 288 | .((isset($SETTINGS['tree_counters']) && $SETTINGS['tree_counters'] == 1) ? |
| 289 | - '<span class=\'badge badge-pill badge-light ml-1\'>'.$nbChildrenItems . '</span>'. |
|
| 290 | - '<span class=\'badge badge-pill badge-light ml-1\'>'.(count($nodeDescendants) - 1) . '</span>' : |
|
| 291 | - ''); |
|
| 289 | + '<span class=\'badge badge-pill badge-light ml-1\'>'.$nbChildrenItems.'</span>'. |
|
| 290 | + '<span class=\'badge badge-pill badge-light ml-1\'>'.(count($nodeDescendants) - 1).'</span>' : ''); |
|
| 292 | 291 | } elseif (in_array($node->id, $listFoldersLimitedKeys)) { |
| 293 | 292 | $restricted = '1'; |
| 294 | 293 | $text .= |
| 295 | 294 | session_user_read_only === true ? |
| 296 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
| 297 | - '' |
|
| 298 | - .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . count($session_list_folders_limited[$node->id]) . '</span>'; |
|
| 295 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '' |
|
| 296 | + .' <span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.count($session_list_folders_limited[$node->id]).'</span>'; |
|
| 299 | 297 | } elseif (in_array($node->id, $listRestrictedFoldersForItemsKeys)) { |
| 300 | 298 | $restricted = '1'; |
| 301 | 299 | if ($session_user_read_only === true) { |
| 302 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 300 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 303 | 301 | } |
| 304 | 302 | $text .= $session_user_read_only === true ? |
| 305 | - "<i class='far fa-eye fa-xs mr-1'></i>" : |
|
| 306 | - '' |
|
| 307 | - . ' (<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_' . $node->id . '\'>' . count($session_list_restricted_folders_for_items[$node->id]) . '</span>'; |
|
| 303 | + "<i class='far fa-eye fa-xs mr-1'></i>" : '' |
|
| 304 | + . ' (<span class=\'badge badge-danger ml-2 items_count\' id=\'itcount_'.$node->id.'\'>'.count($session_list_restricted_folders_for_items[$node->id]).'</span>'; |
|
| 308 | 305 | } else { |
| 309 | 306 | $restricted = '1'; |
| 310 | 307 | $folderClass = 'folder_not_droppable'; |
@@ -330,18 +327,18 @@ discard block |
||
| 330 | 327 | array_push( |
| 331 | 328 | $ret_json, |
| 332 | 329 | array( |
| 333 | - 'id' => 'li_' . $node->id, |
|
| 330 | + 'id' => 'li_'.$node->id, |
|
| 334 | 331 | 'parent' => $parent, |
| 335 | 332 | 'text' => $text, |
| 336 | 333 | 'children' => $childrenNb == 0 ? false : true, |
| 337 | 334 | 'li_attr' => array( |
| 338 | 335 | 'class' => 'jstreeopen', |
| 339 | - 'title' => 'ID [' . $node->id . '] ' . $title, |
|
| 336 | + 'title' => 'ID ['.$node->id.'] '.$title, |
|
| 340 | 337 | ), |
| 341 | 338 | 'a_attr' => array( |
| 342 | - 'id' => 'fld_' . $node->id, |
|
| 339 | + 'id' => 'fld_'.$node->id, |
|
| 343 | 340 | 'class' => $folderClass, |
| 344 | - 'onclick' => 'ListerItems(' . $node->id . ', ' . $restricted . ', 0, 1)', |
|
| 341 | + 'onclick' => 'ListerItems('.$node->id.', '.$restricted.', 0, 1)', |
|
| 345 | 342 | 'data-title' => $node->title, |
| 346 | 343 | ), |
| 347 | 344 | ) |
@@ -350,13 +347,13 @@ discard block |
||
| 350 | 347 | array_push( |
| 351 | 348 | $ret_json, |
| 352 | 349 | array( |
| 353 | - 'id' => 'li_' . $node->id, |
|
| 350 | + 'id' => 'li_'.$node->id, |
|
| 354 | 351 | 'parent' => $parent, |
| 355 | 352 | 'children' => $childrenNb == 0 ? false : true, |
| 356 | - 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text, |
|
| 353 | + 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text, |
|
| 357 | 354 | 'li_attr' => array( |
| 358 | 355 | 'class' => '', |
| 359 | - 'title' => 'ID [' . $node->id . '] ' . langHdl('no_access'), |
|
| 356 | + 'title' => 'ID ['.$node->id.'] '.langHdl('no_access'), |
|
| 360 | 357 | ), |
| 361 | 358 | ) |
| 362 | 359 | ); |
@@ -408,7 +405,7 @@ discard block |
||
| 408 | 405 | } |
| 409 | 406 | |
| 410 | 407 | // Load library |
| 411 | - include_once $SETTINGS['cpassman_dir'] . '/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 408 | + include_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php'; |
|
| 412 | 409 | $superGlobal = new protect\SuperGlobal\SuperGlobal(); |
| 413 | 410 | |
| 414 | 411 | // Prepare superGlobal variables |
@@ -445,7 +442,7 @@ discard block |
||
| 445 | 442 | ) === true |
| 446 | 443 | ) { |
| 447 | 444 | DB::query( |
| 448 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 445 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 449 | 446 | WHERE inactif=%i AND id_tree = %i', |
| 450 | 447 | 0, |
| 451 | 448 | $node |
@@ -475,7 +472,7 @@ discard block |
||
| 475 | 472 | if ($displayThisNode === true) { |
| 476 | 473 | // get info about current folder |
| 477 | 474 | DB::query( |
| 478 | - 'SELECT * FROM ' . prefixTable('items') . ' |
|
| 475 | + 'SELECT * FROM '.prefixTable('items').' |
|
| 479 | 476 | WHERE inactif=%i AND id_tree = %i', |
| 480 | 477 | 0, |
| 481 | 478 | $completTree[$nodeId]->id |
@@ -503,7 +500,7 @@ discard block |
||
| 503 | 500 | |
| 504 | 501 | if (in_array($completTree[$nodeId]->id, $session_groupes_visibles) === true) { |
| 505 | 502 | if (in_array($completTree[$nodeId]->id, $session_read_only_folders) === true) { |
| 506 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 503 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 507 | 504 | $title = langHdl('read_only_account'); |
| 508 | 505 | $restricted = 1; |
| 509 | 506 | $folderClass = 'folder_not_droppable'; |
@@ -511,26 +508,25 @@ discard block |
||
| 511 | 508 | $session_user_read_only === true |
| 512 | 509 | && in_array($completTree[$nodeId]->id, $session_personal_visible_groups) === false |
| 513 | 510 | ) { |
| 514 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 511 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 515 | 512 | } |
| 516 | 513 | $text .= |
| 517 | - '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . $itemsNb . '</span>'. |
|
| 514 | + '<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.$itemsNb.'</span>'. |
|
| 518 | 515 | ((isset($SETTINGS['tree_counters']) === true && (int) $SETTINGS['tree_counters'] === 1) ? |
| 519 | - '<span class=\'badge badge-pill badge-light ml-1\'>'.$nbChildrenItems . '</span>'. |
|
| 520 | - '<span class=\'badge badge-pill badge-light ml-1\'>'.(count($nodeDescendants) - 1) . '</span>' : |
|
| 521 | - ''); |
|
| 516 | + '<span class=\'badge badge-pill badge-light ml-1\'>'.$nbChildrenItems.'</span>'. |
|
| 517 | + '<span class=\'badge badge-pill badge-light ml-1\'>'.(count($nodeDescendants) - 1).'</span>' : ''); |
|
| 522 | 518 | } elseif (in_array($completTree[$nodeId]->id, $listFoldersLimitedKeys) === true) { |
| 523 | 519 | $restricted = '1'; |
| 524 | 520 | if ($session_user_read_only === true) { |
| 525 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 521 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 526 | 522 | } |
| 527 | - $text .= ' (<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . count($session_list_folders_limited[$completTree[$nodeId]->id]) . '</span>)'; |
|
| 523 | + $text .= ' (<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.count($session_list_folders_limited[$completTree[$nodeId]->id]).'</span>)'; |
|
| 528 | 524 | } elseif (in_array($completTree[$nodeId]->id, $listRestrictedFoldersForItemsKeys) === true) { |
| 529 | 525 | $restricted = '1'; |
| 530 | 526 | if ($session_user_read_only === true) { |
| 531 | - $text = "<i class='far fa-eye fa-xs mr-1'></i>" . $text; |
|
| 527 | + $text = "<i class='far fa-eye fa-xs mr-1'></i>".$text; |
|
| 532 | 528 | } |
| 533 | - $text .= ' (<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_' . $completTree[$nodeId]->id . '\'>' . count($session_list_restricted_folders_for_items[$completTree[$nodeId]->id]) . '</span>)'; |
|
| 529 | + $text .= ' (<span class=\'badge badge-pill badge-light ml-2 items_count\' id=\'itcount_'.$completTree[$nodeId]->id.'\'>'.count($session_list_restricted_folders_for_items[$completTree[$nodeId]->id]).'</span>)'; |
|
| 534 | 530 | } else { |
| 535 | 531 | $restricted = '1'; |
| 536 | 532 | $folderClass = 'folder_not_droppable'; |
@@ -567,7 +563,7 @@ discard block |
||
| 567 | 563 | } |
| 568 | 564 | |
| 569 | 565 | // prepare json return for current node |
| 570 | - $parent = ($completTree[$nodeId]->parent_id === '0') ? '#' : 'li_' . $completTree[$nodeId]->parent_id; |
|
| 566 | + $parent = ($completTree[$nodeId]->parent_id === '0') ? '#' : 'li_'.$completTree[$nodeId]->parent_id; |
|
| 571 | 567 | |
| 572 | 568 | // handle displaying |
| 573 | 569 | if ( |
@@ -587,17 +583,17 @@ discard block |
||
| 587 | 583 | array_push( |
| 588 | 584 | $ret_json, |
| 589 | 585 | array( |
| 590 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
| 586 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
| 591 | 587 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
| 592 | 588 | 'text' => $text, |
| 593 | 589 | 'li_attr' => array( |
| 594 | 590 | 'class' => 'jstreeopen', |
| 595 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . $title, |
|
| 591 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.$title, |
|
| 596 | 592 | ), |
| 597 | 593 | 'a_attr' => array( |
| 598 | - 'id' => 'fld_' . $completTree[$nodeId]->id, |
|
| 594 | + 'id' => 'fld_'.$completTree[$nodeId]->id, |
|
| 599 | 595 | 'class' => $folderClass, |
| 600 | - 'onclick' => 'ListerItems(' . $completTree[$nodeId]->id . ', ' . $restricted . ', 0, 1)', |
|
| 596 | + 'onclick' => 'ListerItems('.$completTree[$nodeId]->id.', '.$restricted.', 0, 1)', |
|
| 601 | 597 | 'data-title' => $completTree[$nodeId]->title, |
| 602 | 598 | ), |
| 603 | 599 | ) |
@@ -606,12 +602,12 @@ discard block |
||
| 606 | 602 | array_push( |
| 607 | 603 | $ret_json, |
| 608 | 604 | array( |
| 609 | - 'id' => 'li_' . $completTree[$nodeId]->id, |
|
| 605 | + 'id' => 'li_'.$completTree[$nodeId]->id, |
|
| 610 | 606 | 'parent' => $last_visible_parent === -1 ? $parent : $last_visible_parent, |
| 611 | - 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>' . $text, |
|
| 607 | + 'text' => '<i class="fas fa-times fa-xs text-danger mr-1"></i>'.$text, |
|
| 612 | 608 | 'li_attr' => array( |
| 613 | 609 | 'class' => '', |
| 614 | - 'title' => 'ID [' . $completTree[$nodeId]->id . '] ' . langHdl('no_access'), |
|
| 610 | + 'title' => 'ID ['.$completTree[$nodeId]->id.'] '.langHdl('no_access'), |
|
| 615 | 611 | ), |
| 616 | 612 | ) |
| 617 | 613 | ); |