diff options
| author | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-12-08 14:49:35 +0000 |
|---|---|---|
| committer | osmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2006-12-08 14:49:35 +0000 |
| commit | 40a607e632c95fdac097c965d537eb12faed9d2b (patch) | |
| tree | f7bd972672339df21ce73d7ef60d105d37c193c2 /frontends/php/include/config.inc.php | |
| parent | 1ea1f204761ac4b7d6efc47c5808236227585735 (diff) | |
- [CRITICAL FIX] fixed permission system (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3582 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include/config.inc.php')
| -rw-r--r-- | frontends/php/include/config.inc.php | 97 |
1 files changed, 63 insertions, 34 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index 86d51247..11c55f6f 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -90,62 +90,74 @@ function VDP($var, $msg=null) { echo "DEBUG DUMP: "; if(isset($msg)) echo '"'.$m error($errstr.'['.$errfile.':'.$errline.']'); } + /********** START INITIALIZATION *********/ + set_error_handler('zbx_err_handler'); - read_configuration_file(); + global $ZBX_LOCALNODEID, $ZBX_CONFIGURATION_FILE, $DB_TYPE, $DB_SERVER, $DB_DATABASE, $DB_USER, $DB_PASSWORD; + + $ZBX_LOCALNODEID = 0; + + $ZBX_CONFIGURATION_FILE = './conf/zabbix.conf.php'; - $error = ''; - if(!DBconnect($error)) + if(file_exists($ZBX_CONFIGURATION_FILE)) { - global $_REQUEST; + include $ZBX_CONFIGURATION_FILE; - $_REQUEST['message'] = $error; - define('ZBX_DISTRIBUTED', false); - include_once "setup.php"; - } - unset($error); + $error = ''; + if(!DBconnect($error)) + { + global $_REQUEST; - global $ZBX_LOCALNODEID; + $_REQUEST['message'] = $error; + + define('ZBX_DISTRIBUTED', false); + $show_setup = true; + } + else + { + global $ZBX_LOCALNODEID; - /* Init LOCAL NODE ID */ - if($local_node_data = DBfetch(DBselect('select nodeid from nodes where nodetype=1 order by nodeid'))) - { - $ZBX_LOCALNODEID = $local_node_data['nodeid']; - define('ZBX_DISTRIBUTED', true); + /* Init LOCAL NODE ID */ + if($local_node_data = DBfetch(DBselect('select nodeid from nodes where nodetype=1 order by nodeid'))) + { + $ZBX_LOCALNODEID = $local_node_data['nodeid']; + define('ZBX_DISTRIBUTED', true); + } + else + { + define('ZBX_DISTRIBUTED', false); + } + unset($local_node_data); + } + unset($error); } else { - $ZBX_LOCALNODEID = 0; + define('ZBX_PAGE_NO_AUTHERIZATION', true); define('ZBX_DISTRIBUTED', false); + $show_setup = true; } - unset($local_node_data); - - function read_configuration_file($file='./conf/zabbix.conf.php') + if(isset($_COOKIE['ZBX_CONFIG'])) { - global $ZBX_CONFIGURATION_FILE; - - global $DB_TYPE, $DB_SERVER, $DB_DATABASE, $DB_USER, $DB_PASSWORD; - - $ZBX_CONFIGURATION_FILE = $file; + $show_setup = true; + } - if(!file_exists($file) || isset($_COOKIE['ZBX_CONFIG'])) - { - define('ZBX_DISTRIBUTED', false); - include_once "setup.php"; - } - else - { - include $ZBX_CONFIGURATION_FILE; - } + if(isset($show_setup)) + { + unset($show_setup); + include_once "setup.php"; } + /********** END INITIALIZATION ************/ + function access_deny() { include_once "include/page_header.php"; show_error_message(S_NO_PERMISSIONS); - + include_once "include/page_footer.php"; } @@ -1782,4 +1794,21 @@ else if (document.getElementById) else ImagePNG($image); } + + + /* function: + * zbx_setcookie + * + * description: + * set cookies after authorisation. + * require including of 'include/page_header.php' + * + * author: Eugene Grigorjev + */ + function zbx_setcookie($name, $value, $time=null) + { + global $ZBX_PAGE_COOCIES; + + $ZBX_PAGE_COOCIES[] = array($name, $value, $time); + } ?> |
