summaryrefslogtreecommitdiffstats
path: root/frontends/php
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-04 13:42:03 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-06-04 13:42:03 +0000
commit37d5d87fa9c1b4f2e9c1ff56aa9a903b04ba45fc (patch)
treebe498b8eb64e38ccdc3da50901c03039c956fb27 /frontends/php
parentb0d70e49ec39c7af96a13144fa6747b1b6eaeb20 (diff)
downloadzabbix-37d5d87fa9c1b4f2e9c1ff56aa9a903b04ba45fc.tar.gz
zabbix-37d5d87fa9c1b4f2e9c1ff56aa9a903b04ba45fc.tar.xz
zabbix-37d5d87fa9c1b4f2e9c1ff56aa9a903b04ba45fc.zip
- added constant ZBX_GUEST_USER (Artem)
- added user check on 'guest' to 'history' (Artem) git-svn-id: svn://svn.zabbix.com/trunk@4231 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r--frontends/php/include/config.inc.php6
-rw-r--r--frontends/php/include/defines.inc.php2
-rw-r--r--frontends/php/include/page_header.php4
-rw-r--r--frontends/php/include/perm.inc.php4
-rw-r--r--frontends/php/include/users.inc.php4
-rw-r--r--frontends/php/profile.php2
-rw-r--r--frontends/php/users.php2
7 files changed, 13 insertions, 11 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 1c633932..bf9e20f5 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -151,7 +151,7 @@ function TODO($msg) { echo "TODO: ".$msg.BR; } // DEBUG INFO!!!
else
{
$USER_DETAILS = array(
- "alias" =>"guest",
+ "alias" =>ZBX_GUEST_USER,
"userid"=>0,
"lang" =>"en_gb",
"type" =>"0",
@@ -1350,7 +1350,7 @@ $result =
global $USER_DETAILS;
$result = $default_value;
- if($USER_DETAILS["alias"]!="guest")
+ if($USER_DETAILS["alias"]!=ZBX_GUEST_USER)
{
$db_profiles = DBselect("select * from profiles where userid=".$USER_DETAILS["userid"]." and idx=".zbx_dbstr($idx));
$profile=DBfetch($db_profiles);
@@ -1383,7 +1383,7 @@ $result =
global $USER_DETAILS;
- if($USER_DETAILS["alias"]=="guest")
+ if($USER_DETAILS["alias"]==ZBX_GUEST_USER)
{
return;
}
diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
index 7deebe7a..d8d521e8 100644
--- a/frontends/php/include/defines.inc.php
+++ b/frontends/php/include/defines.inc.php
@@ -397,6 +397,8 @@
define('ZBX_PERIOD_DEFAULT', ZBX_MIN_PERIOD);
define('ZBX_HISTORY_COUNT',5);
+
+ define('ZBX_GUEST_USER','guest');
global $_GET, $_POST, $_COOKIE, $_REQUEST;
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index d776b53c..40e62c87 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -377,7 +377,7 @@ COpt::compare_files_with_menu($ZBX_MENU);
$help->SetTarget('_blank');
$page_header_r_col = array($help);
- if($USER_DETAILS["alias"] != "guest"){
+ if($USER_DETAILS["alias"] != ZBX_GUEST_USER){
$page_header_r_col[] = array("|",
new CLink(S_PROFILE, "profile.php", "small_font"),"|",
new CLink(S_LOGOUT, "index.php?reconnect=1", "small_font"));
@@ -443,7 +443,7 @@ COpt::compare_files_with_menu($ZBX_MENU);
$sub_menu_table->Show();
}
//------------------------------------- <HISTORY> ---------------------------------------
- if(isset($page['hist_arg'])){
+ if(isset($page['hist_arg']) && ($USER_DETAILS["alias"] != ZBX_GUEST_USER)){
$table = new CTable();
$table->SetClass('history');
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index c0351b5f..aeea6c43 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -71,7 +71,7 @@
if(!$USER_DETAILS)
{
- if(!($USER_DETAILS = DBfetch(DBselect("select u.* from users u where u.alias='guest'".
+ if(!($USER_DETAILS = DBfetch(DBselect("select u.* from users u where u.alias=".zbx_dbstr(ZBX_GUEST_USER).
" and ".DBid2nodeid('u.userid')."=$ZBX_LOCALNODEID"))))
{
$missed_user_guest = true;
@@ -90,7 +90,7 @@
else
{
$USER_DETAILS = array(
- "alias" =>"guest",
+ "alias" =>ZBX_GUEST_USER,
"userid"=>0,
"lang" =>"en_gb",
"type" =>"0",
diff --git a/frontends/php/include/users.inc.php b/frontends/php/include/users.inc.php
index 79e00d29..9027e17e 100644
--- a/frontends/php/include/users.inc.php
+++ b/frontends/php/include/users.inc.php
@@ -156,9 +156,9 @@
function delete_user($userid)
{
- if(DBfetch(DBselect('select * from users where userid='.$userid.' and alias=\'guest\'')))
+ if(DBfetch(DBselect('select * from users where userid='.$userid.' and alias='.zbx_dbstr(ZBX_GUEST_USER))))
{
- error("Cannot delete user 'guest'");
+ error("Cannot delete user '".ZBX_GUEST_USER."'");
return false;
}
diff --git a/frontends/php/profile.php b/frontends/php/profile.php
index a15f5f1e..de933354 100644
--- a/frontends/php/profile.php
+++ b/frontends/php/profile.php
@@ -30,7 +30,7 @@ include_once "include/page_header.php";
?>
<?php
- if($USER_DETAILS["alias"]=="guest")
+ if($USER_DETAILS["alias"]==ZBX_GUEST_USER)
{
access_deny();
}
diff --git a/frontends/php/users.php b/frontends/php/users.php
index 1c435a13..10fef70a 100644
--- a/frontends/php/users.php
+++ b/frontends/php/users.php
@@ -152,7 +152,7 @@ include_once "include/page_header.php";
$_REQUEST["password1"] = get_request("password1", null);
$_REQUEST["password2"] = get_request("password2", null);
- if(isset($_REQUEST["password1"]) && $_REQUEST["password1"] == "" && $_REQUEST["alias"]!="guest")
+ if(isset($_REQUEST["password1"]) && $_REQUEST["password1"] == "" && $_REQUEST["alias"]!=ZBX_GUEST_USER)
{
show_error_message(S_ONLY_FOR_GUEST_ALLOWED_EMPTY_PASSWORD);
}