forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views_database.load.php
151 lines (142 loc) · 4.46 KB
/
views_database.load.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
/**
* @package views_database.load.php
* @author Nils Laumaillé <[email protected]>
* @version 2.1.27
* @copyright 2009-2019 Nils Laumaillé
* @license GNU GPL-3.0
* @link https://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...');
}
?>
<script type="text/javascript">
//<![CDATA[
var oTable1;
var oTable2;
/**
* Kill an entry
*/
function killEntry(type, id)
{
if (type == "items_edited") {
$.post(
"sources/items.queries.php",
{
type : "free_item_for_edition",
id : id,
key : "<?php echo $_SESSION["key"]; ?>"
},
function(data) {
oTable1.fnDraw(false);
}
);
} else if (type == "disconnect_user") {
$.post(
"sources/users.queries.php",
{
type : "disconnect_user",
user_id : id,
key : "<?php echo $_SESSION["key"]; ?>"
},
function(data) {
oTable2.fnDraw(false);
}
);
}
}
/**
* Manage display of divs
*/
function manage_div_display(show_id){
var all_divs = new Array();
all_divs[0] = "tab5_1";
all_divs[1] = "tab5_2";
for (i=0;i<all_divs.length;i++) {
if (all_divs[i] == show_id) {
$("#"+all_divs[i]).show();
} else {
$("#"+all_divs[i]).hide();
}
}
}
/**
* Loads the associated data table
*/
function loadTable(table_id)
{
if (table_id == "t_items_edited") {
oTable1 = $("#t_items_edited").dataTable({
"aaSorting": [[ 1, "asc" ]],
"sPaginationType": "full_numbers",
"bProcessing": true,
"bDestroy": true,
"bServerSide": true,
"sAjaxSource": "<?php echo $SETTINGS['cpassman_url']; ?>/sources/datatable/datatable.item_edition.php?token=<?php echo $_SESSION["key"]; ?>",
"bJQueryUI": true,
"oLanguage": {
"sUrl": "<?php echo $SETTINGS['cpassman_url']; ?>/includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt"
},
"fnInitComplete": function() {
$("#items_edited_page input").focus();
}
});
} else if (table_id == "t_users_logged") {
oTable2 = $("#t_users_logged").dataTable({
"aaSorting": [[ 1, "asc" ]],
"sPaginationType": "full_numbers",
"bProcessing": true,
"bDestroy": true,
"bServerSide": true,
"sAjaxSource": "<?php echo $SETTINGS['cpassman_url']; ?>/sources/datatable/datatable.users_logged.php?token=<?php echo $_SESSION["key"]; ?>",
"bJQueryUI": true,
"oLanguage": {
"sUrl": "<?php echo $SETTINGS['cpassman_url']; ?>/includes/language/datatables.<?php echo $_SESSION['user_language']; ?>.txt"
},
"fnInitComplete": function() {
$("#t_users_logged_page input").focus();
}
});
}
}
$(function() {
$("#radio_database").buttonset();
$(".button").button();
$("#div_dialog_message").dialog({
bgiframe: true,
modal: true,
autoOpen: false,
width: 400,
height: 150,
title: "<?php echo $LANG["admin_action"]; ?>",
buttons: {
"<?php echo $LANG["ok"]; ?>": function() {
$.post(
"sources/users.queries.php",
{
type : "disconnect_all_users",
key : "<?php echo $_SESSION["key"]; ?>"
},
function(data) {
oTable2.fnDraw(false);
$(this).dialog("close");
}
);
},
"<?php echo $LANG["cancel_button"]; ?>": function() {
$(this).dialog("close");
}
}
});
$("#but_disconnect_all_users").click(function() {
$("#div_dialog_message_text").html("<?php echo $LANG["disconnect_all_users_sure"]; ?>");
$("#div_dialog_message").dialog("open");
});
});
//]]>
</script>