summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-10 16:09:31 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-01-10 16:09:31 +0000
commit4126039bc0cad4231822bbd07fe9dda5301ab423 (patch)
tree66eecffa8c7b5ec91b18ae8265a2f65873982e5e /frontends/php/include
parent8434d0ec57d5d159708c53dc26158647ab1dfd0e (diff)
- [DEV-94] added processing of the "database down" event (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5238 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/config.inc.php70
-rw-r--r--frontends/php/include/forms.inc.php4
-rw-r--r--frontends/php/include/locales/en_gb.inc.php1
-rw-r--r--frontends/php/include/page_header.php4
-rw-r--r--frontends/php/include/perm.inc.php2
5 files changed, 32 insertions, 49 deletions
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 64996a32..c096046a 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -90,7 +90,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
set_error_handler('zbx_err_handler');
- global $_COOKIE, $ZBX_LOCALNODEID, $ZBX_LOCMASTERID, $ZBX_CONFIGURATION_FILE, $DB_TYPE, $DB_SERVER, $DB_DATABASE, $DB_USER, $DB_PASSWORD;
+ global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID, $ZBX_CONFIGURATION_FILE, $DB_TYPE, $DB_SERVER, $DB_DATABASE, $DB_USER, $DB_PASSWORD;
global $ZBX_SERVER, $ZBX_SERVER_PORT;
$ZBX_LOCALNODEID = 0;
@@ -102,43 +102,36 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
unset($show_setup);
- if(file_exists($ZBX_CONFIGURATION_FILE) && !isset($_COOKIE['ZBX_CONFIG']))
- {
+ if(file_exists($ZBX_CONFIGURATION_FILE) && !isset($_COOKIE['ZBX_CONFIG'])){
include $ZBX_CONFIGURATION_FILE;
$error = '';
- if(!DBconnect($error))
- {
- global $_REQUEST;
-
+ if(!DBconnect($error)){
$_REQUEST['message'] = $error;
-
+
define('ZBX_DISTRIBUTED', false);
define('ZBX_PAGE_NO_AUTHERIZATION', true);
- $show_setup = true;
+
+ $show_warning = true;
}
- else
- {
+ else{
global $ZBX_LOCALNODEID, $ZBX_LOCMASTERID;
/* Init LOCAL NODE ID */
- if($local_node_data = DBfetch(DBselect('select * from nodes where nodetype=1 order by nodeid')))
- {
+ if($local_node_data = DBfetch(DBselect('select * from nodes where nodetype=1 order by nodeid'))){
$ZBX_LOCALNODEID = $local_node_data['nodeid'];
$ZBX_LOCMASTERID = $local_node_data['masterid'];
define('ZBX_DISTRIBUTED', true);
}
- else
- {
+ else{
define('ZBX_DISTRIBUTED', false);
}
unset($local_node_data);
}
unset($error);
}
- else
- {
+ else{
if(file_exists($ZBX_CONFIGURATION_FILE))
include $ZBX_CONFIGURATION_FILE;
@@ -147,15 +140,13 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$show_setup = true;
}
- if(!defined('ZBX_PAGE_NO_AUTHERIZATION'))
- {
+ if(!defined('ZBX_PAGE_NO_AUTHERIZATION')){
check_authorisation();
include_once "include/locales/".$USER_DETAILS["lang"].".inc.php";
process_locales();
}
- else
- {
+ else{
$USER_DETAILS = array(
"alias" =>ZBX_GUEST_USER,
"userid"=>0,
@@ -166,20 +157,20 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
"nodeid"=>0));
}
- if(isset($show_setup))
- {
+ if(isset($show_setup)){
unset($show_setup);
include_once "setup.php";
}
-
+ else if(isset($show_warning)){
+ unset($show_warning);
+ include_once "warning.php";
+ }
/********** END INITIALIZATION ************/
- function init_nodes()
- {
+ function init_nodes(){
/* Init CURRENT NODE ID */
- global $_REQUEST,
- $USER_DETAILS,
+ global $USER_DETAILS,
$ZBX_LOCALNODEID, $ZBX_LOCMASTERID,
$ZBX_CURRENT_NODEID, $ZBX_CURRENT_SUBNODES, $ZBX_CURMASTERID,
$ZBX_NODES,
@@ -318,15 +309,13 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
}
function get_request($name, $def=NULL){
- global $_REQUEST;
if(isset($_REQUEST[$name]))
return $_REQUEST[$name];
else
return $def;
}
- function info($msg)
- {
+ function info($msg){
global $ZBX_MESSAGES;
if(is_null($ZBX_MESSAGES))
@@ -335,8 +324,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
array_push($ZBX_MESSAGES, array('type' => 'info', 'message' => $msg));
}
- function error($msg)
- {
+ function error($msg){
global $ZBX_MESSAGES;
if(is_null($ZBX_MESSAGES))
@@ -345,37 +333,33 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
array_push($ZBX_MESSAGES, array('type' => 'error', 'message' => $msg));
}
- function clear_messages()
- {
+ function clear_messages(){
global $ZBX_MESSAGES;
$ZBX_MESSAGES = null;
}
- function &asort_by_key(&$array, $key)
- {
+ function asort_by_key(&$array, $key){
if(!is_array($array)) {
error('Incorrect type of asort_by_key');
return array();
}
+
$key = htmlspecialchars($key);
uasort($array, create_function('$a,$b', 'return $a[\''.$key.'\'] - $b[\''.$key.'\'];'));
return $array;
}
- function fatal_error($msg)
- {
+ function fatal_error($msg){
include_once "include/page_header.php";
show_error_message($msg);
include_once "include/page_footer.php";
}
- function str2mem($val)
- {
+ function str2mem($val){
$val = trim($val);
$last = strtolower($val{strlen($val)-1});
- switch($last)
- {
+ switch($last){
// The 'G' modifier is available since PHP 5.1.0
case 'g':
$val *= 1024;
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 10dbb609..8a847e78 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -879,14 +879,14 @@
$cmbLang->AddItem("nl_nl",S_DUTCH_NL);
$cmbLang->AddItem("fr_fr",S_FRENCH_FR);
$cmbLang->AddItem("de_de",S_GERMAN_DE);
+ $cmbLang->AddItem("hu_hu",S_HUNGARY_HU);
$cmbLang->AddItem("it_it",S_ITALIAN_IT);
+ $cmbLang->AddItem("ja_jp",S_JAPANESE_JP);
$cmbLang->AddItem("lv_lv",S_LATVIAN_LV);
$cmbLang->AddItem("pt_br",S_PORTUGUESE_PT);
$cmbLang->AddItem("ru_ru",S_RUSSIAN_RU);
$cmbLang->AddItem("sp_sp",S_SPANISH_SP);
$cmbLang->AddItem("sv_se",S_SWEDISH_SE);
- $cmbLang->AddItem("ja_jp",S_JAPANESE_JP);
- $cmbLang->AddItem("hu_hu",S_HUNGARY_HU);
$frmUser->AddRow(S_LANGUAGE, $cmbLang);
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index d858be68..56e5d1bc 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -169,6 +169,7 @@
'S_NEW_INSTALLATION'=> 'New installation',
'S_NEW_INSTALLATION_BIG'=> 'NEW INSTALLATION',
'S_INSTALLATION_UPDATE'=> 'Installation/Update',
+ 'S_ZABBIX_IS_UNAVAILABLE'=> 'ZABBIX is temporary unavailable',
// node.php
'S_TIME_ZONE'=> 'Time zone',
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index ae182e68..562fb54d 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -195,7 +195,7 @@ COpt::profiling_start("page");
array("url"=>"audit.php" ,"label"=>S_AUDIT ),
array("url"=>"report4.php" ,"label"=>S_NOTIFICATIONS ),
array("url"=>"instal.php" ,"label"=>S_INSTALLATION ,
- "sub_pages"=>array("setup.php"))
+ "sub_pages"=>array("setup.php","warning.php"))
)
),
"login"=>array(
@@ -528,6 +528,6 @@ COpt::compare_files_with_menu($ZBX_MENU);
}
unset($tmezone);
}
-
+
show_messages();
?>
diff --git a/frontends/php/include/perm.inc.php b/frontends/php/include/perm.inc.php
index c3451358..d8bd5cf8 100644
--- a/frontends/php/include/perm.inc.php
+++ b/frontends/php/include/perm.inc.php
@@ -101,8 +101,6 @@
if(isset($incorrect_session)) $message = "Session was ended, please relogin!";
else if(isset($missed_user_guest)) $message = "Database corrupted, missed default user 'guest'";
- global $_REQUEST;
-
if(!isset($_REQUEST['message'])) $_REQUEST['message'] = $message;
include('index.php');