File: ms_users.php

package info (click to toggle)
ocsinventory-server 2.5%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,088 kB
  • sloc: php: 27,462; perl: 8,241; sh: 1,680; sql: 1,355; xml: 1,041; makefile: 34
file content (134 lines) | stat: -rwxr-xr-x 4,801 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/*
 * Copyright 2005-2016 OCSInventory-NG/OCSInventory-ocsreports contributors.
 * See the Contributors file for more details about them.
 *
 * This file is part of OCSInventory-NG/OCSInventory-ocsreports.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 2 of the License,
 * or (at your option) any later version.
 *
 * OCSInventory-NG/OCSInventory-ocsreports is distributed in the hope that it
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with OCSInventory-NG/OCSInventory-ocsreports. if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301, USA.
 */
if (AJAX) {
    parse_str($protectedPost['ocs']['0'], $params);
    $protectedPost += $params;
    ob_start();
} else {
    require_once 'views/users_views.php';
    printEnTete($l->g(1400));
    ?>
    <div class="col-md-2">
        <?php show_users_left_menu('ms_users'); ?>
    </div>
    <div class="col-md-10">
        <?php
    }

    require_once('require/function_search.php');
    require_once('require/function_users.php');

    // Définition des onglets
    $profiles = get_profile_labels();
    $data_on = $profiles;
    $data_on[4] = $l->g(244);

    if ($_SESSION['OCS']['profile']->getConfigValue('MANAGE_PROFIL') == 'YES') {
        $data_on[5] = $l->g(1146);
    }

    $form_name = "admins";
    $tab_options = $protectedPost;
    $tab_options['form_name'] = $form_name;
    echo open_form($form_name, '', '', 'form-horizontal');
    $table_name = "TAB_ACCESSLVL" . $protectedPost['onglet'];

    if ($protectedPost['onglet'] == "") {
        $protectedPost['onglet'] = current($data_on);
    }

    //suppression d'une liste de users
    if (is_defined($protectedPost['del_check'])) {
        delete_list_user($protectedPost['del_check']);
        $tab_options['CACHE'] = 'RESET';
    }

    //suppression d'un user
    if (is_defined($protectedPost['SUP_PROF'])) {
        delete_list_user($protectedPost['SUP_PROF']);
        $tab_options['CACHE'] = 'RESET';
    }

    //affichage
    $list_fields = array('ID' => 'ID',
        $l->g(1366) => 'FIRSTNAME',
        $l->g(996) => 'LASTNAME',
        $l->g(66) => 'NEW_ACCESSLVL',
        $l->g(51) => 'COMMENTS',
        $l->g(1117) => 'EMAIL',
        $l->g(607) => 'USER_GROUP',
        'SUP' => 'ID',
        'MOD_TAGS' => 'ID',
        'CHECK' => 'ID');
    $list_col_cant_del = array('ID' => 'ID', 'SUP' => 'SUP', 'CHECK' => 'CHECK', 'MOD_TAGS' => 'MOD_TAGS');
    $default_fields = array('ID' => 'ID',
        $l->g(1366) => 'FIRSTNAME',
        $l->g(996) => 'LASTNAME',
        $l->g(66) => 'NEW_ACCESSLVL',
        $l->g(51) => 'COMMENTS',
        $l->g(607) => 'USER_GROUP',
        'SUP' => 'ID',
        'MOD_TAGS' => 'ID',
        'CHECK' => 'ID');
    $queryDetails = 'SELECT ';
    foreach ($list_fields as $key => $value) {
        if ($key != 'SUP' && $key != 'CHECK' && $key != 'MOD_TAGS') {
            $queryDetails .= $value . ',';
        }
    }
    $queryDetails = substr($queryDetails, 0, -1);
    $queryDetails .= " FROM operators";
    // Tab options
    $tab_options['FILTRE'] = array('LASTNAME' => 'LASTNAME', 'ID' => 'ID', 'NEW_ACCESSLVL' => 'NEW_ACCESSLVL');
    $tab_options['LIEN_LBL'][$l->g(1366)] = 'index.php?' . PAG_INDEX . '=' . $pages_refs['ms_user_details'] . '&user_id=';
    $tab_options['LIEN_CHAMP'][$l->g(1366)] = "ID";

    // Tags edit
    $tab_options['LBL']['MOD_TAGS'] = 'Tags';
    $tab_options['NO_TRI']['MOD_TAGS'] = 1;

    $sql_user_groups = "select IVALUE,TVALUE from config where name like 'USER_GROUP_%' ";
    $res_user_groups = mysqli_query($_SESSION['OCS']["readServer"], $sql_user_groups);
    while ($val_user_groups = mysqli_fetch_array($res_user_groups)) {
        $user_groups[$val_user_groups['IVALUE']] = $val_user_groups['TVALUE'];
    }

    $tab_options['REPLACE_VALUE'][$l->g(607)] = $user_groups;
    $tab_options['LBL']['SUP'] = $l->g(122);
    $tab_options['LBL']['CHECK'] = $l->g(1119);

    $tab_options['table_name'] = $table_name;
    ajaxtab_entete_fixe($list_fields, $default_fields, $tab_options, $list_col_cant_del);
    //traitement par lot
    $img['image/delete.png'] = $l->g(162);
    del_selection($form_name);

    echo close_form();

    if (AJAX) {
        ob_end_clean();
        tab_req($list_fields, $default_fields, $list_col_cant_del, $queryDetails, $tab_options);
    } else {
        echo '</div>';
    }
    ?>