summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-04 13:47:34 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-02-04 13:47:34 +0000
commit5b09df95f41c91dbbcfe8112c10ef6f5a297103b (patch)
treec90a3b50eafec54454d352282bf43ce119f13a32
parentdd34f50410dbf8ec37238b5a101c2610e5c808ac (diff)
downloadzabbix-5b09df95f41c91dbbcfe8112c10ef6f5a297103b.tar.gz
zabbix-5b09df95f41c91dbbcfe8112c10ef6f5a297103b.tar.xz
zabbix-5b09df95f41c91dbbcfe8112c10ef6f5a297103b.zip
- [DEV-103] fixed login right check for user "guest" (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5317 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--frontends/php/chart5.php3
-rw-r--r--frontends/php/chart_sla.php11
-rw-r--r--frontends/php/include/config.inc.php1
-rw-r--r--frontends/php/include/perm.inc.php46
-rw-r--r--frontends/php/srv_status.php8
5 files changed, 36 insertions, 33 deletions
diff --git a/frontends/php/chart5.php b/frontends/php/chart5.php
index 945fac9f..23b3347c 100644
--- a/frontends/php/chart5.php
+++ b/frontends/php/chart5.php
@@ -112,7 +112,6 @@ include_once "include/page_header.php";
$period_end = time();
$stat = calculate_service_availability($_REQUEST["serviceid"],$period_start,$period_end);
-
$problem[$i]=$stat["problem"];
$ok[$i]=$stat["ok"];
$count_now[$i]=1;
@@ -142,8 +141,8 @@ include_once "include/page_header.php";
for($i=1;$i<=52;$i++)
{
if(!isset($ok[$i-1])) continue;
+ $x2=($sizeX/52)*($i-1-$minX)*$sizeX/($maxX-$minX);
- $x2=(900/52)*$sizeX*($i-$minX-1)/($maxX-$minX);
$y2=$sizeY*($ok[$i-1]-$minY)/($maxY-$minY);
$y2=$sizeY-$y2;
diff --git a/frontends/php/chart_sla.php b/frontends/php/chart_sla.php
index ce0a2724..a4943a6b 100644
--- a/frontends/php/chart_sla.php
+++ b/frontends/php/chart_sla.php
@@ -81,11 +81,14 @@ include_once "include/page_header.php";
$problem=$stat["problem"];
$ok=$stat["ok"];
- $p=min($problem,20);
- $g=max($service["goodsla"]-80,0);
+// showen percentage period
+ $show_period = 20;
+
+ $p=min($problem,$show_period);
+ $g=max($service["goodsla"]-(100-$show_period),0);
- ImageFilledRectangle($im,$sizeX-$sizeX*$p/20,1,$sizeX-2,$sizeY-2,ImageColorAllocate($im,200,120,120));
- ImageLine($im,$sizeX*$g/20,1,$sizeX*$g/20,$sizeY-1,$yellow);
+ ImageFilledRectangle($im,$sizeX-$sizeX*$p/$show_period,1,$sizeX-2,$sizeY-2,ImageColorAllocate($im,200,120,120));
+ ImageLine($im,$sizeX*$g/$show_period,1,$sizeX*$g/$show_period,$sizeY-1,$yellow);
ImageRectangle($im,0,0,$sizeX-1,$sizeY-1,$black);
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index c0b6ee6a..5ecaa690 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -157,7 +157,6 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
if(!defined('ZBX_PAGE_NO_AUTHERIZATION')){
check_authorisation();
-
include_once "include/locales/".$USER_DETAILS["lang"].".inc.php";
process_locales();
}
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index 46afb302..300f1f03 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -46,40 +46,42 @@
$sessionid = get_cookie("zbx_sessionid");
- if( !is_null($sessionid))
+ if(!is_null($sessionid))
{
$login = $USER_DETAILS = DBfetch(DBselect('SELECT u.*,s.* FROM sessions s,users u'.
' WHERE s.sessionid='.zbx_dbstr($sessionid).
' AND s.userid=u.userid'.
' AND ((s.lastaccess+u.autologout>'.time().') OR (u.autologout=0))'.
' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
- if($login){
- $login = (check_perm2login($USER_DETAILS['userid']) && check_perm2system($USER_DETAILS['userid']));
- }
-
- if(!$login){
- $USER_DETAILS = NULL;
-
- zbx_unsetcookie('zbx_sessionid');
- DBexecute("delete from sessions where sessionid=".zbx_dbstr($sessionid));
- unset($sessionid);
-
- $incorrect_session = true;
- }
- else{
- zbx_setcookie("zbx_sessionid",$sessionid);
- DBexecute("update sessions set lastaccess=".time()." where sessionid=".zbx_dbstr($sessionid));
+ if(!$USER_DETAILS){
+ $incorect_session = true;
}
}
if(!$USER_DETAILS){
- if(!($USER_DETAILS = DBfetch(DBselect('SELECT u.* FROM users u '.
- ' WHERE u.alias='.zbx_dbstr(ZBX_GUEST_USER).
- ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)))))
- {
+ $login = $USER_DETAILS = DBfetch(DBselect('SELECT u.* FROM users u '.
+ ' WHERE u.alias='.zbx_dbstr(ZBX_GUEST_USER).
+ ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
+ if(!$USER_DETAILS){
$missed_user_guest = true;
}
}
+
+ if($login){
+ $login = (check_perm2login($USER_DETAILS['userid']) && check_perm2system($USER_DETAILS['userid']));
+ }
+
+ if(!$login){
+ $USER_DETAILS = NULL;
+
+ zbx_unsetcookie('zbx_sessionid');
+ DBexecute("delete from sessions where sessionid=".zbx_dbstr($sessionid));
+ unset($sessionid);
+ }
+ else{
+ zbx_setcookie("zbx_sessionid",$sessionid);
+ DBexecute("update sessions set lastaccess=".time()." where sessionid=".zbx_dbstr($sessionid));
+ }
if($USER_DETAILS){
$USER_DETAILS['node'] = DBfetch(DBselect('select * from nodes where nodeid='.id2nodeid($USER_DETAILS['userid'])));
@@ -100,7 +102,7 @@
"nodeid"=>0));
}
- if(isset($incorrect_session) || isset($missed_user_guest))
+ if(!$login || isset($incorrect_session) || isset($missed_user_guest))
{
if(isset($incorrect_session)) $message = "Session was ended, please relogin!";
else if(isset($missed_user_guest)){
diff --git a/frontends/php/srv_status.php b/frontends/php/srv_status.php
index 81360c85..4d30c8a7 100644
--- a/frontends/php/srv_status.php
+++ b/frontends/php/srv_status.php
@@ -54,8 +54,8 @@ include_once "include/page_header.php";
if( !($service = DBfetch(DBselect("select s.* from services s left join triggers t on s.triggerid=t.triggerid ".
" left join functions f on t.triggerid=f.triggerid left join items i on f.itemid=i.itemid ".
" where (i.hostid is null or i.hostid not in (".$denyed_hosts.")) ".
- ' and '.DBin_node('s.serviceid').
- " and s.serviceid=".$_REQUEST["serviceid"]
+ ' and '.DBin_node('s.serviceid').
+ " and s.serviceid=".$_REQUEST["serviceid"]
))))
{
access_deny();
@@ -81,7 +81,7 @@ include_once "include/page_header.php";
' LEFT JOIN functions f ON t.triggerid=f.triggerid '.
' LEFT JOIN items i ON f.itemid=i.itemid '.
' WHERE '.DBin_node('s.serviceid').
- ' AND (i.hostid is null or i.hostid not in ('.$denyed_hosts.')) '.
+ ' AND (i.hostid is null or i.hostid not in ('.$denyed_hosts.')) '.
' ORDER BY s.sortorder, sl_p.serviceupid, s.serviceid';
$result=DBSelect($query);
@@ -121,7 +121,7 @@ include_once "include/page_header.php";
$row['reason'] = new CList(null,"itservices");
$result2=DBselect("select s.triggerid,s.serviceid from services s, triggers t ".
" where s.status>0 and s.triggerid is not NULL and t.triggerid=s.triggerid ".
- ' and '.DBin_node('s.serviceid').
+ ' and '.DBin_node('s.serviceid').
" order by s.status desc,t.description");
while($row2=DBfetch($result2)){