-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreport.php
More file actions
57 lines (45 loc) · 1.42 KB
/
report.php
File metadata and controls
57 lines (45 loc) · 1.42 KB
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
<?php
include_once ("help/session.php");
include_once ("help/helper.php");
include_once ("database/zabbix.php");
if(isset($_GET['groupid'])){
session_set('groupid',$_GET['groupid']);
}
if( isset($_GET['hostid'])){
session_set('hostid',$_GET['hostid']);
}
$sql_host1=$sql_host2='';
if(isset($_GET['groupid']) && $_GET['groupid'] != 0){
$sql_host1=', hosts_groups hg ';
$sql_host2='hg.groupid='.$_GET['groupid'].' and hg.hostid=h.hostid AND';
}
$groups =get_groups();
$hosts = get_hosts($sql_host1,$sql_host2);
$hostInGroup=false;
foreach ($hosts as $key => $value){
if($value['hostid'] == session_get('hostid')){
$hostInGroup=true;
}
}
if($hostInGroup==false){ session_delete('hostid'); }
if(session_isset('hostid') && session_get('hostid')!=0){
$dataitems=get_items_by_hostid(session_get('hostid'));
}
if(isset($dataitems)){
$items=array();
foreach ($dataitems as $key => $value){
$value['key_']=get_string_between($value['key_'],'[',']');
$value['key_']=explode(',',$value['key_']);
$tmp=explode(' ',$value['name']);
foreach ($tmp as $vv){
if (strpos($vv, '$') !== false) {
$value['name']=str_replace($vv,$value['key_'][substr("$vv", 1, 1)-1],$value['name']);
}
}
$items[$key]['itemid']=$value['itemid'];
$items[$key]['name']=$value['name'];
}
}
db_close();
include_once("views/report.view.php");
?>