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