summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-10 14:08:01 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-01-10 14:08:01 +0000
commita2183b603aa79005e2c01c41a9e04d719266832e (patch)
tree856ae6cb71128b83a9664e74bd0a45f865f527c9 /frontends/php/include
parent370568ec852e6db2190a16d51f4d24abdb17651e (diff)
downloadzabbix-a2183b603aa79005e2c01c41a9e04d719266832e.tar.gz
zabbix-a2183b603aa79005e2c01c41a9e04d719266832e.tar.xz
zabbix-a2183b603aa79005e2c01c41a9e04d719266832e.zip
- added login/logout information into auditlog (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3685 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/audit.inc.php2
-rw-r--r--frontends/php/include/config.inc.php39
-rw-r--r--frontends/php/include/db.inc.php2
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
-rw-r--r--frontends/php/include/page_header.php36
5 files changed, 47 insertions, 33 deletions
diff --git a/frontends/php/include/audit.inc.php b/frontends/php/include/audit.inc.php
index 71dbbabd..3c3f736e 100644
--- a/frontends/php/include/audit.inc.php
+++ b/frontends/php/include/audit.inc.php
@@ -58,6 +58,8 @@
{
global $USER_DETAILS;
+ if(!isset($USER_DETAILS["userid"])) check_authorisation();
+
$auditid = get_dbid("auditlog","auditid");
if(($result = DBexecute("insert into auditlog (auditid,userid,clock,action,resourcetype,details) ".
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 665329be..b97e12c5 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -152,6 +152,45 @@ function VDP($var, $msg=null) { echo "DEBUG DUMP: "; if(isset($msg)) echo '"'.$m
/********** END INITIALIZATION ************/
+ function init_nodes()
+ {
+ /* Init CURRENT NODE ID */
+ global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID;
+ global $ZBX_CURNODEID, $ZBX_CURMASTERID;
+
+ if(!defined('ZBX_PAGE_NO_AUTHERIZATION') && ZBX_DISTRIBUTED)
+ {
+ $ZBX_CURNODEID = get_cookie('current_nodeid', $ZBX_LOCALNODEID); // Selected node
+ if(isset($_REQUEST['switch_node']))
+ {
+ if($node_data = DBfetch(DBselect("select * from nodes where nodeid=".$_REQUEST['switch_node'])))
+ {
+ $ZBX_CURNODEID = $_REQUEST['switch_node'];
+ }
+ unset($node_data);
+ }
+
+ if($node_data = DBfetch(DBselect("select * from nodes where nodeid=".$ZBX_CURNODEID)))
+ {
+ $ZBX_CURMASTERID = $node_data['masterid'];
+ }
+
+ if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,null,PERM_RES_IDS_ARRAY,$ZBX_CURNODEID)) <= 0)
+ {
+ $denyed_page_requested = true;
+ $ZBX_CURNODEID = $ZBX_LOCALNODEID;
+ $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
+ }
+
+ zbx_setcookie("current_nodeid",$ZBX_CURNODEID);
+ }
+ else
+ {
+ $ZBX_CURNODEID = $ZBX_LOCALNODEID;
+ $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
+ }
+ }
+
function access_deny()
{
include_once "include/page_header.php";
diff --git a/frontends/php/include/db.inc.php b/frontends/php/include/db.inc.php
index 09069059..ad77bd19 100644
--- a/frontends/php/include/db.inc.php
+++ b/frontends/php/include/db.inc.php
@@ -463,6 +463,8 @@ if(isset($DB_TYPE) && $DB_TYPE == "ORACLE") {
{
global $ZBX_CURNODEID;
+ if(!isset($ZBX_CURNODEID)) init_nodes();
+
$row=DBfetch(DBselect("select max($field) as id from $table where ".DBid2nodeid($field)." in (".$ZBX_CURNODEID.")"));
if($row && !is_null($row["id"]))
{
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 456fa5c0..d97f6d14 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -1110,6 +1110,7 @@
"S_GENERAL"=> "General",
"S_AUDIT"=> "Audit",
"S_LOGIN"=> "Login",
+ "S_LOGOUT"=> "Logout",
"S_LATEST_DATA"=> "Latest data",
// Errors
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index e7213cdd..63b31928 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -25,6 +25,7 @@
global $USER_DETAILS;
global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID;
+ global $ZBX_CURNODEID, $ZBX_CURMASTERID;
global $page;
COpt::profiling_start("page");
@@ -58,40 +59,9 @@ COpt::profiling_start("page");
process_locales();
/* Init CURRENT NODE ID */
- global $ZBX_CURNODEID, $ZBX_CURMASTERID;
-
- if(!defined('ZBX_PAGE_NO_AUTHERIZATION') && ZBX_DISTRIBUTED)
- {
- $ZBX_CURNODEID = get_cookie('current_nodeid', $ZBX_LOCALNODEID); // Selected node
- if(isset($_REQUEST['switch_node']))
- {
- if($node_data = DBfetch(DBselect("select * from nodes where nodeid=".$_REQUEST['switch_node'])))
- {
- $ZBX_CURNODEID = $_REQUEST['switch_node'];
- }
- unset($node_data);
- }
-
- if($node_data = DBfetch(DBselect("select * from nodes where nodeid=".$ZBX_CURNODEID)))
- {
- $ZBX_CURMASTERID = $node_data['masterid'];
- }
-
- if(count(get_accessible_nodes_by_user($USER_DETAILS,PERM_READ_LIST,null,PERM_RES_IDS_ARRAY,$ZBX_CURNODEID)) <= 0)
- {
- $denyed_page_requested = true;
- $ZBX_CURNODEID = $ZBX_LOCALNODEID;
- $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
- }
-
- zbx_setcookie("current_nodeid",$ZBX_CURNODEID);
- }
- else
- {
- $ZBX_CURNODEID = $ZBX_LOCALNODEID;
- $ZBX_CURMASTERID = $ZBX_LOCMASTERID;
- }
+ init_nodes();
+ /* set Page header */
switch($page["type"])
{
case PAGE_TYPE_IMAGE: