".S_NO_PERMISSIONS.""); show_footer(); exit; } ?> [Success for '$hosts_ok']
[Failed for '$hosts_notok'","Cannot add item"); unset($_REQUEST["itemid"]); } else if($_REQUEST["register"]=="delete") { delete_item_from_templates($_REQUEST["itemid"]); $result=delete_item($_REQUEST["itemid"]); show_messages($result, S_ITEM_DELETED, S_CANNOT_DELETE_ITEM); unset($_REQUEST["itemid"]); } else if($_REQUEST["register"]=="Delete selected") { $result=DBselect("select itemid from items where hostid=".$_REQUEST["hostid"]); while($row=DBfetch($result)) { // $$ is correct here if(isset($_REQUEST[$row["itemid"]])) { delete_item_from_templates($row["itemid"]); $result2=delete_item($row["itemid"]); } } show_messages(TRUE, S_ITEMS_DELETED, S_CANNOT_DELETE_ITEMS); } else if($_REQUEST["register"]=="Activate selected") { $result=DBselect("select itemid from items where hostid=".$_REQUEST["hostid"]); while($row=DBfetch($result)) { // $$ is correct here if(isset($_REQUEST[$row["itemid"]])) { $result2=activate_item($row["itemid"]); } } show_messages(TRUE, S_ITEMS_ACTIVATED, S_CANNOT_ACTIVATE_ITEMS); } if($_REQUEST["register"]=="Disable selected") { $result=DBselect("select itemid from items where hostid=".$_REQUEST["hostid"]); while($row=DBfetch($result)) { // $$ is correct here if(isset($_REQUEST[$row["itemid"]])) { $result2=disable_item($row["itemid"]); } } show_messages(TRUE, S_ITEMS_DISABLED, S_CANNOT_DISABLE_ITEMS); } } ?> "; $h2=$h2.form_select("groupid",0,S_ALL_SMALL); $result=DBselect("select groupid,name from groups order by name"); while($row=DBfetch($result)) { // Check if at least one host with read permission exists for this group $result2=DBselect("select h.hostid,h.host from hosts h,hosts_groups hg where hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid and h.status<>".HOST_STATUS_DELETED." group by h.hostid,h.host order by h.host"); $cnt=0; while($row2=DBfetch($result2)) { if(!check_right("Host","U",$row2["hostid"])) { continue; } $cnt=1; break; } if($cnt!=0) { $h2=$h2.form_select("groupid",$row["groupid"],$row["name"]); } } $h2=$h2.""; $h2=$h2." ".S_HOST." "; $h2=$h2.""; $h2=$h2." | "; $h2=$h2.""; show_header2($h1, $h2, "
", "
"); ?> setHeader(array(S_ID,S_KEY,S_DESCRIPTION,nbsp(S_UPDATE_INTERVAL),S_HISTORY,S_TRENDS,S_TYPE,S_STATUS,S_ERROR)); // $h="
"; // $h=$h.""; // $table->setAfterHeader($h); $result=DBselect("select h.host,i.key_,i.itemid,i.description,h.port,i.delay,i.history,i.lastvalue,i.lastclock,i.status,i.nextcheck,h.hostid,i.type,i.trends,i.error from hosts h,items i where h.hostid=i.hostid and h.hostid=".$_REQUEST["hostid"]." order by h.host,i.key_,i.description"); $col=0; while($row=DBfetch($result)) { if(!check_right("Item","R",$row["itemid"])) { continue; } $key=iif(check_right("Item","U",$row["itemid"]), "".$row["key_"]."",$row["key_"]); $input=" ".$row["itemid"]; switch($row["type"]) { case 0: $type=S_ZABBIX_AGENT; break; case 7: $type=S_ZABBIX_AGENT_ACTIVE; break; case 1: $type=S_SNMPV1_AGENT; break; case 2: $type=S_ZABBIX_TRAPPER; break; case 3: $type=S_SIMPLE_CHECK; break; case 4: $type=S_SNMPV2_AGENT; break; case 6: $type=S_SNMPV3_AGENT; break; case 5: $type=S_ZABBIX_INTERNAL; break; default: $type=S_UNKNOWN; break; } switch($row["status"]) { case 0: $status=new CCol(new CLink(S_ACTIVE, "items.php?itemid=".$row["itemid"]."&hostid=".$_REQUEST["hostid"]."®ister=changestatus&status=1","off"),"off"); break; case 1: $status=new CCol(new CLink(S_ACTIVE, "items.php?itemid=".$row["itemid"]."&hostid=".$_REQUEST["hostid"]."®ister=changestatus&status=0","on"),"on"); break; case 3: $status=new CCol(S_NOT_SUPPORTED,"unknown"); break; default: $status=S_UNKNOWN; } if($row["error"] == "") { $error=new CCol(" ","off"); } else { $error=new CCol($row["error"],"on"); } $table->AddRow(array( $input, $key, $row["description"], $row["delay"], $row["history"], $row["trends"], $type, $status, $error )); } // $table->show(); $footerButtons = array(); array_push($footerButtons, new CButton('register','Activate selected', "return Confirm('".S_ACTIVATE_SELECTED_ITEMS_Q."');")); array_push($footerButtons, new CButton('register','Disable selected', "return Confirm('".S_DISABLE_SELECTED_ITEMS_Q."');")); array_push($footerButtons, new CButton('register','Delete selected', "return Confirm('".S_DELETE_SELECTED_ITEMS_Q."');")); $table->SetFooter(new CCol($footerButtons),'table_footer'); $form = new CForm('items.php'); $form->AddVar('hostid',$_REQUEST["hostid"]); $form->AddItem($table); $form->Show(); // $h=""; // $h=$h.""; // $h=$h.""; // $h=$h."
"; // show_table_header($h); } } ?> 0) { insert_item_form(); } } ?>