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