summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorjames_wells <james_wells@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-18 03:17:13 +0000
committerjames_wells <james_wells@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2005-11-18 03:17:13 +0000
commitf7c2b61c66cc33bb15842c4db07b145ace7ba7e9 (patch)
tree82d878bee71b96b3ecd66eacfb1bf97788754c7d /frontends/php/include
parent715779b96fa92ec73fdb4e5d58791af6bb2e5683 (diff)
downloadzabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.tar.gz
zabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.tar.xz
zabbix-f7c2b61c66cc33bb15842c4db07b145ace7ba7e9.zip
Added preliminary host and user bulk loader. Still a lot more needs to be added.
zabbix/frontends/php/include/bulkloader.inc.php zabbix/frontends/php/include/config.inc.php zabbix/frontends/php/bulkloader.php Applied SNMPv3 fix zabbix/src/zabbix_server/poller/poller.c zabbix/src/zabbix_server/poller/checks_snmp.c Applied graph dropdown patch zabbix/frontends/php/charts.php zabbix/frontends/php/history.php zabbix/frontends/php/screens.php zabbix/frontends/php/include/graphs.inc.php git-svn-id: svn://svn.zabbix.com/trunk@2334 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/bulkloader.inc.php89
-rw-r--r--frontends/php/include/config.inc.php13
-rw-r--r--frontends/php/include/graphs.inc.php12
3 files changed, 97 insertions, 17 deletions
diff --git a/frontends/php/include/bulkloader.inc.php b/frontends/php/include/bulkloader.inc.php
new file mode 100644
index 00000000..a8a1a9aa
--- /dev/null
+++ b/frontends/php/include/bulkloader.inc.php
@@ -0,0 +1,89 @@
+<?php
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program 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. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+include_once "include/config.inc.php";
+
+/*
+** This include file contains all of the non-standard functions required
+** by the bulk loader system.
+**/
+
+ // This function takes a host group name and populates the database.
+ // Returns: 0 if unable to create, otherwise it returns the groupID
+ function create_Host_Group($group)
+ {
+ $sql="select * from groups where name='$group'";
+ $result=DBselect("select distinct(groupid) from groups where name='$name'");
+ if(DBnum_rows($result)>0)
+ {
+ $row=DBfetch($result);
+ return $row["groupid"];
+ }
+
+ $result=DBexecute("insert into groups (name) values ('$group')");
+ if($result)
+ {
+ return DBinsert_id($result,"groups","name");
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // This function takes a user group name and populates the database.
+ // Returns: 0 if unable to create, otherwise it returns the groupID
+ function create_User_Group($group)
+ {
+ $sql="select * from groups where name='$group'";
+ $result=DBselect("select distinct(usrgrpid) from usrgrp where name='$group'");
+ if(DBnum_rows($result)>0)
+ {
+ $row=DBfetch($result);
+ return $row["usrgrpid"];
+ }
+
+ $result=DBexecute("insert into usrgrp (name) values ('$group')");
+ if($result)
+ {
+ return DBinsert_id($result,"usrgrp","name");
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ // This function adds user to a user group based on ID numbers.
+ // Returns: 0 on failure, otherwise it returns 1
+ function add_User_To_Group($groupid=0,$userid=0)
+ {
+ if($groupid==0||$userid==0)
+ {
+ return 0;
+ }
+ $result=DBexecute("insert into users_groups (usrgrpid,userid) values ($groupid,$userid)");
+ if($result)
+ {
+ return 1;
+ }
+ return 0;
+ }
+
+?>
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index bea0bcad..4673149f 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1674,19 +1674,6 @@ echo "</head>";
}
}
- function add_group($group)
- {
- $result=DBexecute("insert into groups (name) values ('$group')");
- if($result)
- {
- return DBinsert_id($result,"groups","name");
- }
- else
- {
- return 0;
- }
- }
-
function add_host_group($name,$hosts)
{
// if(!check_right("Host","A",0))
diff --git a/frontends/php/include/graphs.inc.php b/frontends/php/include/graphs.inc.php
index f2d44c2a..14ea38cb 100644
--- a/frontends/php/include/graphs.inc.php
+++ b/frontends/php/include/graphs.inc.php
@@ -207,14 +207,16 @@
if(!isset($_REQUEST["period"])) $_REQUEST["period"]=3600;
if(!isset($_REQUEST["from"])) $_REQUEST["from"]=0;
- if(isset($_REQUEST["inc"])) $_REQUEST["period"]= $_REQUEST["period"]+$_REQUEST["inc"];
- if(isset($_REQUEST["dec"])) $_REQUEST["period"]= $_REQUEST["period"]-$_REQUEST["dec"];
+ if(isset($_REQUEST["inc"])) $workingperiod= $_REQUEST["period"]+$_REQUEST["inc"];
+ if(isset($_REQUEST["dec"])) $workingperiod= $workingperiod-$_REQUEST["dec"];
+ //if(isset($_REQUEST["inc"])) $_REQUEST["period"]= $_REQUEST["period"]+$_REQUEST["inc"];
+ //if(isset($_REQUEST["dec"])) $_REQUEST["period"]= $_REQUEST["period"]-$_REQUEST["dec"];
if(isset($_REQUEST["left"])) $_REQUEST["from"]= $_REQUEST["from"]+$_REQUEST["left"];
if(isset($_REQUEST["right"])) $_REQUEST["from"]= $_REQUEST["from"]-$_REQUEST["right"];
- unset($_REQUEST["inc"]);
- unset($_REQUEST["dec"]);
+ //unset($_REQUEST["inc"]);
+ //unset($_REQUEST["dec"]);
unset($_REQUEST["left"]);
unset($_REQUEST["right"]);
@@ -225,7 +227,9 @@
{
$_REQUEST["period"]=3600;
$_REQUEST["from"]=0;
+ $workingperiod=3600;
}
+ return $workingperiod;
}
function navigation_bar($url)