This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
find.php
112 lines (105 loc) · 4.41 KB
/
find.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
*
* @package find.php
* @author Nils Laumaillé <nils@teampass.net>
* @version 2.1.27
* @copyright 2009-2019 Nils Laumaillé
* @license GNU GPL-3.0
* @link
*/
if (!isset($_SESSION['CPM']) || $_SESSION['CPM'] != 1 ||
!isset($_SESSION['user_id']) || empty($_SESSION['user_id']) ||
!isset($_SESSION['key']) || empty($_SESSION['key'])
) {
die('Hacking attempt...');
}
// Load config
if (file_exists('../includes/config/tp.config.php')) {
include_once '../includes/config/tp.config.php';
} elseif (file_exists('./includes/config/tp.config.php')) {
include_once './includes/config/tp.config.php';
} else {
throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
}
/* do checks */
require_once $SETTINGS['cpassman_dir'].'/sources/checks.php';
if (!checkUser($_SESSION['user_id'], $_SESSION['key'], curPage())) {
$_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
include $SETTINGS['cpassman_dir'].'/error.php';
exit();
}
require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
// Build list of visible folders
$select_visible_folders_options = $select_visible_nonpersonal_folders_options = "";
if (isset($_SESSION['list_folders_limited']) && count($_SESSION['list_folders_limited']) > 0) {
$list_folders_limited_keys = @array_keys($_SESSION['list_folders_limited']);
} else {
$list_folders_limited_keys = array();
}
// list of items accessible but not in an allowed folder
if (isset($_SESSION['list_restricted_folders_for_items'])
&& count($_SESSION['list_restricted_folders_for_items']) > 0
) {
$list_restricted_folders_for_items_keys = @array_keys($_SESSION['list_restricted_folders_for_items']);
} else {
$list_restricted_folders_for_items_keys = array();
}
// Is personal SK available
echo '
<input type="hidden" name="personal_sk_set" id="personal_sk_set" value="', isset($_SESSION['user_settings']['clear_psk']) && !empty($_SESSION['user_settings']['clear_psk']) ? '1' : '0', '" />';
// Show the Items in a table view
echo '<input type="hidden" id="id_selected_item" />
<input type="hidden" id="personalItem" />
<input type="hidden" id="expired_item" />
<input type="hidden" id="restricted_item" />
<input type="hidden" id="folder_id_of_item" />
<div class="title ui-widget-content ui-corner-all">
'.$LANG['find'].'
<button title="'.htmlentities(strip_tags($LANG['move_items']), ENT_QUOTES).'" onclick="$(\'#div_mass_op\').data(\'action\', \'move\').dialog(\'open\');" class="button" style="font-size:16px;">
<i class="fa fa-share"></i>
</button>
<button title="'.htmlentities(strip_tags($LANG['delete_items']), ENT_QUOTES).'" onclick="$(\'#div_mass_op\').data(\'action\', \'delete\').dialog(\'open\');" class="button" style="font-size:16px;">
<i class="fa fa-trash"></i>
</button>
</div>
<div style="margin:10px auto 25px auto;min-height:250px;" id="find_page">
<table id="t_items" cellspacing="0" cellpadding="5" width="100%">
<thead><tr>
<th></th>
<th style="width:15%;">'.$LANG['label'].'</th>
<th style="width:20%;">'.$LANG['login'].'</th>
<th style="width:25%;">'.$LANG['description'].'</th>
<th style="width:13%;">'.$LANG['tags'].'</th>
<th style="width:13%;">'.$LANG['url'].'</th>
<th style="width:20%;">'.$LANG['group'].'</th>
</tr></thead>
<tbody>
<tr><td></td></tr>
</tbody>
</table>
</div>';
// DIALOG TO WHAT FOLDER COPYING ITEM
echo '
<div id="div_copy_item_to_folder" style="display:none;">
<div id="copy_item_to_folder_show_error" style="text-align:center;margin:2px;display:none;" class="ui-state-error ui-corner-all"></div>
<div style="">'.$LANG['item_copy_to_folder'].'</div>
<div style="margin:10px;">
<select id="copy_in_folder">
</select>
</div>
</div>';
// DIALOG TO SEE ITEM DATA
echo '
<div id="div_item_data" style="display:none;">
<div id="div_item_data_show_error" style="text-align:center;margin:2px;display:none;" class="ui-state-error ui-corner-all"></div>
<div id="div_item_data_text" style=""></div>
</div>';
// DIALOG TO MASS OPERATIONS
echo '
<div id="div_mass_op" style="display:none;">
<div id="div_mass_html" style=""></div>
<div id="div_mass_op_msg" style="text-align:center; margin-top:10px; display:none; padding:10px;" class="ui-corner-all"></div>
</div>';
// Load file
require_once 'find.load.php';