forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
favourites.php
76 lines (71 loc) · 2.97 KB
/
favourites.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
<?php
/**
* @file favourites.php
* @author Nils Laumaillé
* @version 2.1
* @copyright (c) 2009-2011 Nils Laumaillé
* @licensing GNU AFFERO GPL 3.0
* @link http://www.teampass.net
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
if (!isset($_SESSION['CPM'] ) || $_SESSION['CPM'] != 1)
die('Hacking attempt...');
echo '
<form name="form_favourites" method="post" action="">
<div class="title ui-widget-content ui-corner-all">'.$txt['my_favourites'].'</div>
<div style="height:100%;overflow:auto;">';
if ( empty($_SESSION['favourites']) )
echo '
';
else{
echo '
<table id="t_items" style="empty-cells:show;width:100%;" cellspacing="0" cellpadding="5">
<thead><tr>
<th style="width:55px;"></th>
<th style="min-width:15%;">'.$txt['label'].'</th>
<th style="min-width:50%;">'.$txt['description'].'</th>
<th style="min-width:20%;">'.$txt['group'].'</th>
</tr></thead>
<tbody>';
//Get favourites
$cpt= 0 ;
foreach($_SESSION['favourites'] as $fav){
if ( !empty($fav) ){
$data = $db->query_first(
"SELECT i.label, i.description, i.id, i.id_tree, t.title
FROM ".$pre."items AS i
INNER JOIN ".$pre."nested_tree AS t ON (t.id = i.id_tree)
WHERE i.id = ".$fav);
if (!empty($data['label'])) {
echo '
<tr class="ligne'.($cpt%2).'">
<td>
<img src="includes/images/key__arrow.png" onClick="javascript:window.location.href = \'index.php?page=items&group='.$data['id_tree'].'&id='.$data['id'].'\';" style="cursor:pointer;" />
<img src="includes/images/favourite_delete.png" onClick="prepare_delete_fav(\''.$data['id'].'\');" style="cursor:pointer;" title="'.$txt['item_menu_del_from_fav'].'" />
</td>
<td align="left">'.stripslashes($data['label']).'</td>
<td align="center">'.stripslashes($data['description']).'</td>
<td align="center">',$data['title'] == $_SESSION['user_id']?$_SESSION['login']:$data['title'],'</td>
</tr>';
$cpt++;
}
}
}
echo '
</tbody>
</table>';
}
echo '
</div>
</form>';
// DIV FOR FAVOURITES DELETION
echo '
<div id="div_delete_fav" style="display:none;">
'.$txt['confirm_del_from_fav'].'
<input type="hidden" id="detele_fav_id" />
</div>';
?>