summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-03-28 10:58:35 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-03-28 10:58:35 +0000
commitd900ed4f6e12a690ef20440933b9b3d37cf49af5 (patch)
tree7eb7c77c0ff3537dc0e469cf4c148aba577201ee /frontends/php/include
parentf9f07b4cae6072d0c9c40f02a2b7042c62d5857d (diff)
Better performance of right checking and other fixes.:w
git-svn-id: svn://svn.zabbix.com/trunk@2712 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/classes/graph.inc.php2
-rw-r--r--frontends/php/include/config.inc.php48
-rw-r--r--frontends/php/include/db.inc.php6
-rw-r--r--frontends/php/include/triggers.inc.php5
4 files changed, 53 insertions, 8 deletions
diff --git a/frontends/php/include/classes/graph.inc.php b/frontends/php/include/classes/graph.inc.php
index bd4700e4..2d52933e 100644
--- a/frontends/php/include/classes/graph.inc.php
+++ b/frontends/php/include/classes/graph.inc.php
@@ -296,7 +296,7 @@
$str=$str.$this->period2str($this->period);
- if($this->sizeX < 300)
+ if($this->sizeX < 500)
{
$fontnum = 2;
}
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 283143d2..96ffbad9 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -24,6 +24,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
<?php
// GLOBALS
$USER_DETAILS ="";
+ $USER_RIGHTS ="";
$ERROR_MSG ="";
$INFO_MSG ="";
// END OF GLOBALS
@@ -424,7 +425,31 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
function check_right($right,$permission,$id)
{
- global $USER_DETAILS;
+// global $USER_DETAILS;
+ global $USER_RIGHTS;
+
+ $default_permission="H";
+ $group_permission="";
+ $id_permission="";
+// echo $id,"<br>";
+// echo DBnum_rows($rights),"<br>";
+ if(isset($USER_RIGHTS[0]["name"]))
+ {
+ $default_permission="";
+ for($i=0;isset($USER_RIGHTS[$i]["name"]);$i++)
+ {
+// echo "*";
+ if($USER_RIGHTS[$i]["name"] == 'Default permission')
+ $default_permission=$default_permission.$USER_RIGHTS[$i]["permission"];
+ if(($USER_RIGHTS[$i]["name"] == $right)&&($row["id"]==0))
+ $group_permission=$group_permission.$USER_RIGHTS[$i]["permission"];
+ if(($USER_RIGHTS[$i]["name"] == $right)&&($row["id"]==$id))
+ $id_permission=$id_permission.$USER_RIGHTS[$i]["permission"];
+ }
+ }
+// echo $default_permission,"<br>";
+
+/*
$sql="select permission from rights where name='Default permission' and userid=".$USER_DETAILS["userid"];
$result=DBselect($sql);
@@ -466,6 +491,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
}
}
}
+*/
# id_permission
// echo "$id_permission|$group_permission|$default_permission<br>";
@@ -980,6 +1006,7 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
global $page;
global $PHP_AUTH_USER,$PHP_AUTH_PW;
global $USER_DETAILS;
+ global $USER_RIGHTS;
global $_COOKIE;
global $_REQUEST;
// global $sessionid;
@@ -1004,6 +1031,16 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
$sql="update sessions set lastaccess=".time()." where sessionid=".zbx_dbstr($sessionid);
DBexecute($sql);
$USER_DETAILS=DBfetch($result);
+
+ $result2=DBselect("select * from rights where userid=".$USER_DETAILS["userid"]);
+ $i=0;
+ while($row=DBfetch($result2))
+ {
+ $USER_RIGHTS[$i]["name"]=$row["name"];
+ $USER_RIGHTS[$i]["id"]=$row["id"];
+ $USER_RIGHTS[$i]["permission"]=$row["permission"];
+ $i++;
+ }
return;
}
else
@@ -1018,6 +1055,15 @@ function SDI($msg="SDI") { echo "DEBUG INFO: $msg ".BR; } // DEBUG INFO!!!
if(DBnum_rows($result)==1)
{
$USER_DETAILS=DBfetch($result);
+ $result2=DBselect("select * from rights where userid=".$USER_DETAILS["userid"]);
+ $i=0;
+ while($row=DBfetch($result2))
+ {
+ $USER_RIGHTS[$i]["name"]=$row["name"];
+ $USER_RIGHTS[$i]["id"]=$row["id"];
+ $USER_RIGHTS[$i]["permission"]=$row["permission"];
+ $i++;
+ }
return;
}
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index b32e5338..fa0f1607 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -25,8 +25,8 @@
// $DB_TYPE ="POSTGRESQL";
$DB_TYPE ="MYSQL";
$DB_SERVER ="localhost";
-// $DB_DATABASE ="zabbix";
- $DB_DATABASE ="osmiy";
+ $DB_DATABASE ="zabbix";
+// $DB_DATABASE ="osmiy";
$DB_USER ="root";
$DB_PASSWORD ="";
// END OF DATABASE CONFIGURATION
@@ -58,7 +58,7 @@
{
global $DB,$DB_TYPE;
-# echo $query,"<br>";
+// echo $query,"<br>";
if($DB_TYPE == "MYSQL")
{
diff --git a/frontends/php/include/triggers.inc.php b/frontends/php/include/triggers.inc.php
index 2da7658a..cd04bb27 100644
--- a/frontends/php/include/triggers.inc.php
+++ b/frontends/php/include/triggers.inc.php
@@ -665,7 +665,6 @@
$db_actions = DBselect("select distinct c.actionid from conditions c, triggers t".
" where c.conditiontype=".CONDITION_TYPE_TRIGGER.
- " where c.conditiontype=CONDITION_TYPE_TRIGGER".
" and c.value=t.triggerid");
while($db_action = DBfetch($db_actions))
{
@@ -980,7 +979,7 @@
foreach($hosts as $hostid)
{
$style = NULL;
- $db_host_triggers = DBselect("select t.value,t.lastchange from triggers t,functions f,items i".
+ $db_host_triggers = DBselect("select distinct t.value,t.lastchange from triggers t,functions f,items i".
" where f.triggerid=t.triggerid and i.itemid=f.itemid and t.status=".TRIGGER_STATUS_ENABLED.
" and i.hostid=$hostid and t.description=".zbx_dbstr($triggers["description"]));
if(DBnum_rows($db_host_triggers)==1)
@@ -992,7 +991,7 @@
else $style = "high";
if((time(NULL)-$host_trigger["lastchange"])<300) $style .= "_blink1";
- elseif((time(NULL)-$host_trigger["lastchange"])<900) $style .= "_blink3";
+ elseif((time(NULL)-$host_trigger["lastchange"])<900) $style .= "_blink2";
}
array_push($table_row,new CCol(SPACE,$style));
}