Passed
Push — development ( feba21...8daacf )
by Nils
03:17
created

items.php (4 issues)

1
<?php
2
/**
3
 *
4
 * @package       items.php
5
 * @author        Nils Laumaillé <[email protected]>
6
 * @version       2.1.27
7
 * @copyright     2009-2018 Nils Laumaillé
8
 * @license       GNU GPL-3.0
9
 * @link          https://www.teampass.net
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
16
if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] != 1 ||
17
    !isset($_SESSION['user_id']) || empty($_SESSION['user_id']) ||
18
    !isset($_SESSION['key']) || empty($_SESSION['key'])
19
) {
20
    die('Hacking attempt...');
21
}
22
23
// Load config
24
if (file_exists('../includes/config/tp.config.php')) {
25
    include_once '../includes/config/tp.config.php';
26
} elseif (file_exists('./includes/config/tp.config.php')) {
27
    include_once './includes/config/tp.config.php';
28
} else {
29
    throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
30
}
31
32
/* do checks */
33
require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
34
if (!checkUser($_SESSION['user_id'], $_SESSION['key'], curPage())) {
35
    $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
36
    include $SETTINGS['cpassman_dir'].'/error.php';
37
    exit();
38
}
39
40
require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
41
require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
42
require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
43
$superGlobal = new protect\SuperGlobal\SuperGlobal();
44
45
// Prepare GET variables
46
$get_group = $superGlobal->get("group", "GET");
47
$get_id = $superGlobal->get("id", "GET");
48
49
// Prepare SESSION variables
50
$session_user_admin = $superGlobal->get("user_admin", "SESSION");
51
52
53
if ($session_user_admin === '1' && (isset($SETTINGS_EXT['admin_full_right'])
0 ignored issues
show
Consider adding parentheses for clarity. Current Interpretation: {currentAssign}, Probably Intended Meaning: {alternativeAssign}
Loading history...
54
    && $SETTINGS_EXT['admin_full_right'] === true) || !isset($SETTINGS_EXT['admin_full_right'])) {
55
    $_SESSION['groupes_visibles'] = $_SESSION['personal_visible_groups'];
56
    $_SESSION['groupes_visibles_list'] = implode(',', $_SESSION['groupes_visibles']);
57
}
58
59
// Get list of users
60
$usersList = array();
61
$rows = DB::query("SELECT id,login,email FROM ".$pre."users ORDER BY login ASC");
62
foreach ($rows as $record) {
63
    $usersList[$record['login']] = array(
64
        "id" => $record['id'],
65
        "login" => $record['login'],
66
        "email" => $record['email'],
67
        );
68
}
69
// Get list of roles
70
$arrRoles = array();
71
$listRoles = "";
72
$rows = DB::query("SELECT id,title FROM ".$pre."roles_title ORDER BY title ASC");
73
foreach ($rows as $reccord) {
74
    $arrRoles[$reccord['title']] = array(
75
        'id' => $reccord['id'],
76
        'title' => $reccord['title']
77
        );
78
    if (empty($listRoles)) {
79
        $listRoles = $reccord['id'].'#'.$reccord['title'];
80
    } else {
81
        $listRoles .= ';'.$reccord['id'].'#'.$reccord['title'];
82
    }
83
}
84
85
// Hidden things
86
echo '
87
<input type="hidden" name="hid_cat" id="hid_cat" value="', $get_group !== null ? $get_group : "", '" />
0 ignored issues
show
Security Cross-Site Scripting introduced by
$get_group !== null ? $get_group : '' can contain request data and is used in output context(s) leading to a potential security vulnerability.

2 paths for user data to reach this point

  1. Path: Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  1. Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46
  2. Path: Read from $_GET, and IssetNode ? $_GET[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  1. Read from $_GET, and IssetNode ? $_GET[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46

Preventing Cross-Site-Scripting Attacks

Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.

In order to prevent this, make sure to escape all user-provided data:

// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);

// for URLs
$sanitized = urlencode($tainted);

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
88
<input type="hidden" id="complexite_groupe" value="" />
89
<input type="hidden" name="selected_items" id="selected_items" value="" />
90
<input type="hidden" id="bloquer_creation_complexite" value="" />
91
<input type="hidden" id="bloquer_modification_complexite" value="" />
92
<input type="hidden" id="error_detected" value="" />
93
<input type="hidden" name="random_id" id="random_id" value="" />
94
<input type="hidden" id="edit_wysiwyg_displayed" value="" />
95
<input type="hidden" id="richtext_on" value="1" />
96
<input type="hidden" id="query_next_start" value="0" />
97
<input type="hidden" id="display_categories" value="0" />
98
<input type="hidden" id="nb_items_to_display_once" value="', isset($SETTINGS['nb_items_by_query']) ? htmlspecialchars($SETTINGS['nb_items_by_query']) : 'auto', '" />
99
<input type="hidden" id="user_is_read_only" value="', isset($_SESSION['user_read_only']) && $_SESSION['user_read_only'] == 1 ? '1' : '', '" />
100
<input type="hidden" id="request_ongoing" value="" />
101
<input type="hidden" id="request_lastItem" value="" />
102
<input type="hidden" id="item_editable" value="" />
103
<input type="hidden" id="timestamp_item_displayed" value="" />
104
<input type="hidden" id="pf_selected" value="" />
105
<input type="hidden" id="user_ongoing_action" value="" />
106
<input type="hidden" id="input_list_roles" value="'.htmlentities($listRoles).'" />
107
<input type="hidden" id="path_fontsize" value="" />
108
<input type="hidden" id="access_level" value="" />
109
<input type="hidden" id="empty_clipboard" value="" />
110
<input type="hidden" id="selected_folder_is_personal" value="" />
111
<input type="hidden" id="personal_visible_groups_list" value="', isset($_SESSION['personal_visible_groups_list']) ? $_SESSION['personal_visible_groups_list'] : "", '" />
112
<input type="hidden" id="create_item_without_password" value="', isset($SETTINGS['create_item_without_password']) ? $SETTINGS['create_item_without_password'] : "0", '" />';
113
// Hidden objects for Item search
114
if ($get_group !== null && $get_id !== null) {
115
    echo '
0 ignored issues
show
Security Cross-Site Scripting introduced by
' <input type="hidde...rche_group_pf" value="' can contain request data and is used in output context(s) leading to a potential security vulnerability.

2 paths for user data to reach this point

  1. Path: Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  1. Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46
  2. Path: Read from $_GET, and IssetNode ? $_GET[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  1. Read from $_GET, and IssetNode ? $_GET[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46

Preventing Cross-Site-Scripting Attacks

Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.

In order to prevent this, make sure to escape all user-provided data:

// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);

// for URLs
$sanitized = urlencode($tainted);

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
116
    <input type="hidden" name="open_folder" id="open_folder" value="'.$get_group.'" />
117
    <input type="hidden" name="open_id" id="open_id" value="'.$get_id.'" />
118
    <input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array($get_group, $_SESSION['personal_visible_groups']) ? '1' : '0', '" />
119
    <input type="hidden" name="open_item_by_get" id="open_item_by_get" value="true" />';
120
} elseif ($get_group !== null && $get_id === null) {
121
    echo '<input type="hidden" name="open_folder" id="open_folder" value="'.$get_group.'" />';
0 ignored issues
show
Security Cross-Site Scripting introduced by
'<input type="hidden" na...' . $get_group . '" />' can contain request data and is used in output context(s) leading to a potential security vulnerability.

2 paths for user data to reach this point

  1. Path: Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  1. Read from $_SERVER, and IssetNode ? $_SERVER[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 43
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46
  2. Path: Read from $_GET, and IssetNode ? $_GET[$key] : null is returned in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  1. Read from $_GET, and IssetNode ? $_GET[$key] : null is returned
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  2. $superGlobal->get('group', 'GET') is assigned to $get_group
    in items.php on line 46

Preventing Cross-Site-Scripting Attacks

Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.

In order to prevent this, make sure to escape all user-provided data:

// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);

// for URLs
$sanitized = urlencode($tainted);

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
122
    echo '<input type="hidden" name="open_id" id="open_id" value="" />';
123
    echo '<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="', in_array($get_group, $_SESSION['personal_visible_groups']) ? '1' : '0', '" />';
124
    echo '<input type="hidden" name="open_item_by_get" id="open_item_by_get" value="" />';
125
} else {
126
    echo '<input type="hidden" name="open_folder" id="open_folder" value="" />';
127
    echo '<input type="hidden" name="open_id" id="open_id" value="" />';
128
    echo '<input type="hidden" name="recherche_group_pf" id="recherche_group_pf" value="" />';
129
    echo '<input type="hidden" name="open_item_by_get" id="open_item_by_get" value="" />';
130
}
131
// Is personal SK available
132
echo '
133
<input type="hidden" name="personal_sk_set" id="personal_sk_set" value="', isset($_SESSION['user_settings']['session_psk']) && !empty($_SESSION['user_settings']['session_psk']) ? '1' : '0', '" />
134
<input type="hidden" id="personal_upgrade_needed" value="', isset($SETTINGS['enable_pf_feature']) && $SETTINGS['enable_pf_feature'] == 1 && $session_user_admin !== '1' && isset($_SESSION['user_upgrade_needed']) && $_SESSION['user_upgrade_needed'] == 1 ? '1' : '0', '" />';
135
// define what group todisplay in Tree
136
if (isset($_COOKIE['jstree_select']) && !empty($_COOKIE['jstree_select'])) {
137
    $firstGroup = str_replace("#li_", "", $_COOKIE['jstree_select']);
138
} else {
139
    $firstGroup = "";
140
}
141
142
echo '
143
<input type="hidden" name="jstree_group_selected" id="jstree_group_selected" value="'.htmlspecialchars($firstGroup).'" />
144
<input type="hidden" id="item_user_token" value="" />
145
<input type="hidden" id="items_listing_should_stop" value="" />
146
<input type="hidden" id="new_listing_characteristics" value="" />
147
<input type="hidden" id="uniqueLoadData" value="" />';
148
149
echo '
150
<div id="div_items">';
151
// MAIN ITEMS TREE
152
echo '
153
    <div class="items_tree">
154
        <div id="quick_menu" style="float:left; margin-right: 5px;">
155
            <ul class="quick_menu">
156
                <li><i class="fa fa-bars"></i>
157
                    <ul class="menu_250">
158
                        <li id="jstree_open"><i class="fa fa-expand fa-fw"></i>&nbsp; '.$LANG['expand'].'</li>
159
                        <li id="jstree_close"><i class="fa fa-compress fa-fw"></i>&nbsp; '.$LANG['collapse'].'</li>
160
                        <li onclick="refreshTree()"><i class="fa fa-refresh fa-fw"></i>&nbsp; '.$LANG['refresh'].'</li>
161
                        <li onclick="open_add_group_div()"><i class="fa fa-plus fa-fw"></i>&nbsp; '.$LANG['item_menu_add_rep'].'</li>
162
                        <li onclick="open_edit_group_div()"><i class="fa fa-pencil fa-fw"></i>&nbsp; '.$LANG['item_menu_edi_rep'].'</li>
163
                        <li onclick="open_move_group_div()"><i class="fa fa-arrows fa-fw"></i>&nbsp; '.$LANG['item_menu_mov_rep'].'</li>
164
                        <li onclick="open_del_group_div()"><i class="fa fa-eraser fa-fw"></i>&nbsp; '.$LANG['item_menu_del_rep'].'</li>
165
                        <li onclick="openCopyFolderDialog()"><i class="fa fa-copy fa-fw"></i>&nbsp; '.$LANG['copy_folder'].'</li>
166
                        ', isset($SETTINGS['allow_import']) && $SETTINGS['allow_import'] == 1 && $session_user_admin !== '1' ? '<li onclick="loadImportDialog()"><i class="fa fa-cloud-upload fa-fw"></i>&nbsp; '.$LANG['import_csv_menu_title'].'</li>' : '',
167
                        (isset($SETTINGS['allow_print']) && $SETTINGS['allow_print'] == 1 && $session_user_admin !== '1' && $_SESSION['temporary']['user_can_printout'] === true) ? '<li onclick="loadExportDialog()"><i class="fa fa-cloud-download fa-fw"></i>&nbsp; '.$LANG['print_out_menu_title'].'</li>' : '',
168
                        (isset($SETTINGS['settings_offline_mode']) && $SETTINGS['settings_offline_mode'] == 1 && $session_user_admin !== '1') ? '<li onclick="loadOfflineDialog()"><i class="fa fa-laptop fa-fw"></i>&nbsp; '.$LANG['offline_menu_title'].'</li>' : '', '
169
                    </ul>
170
                </li>
171
            </ul>
172
        </div>
173
        <div style="margin:3px 0px 10px 18px;font-weight:bold;">
174
            '.$LANG['items_browser_title'].'
175
            <input type="text" name="jstree_search" id="jstree_search" class="text ui-widget-content ui-corner-all search_tree" value="'.htmlentities(strip_tags($LANG['item_menu_find']), ENT_QUOTES).'" />
176
        </div>
177
        <div id="sidebar" class="sidebar">
178
            <div id="jstree" style="overflow:auto;"></div>
179
        </div>
180
    </div>';
181
// Zone top right - items list
182
echo '
183
    <div id="items_content">
184
        <div id="items_center">
185
            <div id="items_path" class="ui-corner-all">
186
                <div class="quick_menu1" style="float:left; margin-right: 5px;">
187
                    <ul class="quick_menu">
188
                        <li><i class="fa fa-bars"></i>
189
                            <ul class="menu_250">
190
                                <li id="menu_button_add_item" onclick="open_add_item_div()"><i class="fa fa-plus fa-fw"></i>&nbsp; '.$LANG['item_menu_add_elem'].'</li>
191
                                <li id="menu_button_edit_item" onclick="open_edit_item_div(', isset($SETTINGS['restricted_to_roles']) && $SETTINGS['restricted_to_roles'] == 1 ? 1 : 0, ')"><i class="fa fa-pencil fa-fw"></i>&nbsp; '.$LANG['item_menu_edi_elem'].'</li>
192
                                <li id="menu_button_del_item" onclick="open_del_item_div()"><i class="fa fa-eraser fa-fw"></i>&nbsp; '.$LANG['item_menu_del_elem'].'</li>
193
                                <li id="menu_button_copy_item" onclick="open_copy_item_to_folder_div()"><i class="fa fa-copy fa-fw"></i>&nbsp; '.$LANG['item_menu_copy_elem'].'</li>
194
                            </ul>
195
                        </li>
196
                    </ul>
197
                </div>
198
199
                <div style="margin-top: 3px;">
200
                    <div id="txt1"  style="float:left;">
201
                        <span id="items_path_var"></span>
202
                    </div>
203
204
                    <div class="input-group margin-bottom-sm" style="float:right; margin-top:-1px;">
205
                        <span class="input-group-addon"><i class="fa fa-binoculars fa-fw"></i></span>
206
                        <input class="form-control text ui-widget-content" type="text" onkeypress="javascript:if (event.keyCode == 13) globalItemsSearch();" id="search_item" />
207
                    </div>
208
209
                    <i id="items_list_loader" style="float:right;margin-right:5px;" class="fa fa-cog fa-spin mi-red hidden"></i>&nbsp;
210
                </div>
211
            </div>
212
            <div id="items_list"></div>
213
        </div>';
214
// Zone ITEM DETAIL
215
echo '
216
        <div id="item_details_ok">
217
            <input type="hidden" id="id_categorie" value="" />
218
            <input type="hidden" id="id_item" value="" />
219
            <input type="hidden" id="hid_anyone_can_modify" value="" />
220
            <input type="hidden" id="template_selected_id" value="" />
221
            <div style="height:220px;overflow-y:auto;" id="item_details_scroll">
222
                <div id="handle" class="ui-resizable-handle ui-resizable-n"></div>';
223
224
echo'
225
                <div id="item_details_expired" style="display:none;background-color:white; margin:5px;">
226
                    <div class="ui-state-error ui-corner-all" style="padding:2px;">
227
                        <i class="fa fa-warning"></i>&nbsp;<b>'.$LANG['pw_is_expired_-_update_it'].'</b>
228
                    </div>
229
                </div>
230
                <table width="100%" class="no-border" id="item_details_table">';
231
// Line for LABEL
232
echo '
233
                <tr>
234
                    <td valign="top" class="td_title" width="150px" style="background-color:rgba(178, 178, 178, 0.13);">
235
                        <div class="quick_menu2" style="float:left; margin-right: 5px;">
236
                            <ul class="quick_menu ui-menu">
237
                                <li><i class="fa fa-bars"></i>
238
                                    <ul class="menu_250">
239
                                        <li id="menu_button_copy_pw" class="copy_clipboard"><i class="fa fa-lock fa-fw"></i>&nbsp; '.$LANG['pw_copy_clipboard'].'</li>
240
                                        <li id="menu_button_copy_login" class="copy_clipboard"><i class="fa fa-user fa-fw"></i>&nbsp; '.$LANG['login_copy'].'</li>
241
                                        <li id="menu_button_show_pw" onclick="ShowPassword()"><i class="fa fa-eye fa-fw"></i>&nbsp; '.$LANG['mask_pw'].'</li>
242
                                        <li id="menu_button_copy_link" class="copy_clipboard"><i class="fa fa-link fa-fw"></i>&nbsp; '.$LANG['url_copy'].'</li>
243
                                        <li id="menu_button_history" onclick="OpenDialog(\'div_item_history\', \'false\')"><i class="fa fa-history fa-fw"></i>&nbsp; '.$LANG['history'].'</li>
244
                                        <li id="menu_button_share" onclick="OpenDialog(\'div_item_share\', \'false\')"><i class="fa fa-share fa-fw"></i>&nbsp; '.$LANG['share'].'</li>',
245
                                        (isset($SETTINGS['otv_is_enabled']) && $SETTINGS['otv_is_enabled'] == 1) ? '<li id="menu_button_otv" onclick="prepareOneTimeView()"><i class="fa fa-users fa-fw"></i>&nbsp; '.$LANG['one_time_item_view'].'</li>' : '', '
246
                                        ', isset($SETTINGS['enable_email_notification_on_item_shown']) && $SETTINGS['enable_email_notification_on_item_shown'] == 1 ? '
247
                                        <li id="menu_button_notify"><i class="fa fa-volume-up fa-fw"></i>&nbsp; '.$LANG['notify_me_on_change'].'</li>' : '', '
248
                                        ', isset($SETTINGS['enable_server_password_change']) && $SETTINGS['enable_server_password_change'] == 1 && isset($_SESSION['user_read_only']) && $_SESSION['user_read_only'] !== "1" ? '
249
                                        <li onclick="serverAutoChangePwd()"><i class="fa fa-server fa-fw"></i>&nbsp; '.$LANG['update_server_password'].'</li>' : '', '
250
                                        ', isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] == 1 ? '
251
                                        <li onclick="OpenDialog(\'div_suggest_change\', \'false\')"><i class="fa fa-random fa-fw"></i>&nbsp; '.$LANG['suggest_password_change'].'</li>' : '', '
252
                                    </ul>
253
                                </li>
254
                            </ul>
255
                        </div>
256
                    </td>
257
                    <td valign="middle" style="background-color:rgba(178, 178, 178, 0.13);">
258
                        <span id="id_label" style="font-weight:bold;"></span>
259
                    </td>
260
                    <td style="background-color:rgba(178, 178, 178, 0.13);">
261
                        <input type="hidden" id="hid_label" value="', isset($dataItem) ? htmlspecialchars($dataItem['label']) : '', '" />
262
                        <div style="float:right; font-family:arial; margin-right:5px;" id="item_viewed_x_times"></div>
263
264
                        <!-- INFO -->
265
                        <div class="" style="float:right;margin-right:5px;" id="item_extra_info" title=""></div>
266
                        <!-- INFO END -->
267
268
                    </td>
269
                </tr>';
270
// Line for DESCRIPTION
271
echo '
272
                <tr class="default_item_field">
273
                    <td valign="top" class="td_title" width="180px">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['description'].' :</td>
274
                    <td colspan="2">
275
                        <div id="id_desc" style="font-style:italic;display:inline;"></div><input type="hidden" id="hid_desc" value="', isset($dataItem) ? htmlspecialchars($dataItem['description']) : '', '" />
276
                    </td>
277
                </tr>';
278
// Line for PW
279
echo '
280
                <tr class="default_item_field">
281
                    <td valign="top" class="td_title">&nbsp;<span class="fa fa-angle-right"></span>&nbsp;'.$LANG['pw'].' :<span id="button_quick_pw_copy" class="fa fa-paste fa-border fa-sm tip" style="cursor:pointer;float:right;margin-right:2px;" title="'.$LANG['item_menu_copy_pw'].'"></span></td>
282
                    <td colspan="2">
283
                        &nbsp;
284
                        <div id="id_pw" class="unhide_masked_data" style="float:left; cursor:pointer; width:300px;"></div>
285
                        <div id="hid_pw" class="hidden"></div>
286
                        <input type="hidden" id="hid_pw_old" value="" />
287
                        <input type="hidden" id="pw_shown" value="0" />
288
                    </td>
289
                </tr>';
290
// Line for LOGIN
291
echo '
292
                <tr class="default_item_field">
293
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['index_login'].' :<span id="button_quick_login_copy" class="fa fa-paste fa-border fa-sm tip" style="cursor:pointer;float:right;margin-right:2px;" title="'.$LANG['item_menu_copy_login'].'"></span></td>
294
                    <td colspan="2">
295
                        <div id="id_login" style="float:left;"></div>
296
                        <input type="hidden" id="hid_login" value="" />
297
                    </td>
298
                </tr>';
299
// Line for EMAIL
300
echo '
301
                <tr class="default_item_field">
302
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['email'].' :</td>
303
                    <td colspan="2">
304
                        <div id="id_email" style="display:inline;"></div><input type="hidden" id="hid_email" value="" />
305
                    </td>
306
                </tr>';
307
// Line for URL
308
echo '
309
                <tr class="default_item_field">
310
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['url'].' :</td>
311
                    <td colspan="2">
312
                        <div id="id_url" style="display:inline;"></div><input type="hidden" id="hid_url" value="" />
313
                    </td>
314
                </tr>';
315
// Line for FILES
316
echo '
317
                <tr class="default_item_field">
318
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['files_&_images'].' :</td>
319
                    <td colspan="2">
320
                        <div id="id_files" style="display:inline;font-size:11px;"></div><input type="hidden" id="hid_files" />
321
                        <div id="dialog_files" style="display: none;">
322
323
                        </div>
324
                    </td>
325
                </tr>';
326
// Line for RESTRICTED TO
327
echo '
328
                <tr class="default_item_field">
329
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['restricted_to'].' :</td>
330
                    <td colspan="2">
331
                        <div id="id_restricted_to" style="display:inline;"></div><input type="hidden" id="hid_restricted_to" /><input type="hidden" id="hid_restricted_to_roles" />
332
                    </td>
333
                </tr>';
334
// Line for TAGS
335
echo '
336
                <tr class="default_item_field">
337
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['tags'].' :</td>
338
                    <td colspan="2">
339
                        <div id="id_tags" style="display:inline;"></div><input type="hidden" id="hid_tags" />
340
                    </td>
341
                </tr>';
342
// Line for KBs
343
if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) {
344
    echo '
345
                <tr class="default_item_field">
346
                    <td valign="top" class="td_title">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$LANG['kbs'].' :</td>
347
                    <td colspan="2">
348
                        <div id="id_kbs" style="display:inline;"></div><input type="hidden" id="hid_kbs" />
349
                    </td>
350
                </tr>';
351
}
352
// lines for FIELDS
353
if (isset($SETTINGS['item_extra_fields']) && $SETTINGS['item_extra_fields'] == 1) {
354
    foreach ($_SESSION['item_fields'] as $elem) {
355
        $itemCatName = $elem[0];
356
        echo '
357
                <tr class="tr_fields hidden" id="tr_catfield_'.$elem[0].'">
358
                    <td valign="top" class="td_title" colspan="3">&nbsp;<i class="fa fa-angle-right"></i>&nbsp;'.$elem[1].' :</td>
359
                </tr>';
360
        foreach ($elem[2] as $field) {
361
            echo '
362
                    <tr class="tr_cf tr_fields hidden" id="cf_tr_'.$field[0].'">
363
                        <td valign="top" class="td_title">&nbsp;&nbsp;<i class="fa fa-caret-right"></i>&nbsp;<i>'.$field[1].'</i> :</td>
364
                        <td colspan="2">';
365
            if ($field[4] === '1') {
366
                echo '
367
                            <div id="id_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" style="float:left; width:300px;" class="fields_div unhide_masked_data pointer">
368
                            </div><div id="hid_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" class="fields hidden"></div>';
369
            } else {
370
                echo '
371
                            <div id="id_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" style="display:inline;" class="fields_div"></div>
372
                            <div id="hid_field_'.htmlspecialchars($field[0]).'_'.$elem[0].'" class="fields hidden"></div>';
373
            }
374
            echo '
375
                        </td>
376
                    </tr>';
377
        }
378
    }
379
}
380
echo '
381
                </table>
382
            </div>
383
        </div>';
384
// # NOT ALLOWED
385
echo '
386
        <div id="item_details_nok" class="hidden" style="width:400px; margin:20px auto 20px auto;">
387
            <div class="ui-state-highlight ui-corner-all" style="padding:10px;">
388
                <i class="fa fa-warning fa-2x mi-red"></i>&nbsp;<b>'.$LANG['not_allowed_to_see_pw'].'</b>
389
                <span id="item_details_nok_restriction_list"></span>
390
            </div>
391
        </div>';
392
// DATA EXPIRED
393
echo '
394
        <div id="item_details_expired_full" style="display:none; width:400px; margin:20px auto 20px auto;">
395
            <div class="ui-state-error ui-corner-all" style="padding:10px;">
396
                <i class="fa fa-warning fa-2x mi-red"></i>&nbsp;<b>'.$LANG['pw_is_expired_-_update_it'].'</b>
397
            </div>
398
        </div>';
399
// # NOT ALLOWED
400
echo '
401
        <div id="item_details_no_personal_saltkey" style="width:400px; margin:20px auto 20px auto; height:180px;" class="hidden">
402
            <div class="ui-state-highlight ui-corner-all" style="padding:10px;">
403
                <i class="fa fa-warning fa-2x mi-red"></i>&nbsp;<b>'.$LANG['home_personal_saltkey_info'].'</b>
404
            </div>
405
        </div>';
406
407
echo '
408
    </div>';
409
410
echo '
411
</div>';
412
413
414
/********************************
415
* NEW Item Form
416
*/
417
echo '
418
<div id="div_formulaire_saisi" style="display:none;">
419
    <form method="post" name="new_item" action="">
420
        <div id="afficher_visibilite" style="text-align:center;margin-bottom:6px;height:20px;"></div>
421
        <div id="display_title" style="text-align:center;margin-bottom:6px;font-size:17px;font-weight:bold;height:25px;"></div>
422
        <div id="new_show_error" style="text-align:center;margin:2px;display:none;" class="ui-state-error ui-corner-all"></div>
423
424
        <div id="item_tabs">
425
        <ul>
426
            <li><a href="#tabs-01">'.$LANG['definition'].'</a></li>
427
            <li><a href="#tabs-02">'.$LANG['index_password'].' &amp; '.$LANG['visibility'].'</a></li>
428
            <li><a href="#tabs-03">'.$LANG['files_&_images'].'</a></li>
429
            ', isset($SETTINGS['item_extra_fields']) && $SETTINGS['item_extra_fields'] == 1 ?
430
            '<li id="form_tab_fields"><a href="#tabs-04">'.$LANG['more'].'</a></li>' : '', '
431
        </ul>
432
        <div id="tabs-01">';
433
// Line for LABEL
434
echo '
435
            <label for="" class="label_cpm">'.$LANG['label'].' : </label>
436
            <input type="text" name="label" id="label" onchange="checkTitleDuplicate(this.value, \'', isset($SETTINGS['item_duplicate_in_same_folder']) && $SETTINGS['item_duplicate_in_same_folder'] == 1 ? 0 : 1, '\', \'', isset($SETTINGS['duplicate_item']) && $SETTINGS['duplicate_item'] == 1 ? 0 : 1, '\', \'display_title\')" class="input_text text ui-widget-content ui-corner-all" />';
437
// Line for DESCRIPTION
438
echo '
439
            <label for="" class="label_cpm">'.$LANG['description'].' : </label>
440
            <span id="desc_span">
441
                <textarea rows="5" cols="60" name="desc" id="desc" class="input_text"></textarea>
442
            </span>
443
            <br />';
444
// Line for FOLDERS
445
echo '
446
            <label for="" class="">'.$LANG['group'].' : </label>
447
            <select name="categorie" id="categorie" onchange="RecupComplexite(this.value,0)" style="width:250px; padding:3px;" class="ui-widget-content"><option style="display: none;"></option></select>';
448
// Line for LOGIN
449
echo '
450
            <label for="" class="label_cpm" style="margin-top:10px;">'.$LANG['login'].' : </label>
451
            <input type="text" name="item_login" id="item_login" class="input_text text ui-widget-content ui-corner-all" />';
452
// Line for EMAIL
453
echo '
454
            <label for="" class="label_cpm">'.$LANG['email'].' : </label>
455
            <input type="text" name="email" id="email" class="input_text text ui-widget-content ui-corner-all" />';
456
// Line for URL
457
echo '
458
            <label for="" class="label_cpm">'.$LANG['url'].' : </label>
459
            <input type="text" name="url" id="url" class="input_text text ui-widget-content ui-corner-all" />
460
        </div>';
461
// Tabs Items N?2
462
echo '
463
        <div id="tabs-02">';
464
// Line for folder complexity
465
echo'
466
            <div style="margin-bottom:10px;" id="expected_complexity">
467
                <label for="" class="form_label_180">'.$LANG['complex_asked'].'</label>
468
                <span id="complex_attendue" style="color:#D04806; margin-left:40px;"></span>
469
            </div>';
470
// Line for PW
471
echo '
472
            <label class="label_cpm">'.$LANG['used_pw'].' :
473
                <span id="visible_pw" class="hidden" style="margin-left:10px;font-weight:bold;"></span>
474
                <span id="pw_wait" style="display:none;margin-left:10px;"><span class="fa fa-cog fa-spin fa-1x"></span></span>
475
            </label>
476
            <input type="password" id="pw1" class="input_text text ui-widget-content ui-corner-all" />
477
            <input type="hidden" id="mypassword_complex" value="0" />
478
            <label for="" class="label_cpm">'.$LANG['index_change_pw_confirmation'].' :</label>
479
            <input type="password" name="pw2" id="pw2" class="input_text text ui-widget-content ui-corner-all" />
480
481
            <div style="font-size:9px; text-align:center; width:100%;">
482
                <span id="custom_pw">
483
                    <input type="checkbox" id="pw_lowercase" class="pw_definition" /><label for="pw_lowercase">abc</label>
484
                    <input type="checkbox" id="pw_numerics" class="pw_definition" /><label for="pw_numerics">123</label>
485
                    <input type="checkbox" id="pw_maj" class="pw_definition" /><label for="pw_maj">ABC</label>
486
                    <input type="checkbox" id="pw_symbols" class="pw_definition" /><label for="pw_symbols">@#&amp;</label>
487
                    <input type="checkbox" id="pw_secure" checked="checked" /><label for="pw_secure">'.$LANG['secure'].'</label>
488
                    &nbsp;<label for="pw_size">'.$LANG['size'].' : </label>
489
                    &nbsp;<input type="text" size="2" id="pw_size" value="8" style="font-size:10px;" />
490
                </span>
491
492
                <span class="fa-stack fa-lg tip" title="'.$LANG['pw_generate'].'" onclick="pwGenerate(\'\')" style="cursor:pointer;">
493
                    <i class="fa fa-square fa-stack-2x"></i>
494
                    <i class="fa fa-cogs fa-stack-1x fa-inverse"></i>
495
                </span>&nbsp;
496
                <span class="fa-stack fa-lg tip" title="'.$LANG['copy'].'" onclick="pwCopy(\'\')" style="cursor:pointer;">
497
                    <i class="fa fa-square fa-stack-2x"></i>
498
                    <i class="fa fa-copy fa-stack-1x fa-inverse"></i>
499
                </span>&nbsp;
500
                <span class="fa-stack fa-lg tip" title="'.$LANG['mask_pw'].'" onclick="showPwd()" style="cursor:pointer;">
501
                    <i class="fa fa-square fa-stack-2x"></i>
502
                    <i class="fa fa-eye fa-stack-1x fa-inverse"></i>
503
                </span>
504
            </div>
505
            <div style="width:100%;">
506
                <div id="pw_strength" style="margin:5px 0 5px 120px;"></div>
507
            </div>';
508
509
// Line for RESTRICTED TO
510
if (isset($SETTINGS['restricted_to']) && $SETTINGS['restricted_to'] == 1) {
511
    echo '
512
            <label for="" class="label_cpm">'.$LANG['restricted_to'].' : </label>
513
            <select name="restricted_to_list" id="restricted_to_list" multiple="multiple" style="width:100%;" class="ui-widget-content"></select>
514
            <input type="hidden" name="restricted_to" id="restricted_to" />
515
            <input type="hidden" size="50" name="restricted_to_roles" id="restricted_to_roles" />
516
            <div style="line-height:10px;">&nbsp;</div>';
517
}
518
// Line for TAGS
519
echo '
520
            <label for="" class="label_cpm">'.$LANG['tags'].' : </label>
521
            <input type="text" name="item_tags" id="item_tags" class="input_text text ui-widget-content ui-corner-all" />';
522
// Line for Item modification
523
echo '
524
            <div style="width:100%;margin:0px 0px 6px 0px;', isset($SETTINGS['anyone_can_modify']) === true && $SETTINGS['anyone_can_modify'] === '1' ? '' : 'display:none;', '">
525
                <input type="checkbox" id="anyone_can_modify"',
526
                    isset($SETTINGS['anyone_can_modify_bydefault']) === true
527
                    && $SETTINGS['anyone_can_modify_bydefault'] === '1' ?
528
                    ' checked="checked"' : '', ' />
529
                <label for="anyone_can_modify">'.$LANG['anyone_can_modify'].'</label>
530
            </div>';
531
// Line for Item automatically deleted
532
echo '
533
            <div style="width:100%;margin:0px 0px 6px 0px;', isset($SETTINGS['enable_delete_after_consultation']) && $SETTINGS['enable_delete_after_consultation'] == 1 ? '' : 'display:none;', '">
534
                <input type="checkbox" name="enable_delete_after_consultation" id="enable_delete_after_consultation" />
535
                <label for="enable_delete_after_consultation">'.$LANG['enable_delete_after_consultation'].'</label>
536
                <input type="text" value="1" size="1" id="times_before_deletion" />&nbsp;'.$LANG['times'].'&nbsp;
537
                '.$LANG['automatic_del_after_date_text'].'&nbsp;<input type="text" value="" class="datepicker" readonly="readonly" size="10" id="deletion_after_date" onchange="$(\'#times_before_deletion\').val(\'\')" />
538
            </div>';
539
// Line for EMAIL
540
echo '
541
            <div>
542
                <div style="line-height:10px;">&nbsp;</div>
543
                <label for="" class="label_cpm">'.$LANG['email_announce'].' : </label>
544
                <select id="annonce_liste_destinataires" multiple="multiple" style="width:100%">';
545
foreach ($usersList as $user) {
546
                    echo '<option value="'.$user['email'].'">'.$user['login'].'</option>';
547
}
548
                echo '
549
                </select>
550
            </div>';
551
552
echo '
553
554
        </div>';
555
// Tabs EDIT N?3
556
echo '
557
        <div id="tabs-03">
558
            <div id="item_upload">
559
                <div id="item_upload_list"></div><br />
560
                <div id="item_upload_wait" class="ui-state-focus ui-corner-all hidden" style="padding:2px;margin:5px 0 5px 0;">'.$LANG['please_wait'].'...</div>
561
                <a id="item_attach_pickfiles" href="#" class="button">'.$LANG['select'].'</a>
562
                <a id="item_attach_uploadfiles" href="#" class="button">'.$LANG['start_upload'].'</a>
563
                <input type="hidden" id="files_number" value="0" />
564
            </div>
565
        </div>';
566
// Tabs N°4
567
if (isset($SETTINGS['item_extra_fields']) && $SETTINGS['item_extra_fields'] == 1) {
568
    echo '
569
        <div id="tabs-04">
570
            <div id="item_more">';
571
    // load all categories and fields
572
    foreach ($_SESSION['item_fields'] as $elem) {
573
        $itemCatName = $elem[0];
574
        echo '
575
                <div id="newItemCatName_'.$itemCatName.'" class="newItemCat">
576
                    <div style="font-weight:bold;font-size:12px;">
577
                        <span class="fa fa-folder-open mi-grey-1">&nbsp;</span>'.$elem[1];
578
        // Manage template
579
        if (isset($SETTINGS['item_creation_templates']) === true && $SETTINGS['item_creation_templates'] === '1') {
580
            echo '
581
                        &nbsp;
582
                        <input type="checkbox" id="template_'.$elem[0].'" class="item_template template_for_items" data-category-id="'.$elem[0].'"/>
583
                        <label for="template_'.$elem[0].'">'.$LANG['main_template'].'</label>';
584
        }
585
        echo '
586
                    </div>';
587
        foreach ($elem[2] as $field) {
588
            echo '
589
                    <div style="margin:2px 0 2px 15px;">
590
                        <span class="fa fa-tag mi-grey-1">&nbsp;</span>
591
                        <label class="cpm_label">'.$field[1];
592
            if ($field[5] === '1') {
593
                echo '&nbsp;<i class="fa fa-fire mi-red">&nbsp;</i>';
594
            }
595
            echo '</label>';
596
            if ($field[3] === 'text') {
597
                echo '
598
                        <input type="text" id="field_'.$field[0].'_'.$field[2].'" class="item_field input_text text ui-widget-content ui-corner-all" size="40" data-field-type="'.$field[3].'" data-field-is-mandatory="'.$field[5].'">';
599
            } else if ($field[3] === 'textarea') {
600
                echo '
601
                        <textarea id="field_'.$field[0].'_'.$field[2].'" class="item_field input_text text ui-widget-content ui-corner-all" colums="40" rows="5" data-field-type="'.$field[3].'" data-field-is-mandatory="'.$field[5].'"></textarea>';
602
            }
603
            echo '    
604
                    </div>';
605
        }
606
        echo '
607
                </div>';
608
    }
609
    echo '
610
            </div>
611
        </div>';
612
}
613
echo '
614
    </div>';
615
echo '
616
    </form>
617
    <div style="display:none; padding:5px; margin-top:5px; text-align:center;" id="div_formulaire_saisi_info" class="ui-state-default ui-corner-all"></div>
618
</div>';
619
620
/***************************
621
* Edit Item Form
622
*/
623
echo '
624
<div id="div_formulaire_edition_item" style="display:none;">
625
    <form method="post" name="form_edit" action="">
626
    <div id="edit_afficher_visibilite" style="text-align:center;margin-bottom:6px;height:25px;"></div>
627
    <div id="edit_display_title" style="text-align:center;margin-bottom:6px;font-size:17px;font-weight:bold;height:25px;"></div>
628
    <div id="edit_show_error" style="text-align:center;margin:2px;display:none;" class="ui-state-error ui-corner-all"></div>';
629
// Prepare TABS
630
echo '
631
    <div id="item_edit_tabs">
632
        <ul>
633
            <li><a href="#tabs-1">'.$LANG['definition'].'</a></li>
634
            <li><a href="#tabs-2">'.$LANG['index_password'].' &amp; '.$LANG['visibility'].'</a></li>
635
            <li><a href="#tabs-3">'.$LANG['files_&_images'].'</a></li>
636
            ', isset($SETTINGS['item_extra_fields']) && $SETTINGS['item_extra_fields'] == 1 ?
637
            '<li id="form_edit_tab_fields"><a href="#tabs-4">'.$LANG['more'].'</a></li>' : '', '
638
        </ul>
639
        <div id="tabs-1">
640
            <label for="" class="cpm_label">'.$LANG['label'].' : </label>
641
            <input type="text" size="60" id="edit_label" onchange="checkTitleDuplicate(this.value, \'', isset($SETTINGS['item_duplicate_in_same_folder']) && $SETTINGS['item_duplicate_in_same_folder'] == 1 ? 0 : 1, '\', \'', isset($SETTINGS['duplicate_item']) && $SETTINGS['duplicate_item'] == 1 ? 0 : 1, '\', \'edit_display_title\')" class="input_text text ui-widget-content ui-corner-all" />
642
643
            <label for="" class="cpm_label">'.$LANG['description'].'&nbsp;<span class="fa fa-eraser" style="cursor:pointer;" onclick="clear_html_tags()"></span>&nbsp;</label>
644
            <span id="edit_desc_span">
645
                <textarea rows="5" cols="70" id="edit_desc" name="edit_desc" class="input_text"></textarea>
646
            </span>';
647
// Line for FOLDER
648
echo '
649
            <div style="margin:10px 0px 10px 0px;">
650
            <label for="" class="">'.$LANG['group'].' : </label>
651
            <select id="edit_categorie" onchange="RecupComplexite(this.value,1)" style="width:100%;"><option style="display: none;"></option></select>
652
            </div>';
653
// Line for LOGIN
654
echo '
655
            <label for="" class="cpm_label">'.$LANG['login'].' : </label>
656
            <input type="text" id="edit_item_login" class="input_text text ui-widget-content ui-corner-all" />
657
658
            <label for="" class="cpm_label">'.$LANG['email'].' : </label>
659
            <input type="text" id="edit_email" class="input_text text ui-widget-content ui-corner-all" />
660
661
            <label for="" class="cpm_label">'.$LANG['url'].' : </label>
662
            <input type="text" id="edit_url" class="input_text text ui-widget-content ui-corner-all" />
663
        </div>';
664
// TABS edit n?2
665
echo '
666
        <div id="tabs-2">';
667
// Line for folder complexity
668
echo'
669
            <div style="margin-bottom:10px;" id="edit_expected_complexity">
670
                <label for="" class="cpm_label">'.$LANG['complex_asked'].'</label>
671
                <span id="edit_complex_attendue" style="color:#D04806;"></span>
672
            </div>';
673
674
echo '
675
            <div style="line-height:20px;">
676
                <label for="" class="label_cpm">'.$LANG['used_pw'].' :
677
                    <span id="edit_visible_pw" style="margin-left:10px;font-weight:bold; padding:2px;" class="ui-corner-all ui-state-default hidden"></span>
678
                    <span id="edit_pw_wait" style="margin-left:10px;" class="hidden"><span class="fa fa-cog fa-spin fa-1x"></span></span>
679
                </label>
680
                <input type="password" id="edit_pw1" class="input_text text ui-widget-content ui-corner-all" style="width:390px;" />
681
                <span class="fa fa-history tip" style="cursor:pointer;" id="edit_past_pwds" onclick="showPasswordsHistory()"></span>
682
                <div style="display:none; padding:3px; width:390px; font-weight:normal; font-size:11px; font-family:italic;" id="edit_past_pwds_div" class="ui-corner-all ui-state-default"></div>
683
                <input type="hidden" id="edit_mypassword_complex" value="0" />
684
685
                <label for="" class="cpm_label">'.$LANG['confirm'].' : </label>
686
                <input type="password" id="edit_pw2" class="input_text text ui-widget-content ui-corner-all" style="width:390px;" />
687
            </div>
688
            <div style="font-size:9px; text-align:center; width:100%;">
689
                <span id="edit_custom_pw">
690
                    <input type="checkbox" id="edit_pw_lowercase" class="pw_definition" /><label for="edit_pw_lowercase">abc</label>
691
                    <input type="checkbox" id="edit_pw_numerics" class="pw_definition" /><label for="edit_pw_numerics">123</label>
692
                    <input type="checkbox" id="edit_pw_maj" class="pw_definition" /><label for="edit_pw_maj">ABC</label>
693
                    <input type="checkbox" id="edit_pw_symbols" class="pw_definition" /><label for="edit_pw_symbols">@#&amp;</label>
694
                    <input type="checkbox" id="edit_pw_secure" class="pw_definition" checked="checked" /><label for="edit_pw_secure">'.$LANG['secure'].'</label>
695
                    &nbsp;<label for="edit_pw_size">'.$LANG['size'].' : </label>
696
                    &nbsp;<input type="text" size="2" id="edit_pw_size" value="8" style="font-size:10px;" />
697
                </span>
698
699
                <span class="fa-stack fa-lg tip" title="'.$LANG['pw_generate'].'" onclick="pwGenerate(\'edit\')" style="cursor:pointer;">
700
                    <i class="fa fa-square fa-stack-2x"></i>
701
                    <i class="fa fa-cogs fa-stack-1x fa-inverse"></i>
702
                </span>&nbsp;
703
                <span class="fa-stack fa-lg tip" title="'.$LANG['copy'].'" onclick="pwCopy(\'edit\')" style="cursor:pointer;">
704
                    <i class="fa fa-square fa-stack-2x"></i>
705
                    <i class="fa fa-copy fa-stack-1x fa-inverse"></i>
706
                </span>&nbsp;
707
                <span class="fa-stack fa-lg tip" title="'.$LANG['mask_pw'].'" onclick="ShowPasswords_EditForm()" style="cursor:pointer;">
708
                    <i class="fa fa-square fa-stack-2x"></i>
709
                    <i class="fa fa-eye fa-stack-1x fa-inverse"></i>
710
                </span>
711
            </div>
712
            <div style="width:100%;">
713
                <div id="edit_pw_strength" style="margin:5px 0 5px 120px;"></div>
714
            </div>';
715
716
if (isset($SETTINGS['restricted_to']) && $SETTINGS['restricted_to'] == 1) {
717
    echo '
718
            <div id="div_editRestricted">
719
                <label for="" class="label_cpm">'.$LANG['restricted_to'].' : </label>
720
                <select name="edit_restricted_to_list" id="edit_restricted_to_list" multiple="multiple" style="width:100%"></select>
721
                <input type="hidden" size="50" name="edit_restricted_to" id="edit_restricted_to" />
722
                <input type="hidden" size="50" name="edit_restricted_to_roles" id="edit_restricted_to_roles" />
723
                <div style="line-height:10px;">&nbsp;</div>
724
            </div>';
725
}
726
727
echo '
728
            <label for="" class="cpm_label">'.$LANG['tags'].' : </label>
729
            <input type="text" size="50" name="edit_tags" id="edit_tags" class="input_text text ui-widget-content ui-corner-all" />';
730
// Line for Item modification
731
echo '
732
            <div style="width:100%;margin:0px 0px 6px 0px;', isset($SETTINGS['anyone_can_modify']) === true && $SETTINGS['anyone_can_modify'] === '1' ? '' : 'display:none;', '">
733
                <input type="checkbox" id="edit_anyone_can_modify"',
734
                    isset($SETTINGS['anyone_can_modify_bydefault']) === true
735
                    && $SETTINGS['anyone_can_modify_bydefault'] === '1' ?
736
                    ' checked="checked"' : '', ' />
737
                <label for="edit_anyone_can_modify">'.$LANG['anyone_can_modify'].'</label>
738
            </div>';
739
// Line for Item automatically deleted
740
echo '
741
            <div id="edit_to_be_deleted" style="width:100%;margin:0px 0px 6px 0px;', isset($SETTINGS['enable_delete_after_consultation']) && $SETTINGS['enable_delete_after_consultation'] == 1 ? '' : 'display:none;', '">
742
                <input type="checkbox" name="edit_enable_delete_after_consultation" id="edit_enable_delete_after_consultation" />
743
                <label for="edit_enable_delete_after_consultation">'.$LANG['enable_delete_after_consultation'].'</label>
744
                <input type="text" value="" size="1" id="edit_times_before_deletion" onchange="$(\'#edit_deletion_after_date\').val(\'\')" />&nbsp;'.$LANG['times'].'&nbsp;
745
                '.$LANG['automatic_del_after_date_text'].'&nbsp;<input type="text" value="" class="datepicker" readonly="readonly" size="10" id="edit_deletion_after_date" onchange="$(\'#edit_times_before_deletion\').val(\'\')" />
746
            </div>';
747
748
echo '
749
            <div id="div_anounce_change_by_email">
750
                <div style="line-height:10px;">&nbsp;</div>
751
                <label for="" class="label_cpm">'.$LANG['email_announce'].' : </label>
752
                <select id="edit_annonce_liste_destinataires" multiple="multiple" style="width:100%">';
753
foreach ($usersList as $user) {
754
    echo '<option value="'.$user['email'].'">'.$user['login'].'</option>';
755
}
756
echo '
757
                </select>
758
            </div>';
759
760
echo '
761
        </div>';
762
// Tab EDIT N°3
763
echo '
764
        <div id="tabs-3">
765
            <div style="font-weight:bold;font-size:12px;">
766
                <span class="fa fa-folder-open mi-grey-1">&nbsp;</span>'.$LANG['uploaded_files'].'
767
            </div>
768
            <div id="item_edit_list_files" style="margin-left:5px;"></div>
769
            <div style="margin-top:10px;font-weight:bold;font-size:12px;">
770
                <span class="fa fa-folder-open mi-grey-1">&nbsp;</span>'.$LANG['upload_files'].'
771
            </div>
772
            <div id="item_edit_upload">
773
                <div id="item_edit_upload_list"></div><br />
774
                <div id="item_edit_upload_wait" class="ui-state-focus ui-corner-all hidden" style="padding:2px;margin:5px 0 5px 0;">'.$LANG['please_wait'].'...</div>
775
                <a id="item_edit_attach_pickfiles" href="#" class="button">'.$LANG['select'].'</a>
776
                <a id="item_edit_attach_uploadfiles" href="#sd" class="button">'.$LANG['start_upload'].'</a>
777
                <input type="hidden" id="edit_files_number" value="0" />
778
            </div>
779
        </div>';
780
// Tabs EDIT N°4 -> Categories
781
if (isset($SETTINGS['item_extra_fields']) && $SETTINGS['item_extra_fields'] == 1) {
782
    echo '
783
        <div id="tabs-4">
784
            <div id="edit_item_more">';
785
    // load all categories and fields
786
    foreach ($_SESSION['item_fields'] as $elem) {
787
        echo '
788
                <div class="editItemCat" id="editItemCatName_'.$elem[0].'">
789
                    <div style="font-weight:bold;font-size:12px;">
790
                        <span class="fa fa-folder-open mi-grey-1">&nbsp;</span>'.$elem[1];
791
        // Manage template
792
        if (isset($SETTINGS['item_creation_templates']) === true && $SETTINGS['item_creation_templates'] === '1') {
793
            echo '
794
                        <div style="display:inline; float:right; font-weight:normal; font-style: italic;">
795
                        &nbsp;
796
                        <input type="checkbox" id="template_edit_'.$elem[0].'" class="item_edit_template template_for_items" data-category-id="'.$elem[0].'"/>
797
                        <label for="template_edit_'.$elem[0].'" class="pointer">'.$LANG['main_template'].'</label>
798
                        </div>';
799
        }
800
        echo '
801
                    </div>';
802
        foreach ($elem[2] as $field) {
803
            echo '
804
                    <div style="margin:2px 0 2px 15px;">
805
                        <span class="fa fa-tag mi-grey-1">&nbsp;</span>
806
                        <label class="cpm_label">'.$field[1];
807
            if ($field[5] === '1') {
808
                echo '&nbsp;<i class="fa fa-fire mi-red">&nbsp;</i>';
809
            }
810
            echo '</label>';
811
            if ($field[3] === 'text') {
812
                echo '
813
                        <input type="text" id="edit_field_'.$field[0].'_'.$elem[0].'" class="edit_item_field input_text text ui-widget-content ui-corner-all" size="40" data-field-type="'.$field[3].'" data-field-masked="'.$field[4].'" data-field-is-mandatory="'.$field[5].'">';
814
            } else if ($field[3] === 'textarea') {
815
                echo '
816
                        <textarea id="edit_field_'.$field[0].'_'.$elem[0].'" class="edit_item_field input_text text ui-widget-content ui-corner-all" colums="40" rows="5" data-field-type="'.$field["3"].'" data-field-masked="'.$field[4].'" data-field-is-mandatory="'.$field[5].'"></textarea>';
817
            }
818
            echo '
819
                    </div>';
820
        }
821
        echo '
822
                </div>';
823
    }
824
    echo '
825
            </div>
826
        </div>
827
    </div>';
828
}
829
echo '
830
    <div style="padding:5px;" id="div_formulaire_edition_item_info" class="ui-state-default ui-corner-all hidden"></div>
831
    </div>
832
    </form>
833
</div>';
834
835
/*
836
* ADD NEW FOLDER form
837
*/
838
echo '
839
<div id="div_ajout_rep" style="display:none;">
840
    <div id="new_rep_show_error" style="text-align:center;margin:2px;" class="ui-state-error ui-corner-all"></div>
841
    <table>
842
        <tr>
843
            <td>'.$LANG['label'].' : </td>
844
            <td><input type="text" id="new_rep_titre" style="width:242px; padding:3px;" class="ui-widget-content" /></td>
845
        </tr>
846
        <tr>
847
            <td>'.$LANG['sub_group_of'].' : </td>
848
            <td><select id="new_rep_groupe" style="width:250px; padding:3px;" class="ui-widget-content">
849
                ', (isset($SETTINGS['can_create_root_folder']) && $SETTINGS['can_create_root_folder'] == 1 || $_SESSION['user_manager'] === "1") ? '<option value="0">'.$LANG['root'].'</option>' : '', '
850
            </select></td>
851
        </tr>
852
        <tr>
853
            <td>'.$LANG['complex_asked'].' : </td>
854
            <td><select id="new_rep_complexite" style="width:250px; padding:3px;" class="ui-widget-content">';
855
foreach ($SETTINGS_EXT['pwComplexity'] as $complex) {
856
    echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
857
}
858
echo '
859
            </select>
860
            </td>
861
        </tr>';
862
echo '
863
    </table>
864
    <div id="add_folder_loader" style="display:none;text-align:center;margin-top:20px;">
865
        <i class="fa fa-cog fa-spin"></i>&nbsp;'.$LANG['please_wait'].'...
866
    </div>
867
</div>';
868
// Formulaire EDITER REPERTORIE
869
echo '
870
<div id="div_editer_rep" style="display:none;">
871
    <div id="edit_rep_show_error" style="text-align:center;margin:2px;display:none;" class="ui-state-error ui-corner-all"></div>
872
    <table>
873
        <tr>
874
            <td>'.$LANG['new_label'].' : </td>
875
            <td><input type="text" id="edit_folder_title" style="width:242px; padding:3px;" class="ui-widget-content" /></td>
876
        </tr>
877
        <tr>
878
            <td>'.$LANG['group_select'].' : </td>
879
            <td><select id="edit_folder_folder" style="width:250px; padding:3px;" class="ui-widget-content"></select></td>
880
        </tr>
881
        <tr>
882
            <td>'.$LANG['complex_asked'].' : </td>
883
            <td><select id="edit_folder_complexity" style="width:250px; padding:3px;" class="ui-widget-content">
884
                <option value="">---</option>';
885
foreach ($SETTINGS_EXT['pwComplexity'] as $complex) {
886
    echo '<option value="'.$complex[0].'">'.$complex[1].'</option>';
887
}
888
echo '
889
            </select>
890
            </td>
891
        </tr>
892
    </table>
893
    <div id="edit_folder_loader" style="display:none;text-align:center;margin-top:20px;">
894
        <i class="fa fa-cog fa-spin"></i>&nbsp;'.$LANG['please_wait'].'...
895
    </div>
896
</div>';
897
// Formulaire MOVE FOLDER
898
echo '
899
<div id="div_move_folder" style="display:none;">
900
    <div id="move_rep_show_error" style="text-align:center;margin:2px;" class="ui-state-error ui-corner-all hidden"></div>
901
    <div style="text-align:center;margin-top:20px;">
902
        <p>'.$LANG['folder_will_be_moved_below'].'</p>
903
        <div>
904
        <select id="move_folder_id" style="width:250px; padding:3px;" class="ui-widget-content">
905
        </select>
906
        </div>
907
    </div>
908
    <div id="move_folder_loader" style="text-align:center;margin-top:20px;" class="hidden">
909
        <i class="fa fa-cog fa-spin"></i>&nbsp;'.$LANG['please_wait'].'...
910
    </div>
911
</div>';
912
// Formulaire COPY FOLDER
913
echo '
914
<div id="div_copy_folder" style="display:none;">
915
    <div id="div_copy_folder_info" class="ui-widget-content ui-state-highlight ui-corner-all" style="padding:5px;"><span class="fa fa-info-circle fa-2x"></span>&nbsp;'.$LANG['copy_folder_info'].'</div>
916
917
    <div style="margin:10px 0 0 0;">
918
        <label style="float:left; width:150px;">'.$LANG['copy_folder_source'].'</label>
919
        <select id="copy_folder_source_id" style="width:300px; padding:3px;" class="ui-widget-content"></select>
920
    </div>
921
    <div style="margin:10px 0 0 0;">
922
        <label style="float:left; width:150px;">'.$LANG['copy_folder_destination'].'</label>
923
        <select id="copy_folder_destination_id" style="width:300px; padding:3px;" class="ui-widget-content"></select>
924
    </div>
925
926
    <div id="div_copy_folder_msg" style="text-align:center;padding:5px;display:none; margin-top:10px; font-size:14px;" class="ui-corner-all"></div>
927
</div>';
928
// Formulaire SUPPRIMER REPERTORIE
929
echo '
930
<div id="div_supprimer_rep" style="display:none;">
931
    <table>
932
        <tr>
933
            <td>'.$LANG['group_select'].' : </td>
934
            <td><select id="delete_rep_groupe" style="width:250px; padding:3px;" class="ui-widget-content">
935
            </select></td>
936
        </tr>
937
        <tr>
938
        <td colspan="2">
939
            <div id="delete_rep_groupe_validate_div" class="ui-state-default ui-corner-all" style="padding:5px; margin-top:10px;">
940
                <input type="checkbox" id="delete_rep_groupe_validate"><label for="delete_rep_groupe_validate">'.$LANG['confirm_delete_group'].'</label>
941
            </div>
942
        </td>
943
        </tr>
944
    </table>
945
    <div id="del_rep_show_error" style="text-align:center;padding:5px;display:none;margin-top:10px;" class="ui-state-error ui-corner-all"></div>
946
947
    <div id="del_folder_loader" style="display:none;text-align:center;margin-top:15px;">
948
        <i class="fa fa-cog fa-spin"></i>&nbsp;'.$LANG['please_wait'].'...
949
    </div>
950
</div>';
951
// SUPPRIMER UN ELEMENT
952
echo '
953
<div id="div_del_item" style="display:none;">
954
        <h2 id="div_del_item_selection"></h2>
955
        <div style="text-align:center;padding:8px;" class="ui-state-error ui-corner-all">
956
            <span class="fa fa-warning fa-2x"></span>&nbsp;'.$LANG['confirm_deletion'].'
957
        </div>
958
</div>';
959
// DIALOG INFORM USER THAT LINK IS COPIED
960
echo '
961
<div id="div_item_copied" style="display:none;">
962
    <div style="text-align:center;padding:8px;" class="ui-state-focus ui-corner-all">
963
        <span class="fa fa-info fa-2x"></span>&nbsp;'.$LANG['link_is_copied'].'
964
    </div>
965
    <div id="div_display_link"></div>
966
</div>';
967
// DIALOG TO WHAT FOLDER COPYING ITEM
968
echo '
969
<div id="div_copy_item_to_folder" style="display:none;">
970
    <h2 id="div_copy_item_to_folder_item"></h2>
971
    <div style="text-align:center;">
972
        <div>'.$LANG['item_copy_to_folder'].'</div>
973
        <div style="margin:10px;">
974
            <select id="copy_in_folder" style="width:300px;">
975
                ', (isset($_SESSION['can_create_root_folder']) && $_SESSION['can_create_root_folder'] == 1) ? '<option value="0">'.$LANG['root'].'</option>' : '', ''.
976
            '</select>
977
        </div>
978
    </div>
979
    <div id="copy_item_to_folder_show_error" style="text-align:center;margin:2px;display:none; padding:3px;" class="ui-state-error ui-corner-all"></div>
980
    <div style="height:20px;text-align:center;margin:2px;" id="copy_item_info" class=""></div>
981
</div>';
982
// DIALOG FOR HISTORY OF ITEM
983
echo '
984
<div id="div_item_history" style="display:none;">
985
    <div id="item_history_log"></div>
986
    ', (isset($SETTINGS['insert_manual_entry_item_history']) && $SETTINGS['insert_manual_entry_item_history'] == 1) ?
987
'<div id="new_history_entry_form" style="display:none; margin-top:10px;"><hr>
988
        <div id="div_add_history_entry">
989
            <div id="item_history_log_error"></div>
990
            '.$LANG['label'].'&nbsp;<input type="text" id="add_history_entry_label" size="40" />&nbsp;
991
            <span class="button" style="margin-top:6px;" onclick="manage_history_entry(\'add_entry\',\'\')">'.$LANG['add_history_entry'].'</div>
992
        </div>
993
    </div>'
994
:'', '
995
</div>';
996
// DIALOG FOR ITEM SHARE
997
echo '
998
<div id="div_item_share" style="display:none;">
999
    <div id="div_item_share_error" style="text-align:center;margin:2px;" class="ui-state-error ui-corner-all hidden"></div>
1000
    <div id="div_item_share_init">
1001
        <div style="margin:3px 0 5px 0;">'.$LANG['item_share_text'].'</div>
1002
        <input type="text" id="item_share_email" class="ui-corner-all" style="width:100%;" />
1003
        <div id="div_item_share_status" style="text-align:center;margin-top:15px; padding:5px;" class="ui-corner-all hidden">
1004
            <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
1005
        </div>
1006
    </div>
1007
</div>';
1008
// DIALOG FOR ITEM IS UPDATED
1009
echo '
1010
<div id="div_item_updated" style="display:none;">
1011
    <div style="">'.$LANG['item_updated_text'].'</div>
1012
</div>';
1013
1014
// DIALOG FOR SUGGESTING PWD CHANGE
1015
echo '
1016
<div id="div_suggest_change" style="display:none;">
1017
    <div style="padding:5px; text-align:center;" class="ui-corner-all ui-state-default"><i class="fa fa-info-circle fa-lg"></i>&nbsp;'.$LANG['suggest_password_change_intro'].'</div>
1018
    <div style=" margin-top:10px;" id="div_suggest_change_html"></div>
1019
    <div id="div_suggest_change_wait" style="margin-top:10; padding:5px; display:none;" class="ui-state-focus ui-corner-all"></div>
1020
</div>';
1021
1022
// Off line mode
1023
if (isset($SETTINGS['settings_offline_mode']) && $SETTINGS['settings_offline_mode'] == 1) {
1024
    echo '
1025
    <div id="dialog_offline_mode" style="display:none;">
1026
        <div id="div_offline_mode">
1027
            <i class="fa fa-cog fa-spin fa-2x"></i>
1028
        </div>
1029
    </div>';
1030
}
1031
1032
// Export items to file
1033
if (isset($SETTINGS['allow_print']) && $SETTINGS['allow_print'] == 1 && $_SESSION['temporary']['user_can_printout'] === true) {
1034
    echo '
1035
    <div id="dialog_export_file" style="display:none;">
1036
        <div id="div_export_file">
1037
            <i class="fa fa-cog fa-spin fa-2x"></i>
1038
        </div>
1039
    </div>';
1040
}
1041
1042
// Import items
1043
if (isset($SETTINGS['allow_import']) && $SETTINGS['allow_import'] == 1 && $session_user_admin !== '1') {
1044
    echo '
1045
    <div id="dialog_import_file" style="display:none;">
1046
        <div id="div_import_file">
1047
            <i class="fa fa-cog fa-spin fa-2x"></i>
1048
        </div>
1049
    </div>';
1050
}
1051
1052
// USERS passwords upgrade
1053
if (isset($SETTINGS['enable_pf_feature']) && $SETTINGS['enable_pf_feature'] == 1
1054
    && $session_user_admin !== '1' && isset($_SESSION['user_upgrade_needed']) && $_SESSION['user_upgrade_needed'] == 1
1055
) {
1056
    echo '
1057
    <div id="dialog_upgrade_personal_passwords" style="display:none;">
1058
        <div style="text-align:center;">
1059
            <div>'.$LANG['pf_change_encryption'].'</div>
1060
            <div id="dialog_upgrade_personal_passwords_status" style="margin:15px 0 15px 0; font-weight:bold;">', isset($_SESSION['user_settings']['session_psk']) ? $LANG['pf_sk_set'] : $LANG['pf_sk_not_set'], '</div>
1061
        </div>
1062
    </div>';
1063
}
1064
1065
// SSH dialogbox
1066
echo '
1067
<div id="dialog_ssh" style="display:none;padding:4px;">
1068
    <div id="div_ssh">
1069
        <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
1070
    </div>
1071
</div>';
1072
1073
// Reason for item access dialogbox
1074
echo '
1075
<div id="dialog_reason_to_access" style="display:none;padding:4px;">
1076
    <div style="text-align:center;">
1077
        <textarea id="reason_to_access_text" rows="3" cols="75" placeholder="'.addslashes($LANG['request_access_to_item_info']).'" style="ui-widget ui-state-default ui-corner-all"></textarea>
1078
        <div id="reason_to_access_info" style="margin-top:5px; padding:4px;"></div>
1079
    </div>
1080
</div>';
1081
1082
require_once 'items.load.php';
1083