summaryrefslogtreecommitdiffstats
path: root/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'frontends')
-rw-r--r--frontends/php/css.css14
-rw-r--r--frontends/php/images/general/warning16r.gifbin0 -> 978 bytes
-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
-rw-r--r--frontends/php/index.php26
-rw-r--r--frontends/php/instal.php8
-rw-r--r--frontends/php/setup.php15
-rw-r--r--frontends/php/styles/table.css62
-rw-r--r--frontends/php/warning.php89
12 files changed, 216 insertions, 79 deletions
diff --git a/frontends/php/css.css b/frontends/php/css.css
index 57937def..764ac164 100644
--- a/frontends/php/css.css
+++ b/frontends/php/css.css
@@ -11,14 +11,14 @@
@import "styles/sbox.css";
body{
- background-color:#e5e5e5;
- margin: 0px;
- padding: 0px;
- color:black;
- font-family:verdana, arial, helvetica, sans-serif;
- font-size:10px;
+ background-color:#e5e5e5;
+ margin: 0px;
+ padding: 0px;
+ color:black;
+ font-family:verdana, arial, helvetica, sans-serif;
+ font-size:10px;
text-decoration: none;
- line-height:16px;
+ line-height:16px;
}
/**************** MEDIA *****************/
@media print {
diff --git a/frontends/php/images/general/warning16r.gif b/frontends/php/images/general/warning16r.gif
new file mode 100644
index 00000000..0a891fb8
--- /dev/null
+++ b/frontends/php/images/general/warning16r.gif
Binary files differ
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');
diff --git a/frontends/php/index.php b/frontends/php/index.php
index ccaafce0..8524d3d4 100644
--- a/frontends/php/index.php
+++ b/frontends/php/index.php
@@ -52,7 +52,8 @@
unset($sessionid);
Redirect("index.php");
- return;
+ die();
+// return;
}
if(isset($_REQUEST["enter"])&&($_REQUEST["enter"]=="Enter"))
@@ -60,12 +61,13 @@
$name = get_request("name","");
$password = md5(get_request("password",""));
- $row = DBfetch(DBselect("select u.userid,u.alias,u.name,u.surname,u.url,u.refresh from users u where".
- " u.alias=".zbx_dbstr($name)." and u.passwd=".zbx_dbstr($password).
- ' and '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
+ $row = DBfetch(DBselect('SELECT u.userid,u.alias,u.name,u.surname,u.url,u.refresh '.
+ ' FROM users u '.
+ ' WHERE u.alias='.zbx_dbstr($name).
+ ' AND u.passwd='.zbx_dbstr($password).
+ ' AND '.DBin_node('u.userid', $ZBX_LOCALNODEID)));
- if($row)
- {
+ if($row){
$sessionid = md5(time().$password.$name.rand(0,10000000));
zbx_setcookie('zbx_sessionid',$sessionid);
@@ -74,12 +76,16 @@
add_audit(AUDIT_ACTION_LOGIN,AUDIT_RESOURCE_USER,"Correct login [".$name."]");
- if(empty($row["url"]))
- {
- $row["url"] = "index.php";
+ if(empty($row["url"])){
+ global $USER_DETAILS;
+ $USER_DETAILS["alias"] = $row['alias'];
+ $USER_DETAILS['userid'] = $row['userid'];
+ $row["url"] = get_profile('web.menu.view.last','index.php');
+ unset($USER_DETAILS);
}
Redirect($row["url"]);
- return;
+ die();
+// return;
}
else
{
diff --git a/frontends/php/instal.php b/frontends/php/instal.php
index 0aa14caa..42cce4a2 100644
--- a/frontends/php/instal.php
+++ b/frontends/php/instal.php
@@ -19,11 +19,11 @@
**/
?>
<?php
- require_once "include/config.inc.php";
- require_once "include/forms.inc.php";
+require_once "include/config.inc.php";
+require_once "include/forms.inc.php";
- $page["title"] = "S_INSTALLATION";
- $page["file"] = "instal.php";
+$page["title"] = "S_INSTALLATION";
+$page["file"] = "instal.php";
include_once "include/page_header.php";
include_once "setup.php";
diff --git a/frontends/php/setup.php b/frontends/php/setup.php
index d7767c47..318acdcb 100644
--- a/frontends/php/setup.php
+++ b/frontends/php/setup.php
@@ -19,19 +19,19 @@
**/
?>
<?php
- require_once "include/config.inc.php";
- require_once "include/setup.inc.php";
+require_once "include/config.inc.php";
+require_once "include/setup.inc.php";
/* TMP !!! */
global $DB_SERVER;
/* ******** */
- $page["title"] = "S_INSTALLATION";
- $page["file"] = "setup.php";
+$page["title"] = "S_INSTALLATION";
+$page["file"] = "setup.php";
- if(!defined("PAGE_HEADER_LOADED"))
- define('ZBX_PAGE_NO_MENU', 1);
+if(!defined("PAGE_HEADER_LOADED"))
+ define('ZBX_PAGE_NO_MENU', 1);
?>
<?php
@@ -76,7 +76,7 @@ global $DB_SERVER;
if(isset($_REQUEST['cancel']) || isset($_REQUEST['finish']))
{
zbx_unsetcookie('ZBX_CONFIG');
- Redirect('index.php');
+ redirect('index.php');
exit;
}
@@ -133,7 +133,6 @@ include_once "include/page_header.php";
echo SBR;
$ZBX_SETUP_WIZARD->Show();
- global $_POST;
unset($_POST);
?>
<?php
diff --git a/frontends/php/styles/table.css b/frontends/php/styles/table.css
index 5768c4f4..c7db1303 100644
--- a/frontends/php/styles/table.css
+++ b/frontends/php/styles/table.css
@@ -852,8 +852,68 @@ table.server_info tr.status td{
white-space: nowrap;
word-spacing: 0px;
}
-/**************** SETUP WIZARD ***********/
+/**************** WARNING ***********/
+
+table.warning{
+ border-spacing: 0px; /* cellspacing */
+ border-collapse: collapse;
+ border-top: 2px gray solid;
+ border-left: 2px gray solid;
+ border-right: 2px #3F3F3F solid;
+ border-bottom: 2px #3F3F3F solid;
+ background-color:#EAEAEA;
+}
+
+table.warning td{
+ padding-left: 0;
+ padding-right: 0;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ line-height: 20px;
+}
+
+table.warning tr.header{
+ height: 24px;
+ border: 1px black solid;
+ background-color: #F00000;
+ color: white;
+ font-weight: bold;
+}
+table.warning tr.footer{
+ height: 34px;
+ border-top: 1px black dotted;
+}
+
+table.warning tr td.left{
+ padding-left: 10px;
+ padding-right: 5px;
+ white-space: nowrap;
+ word-spacing: 0px;
+ text-align: left;
+}
+table.warning tr td.right{
+ width: 100%;
+ padding-left: 5px;
+ padding-right: 10px;
+ text-align: right;
+ vertical-align: text-top;
+}
+table.warning tr.center td.left{
+ vertical-align: text-top;
+ padding-top: 0;
+}
+table.warning tr.center td.right{
+ padding: 5px;
+ vertical-align: middle;
+ text-align: center;
+ border-top: 2px gray inset;
+ border-left: 2px gray inset;
+ background-color: white;
+}
+/*****************************************/
+
+/**************** SETUP WIZARD ***********/
table.setup_wizard
{
width: 640px;
diff --git a/frontends/php/warning.php b/frontends/php/warning.php
new file mode 100644
index 00000000..b0adfc48
--- /dev/null
+++ b/frontends/php/warning.php
@@ -0,0 +1,89 @@
+<?php
+/*
+** ZABBIX
+** Copyright (C) 2000-2005 SIA Zabbix
+**
+** This program is free software; you can redistribute it and/or modify
+** it under the terms of the GNU General Public License as published by
+** the Free Software Foundation; either version 2 of the License, or
+** (at your option) any later version.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+**/
+?>
+<?php
+require_once "include/config.inc.php";
+
+$page["title"] = "S_WARNING";
+$page["file"] = "warning.php";
+
+define('ZBX_PAGE_DO_REFRESH',1);
+if(!defined("PAGE_HEADER_LOADED"))
+ define('ZBX_PAGE_NO_MENU', 1);
+
+$refresh_rate = 30; //seconds
+
+?>
+<?php
+ $fields=array(
+// VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION
+ "message"=> array(T_ZBX_STR, O_OPT, NULL, NULL, NULL),
+ "retry"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "cancel"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL)
+ );
+
+ check_fields($fields, false);
+?>
+<?php
+ if(isset($_REQUEST['cancel'])){
+ zbx_unsetcookie('ZBX_CONFIG');
+ redirect('index.php');
+ exit;
+ }
+// clear_messages();
+$USER_DETAILS["refresh"] = $refresh_rate;
+include_once "include/page_header.php";
+unset($USER_DETAILS);
+
+// if(isset($_REQUEST['message'])) show_error_message($_REQUEST['message']);
+
+ insert_showhint_javascript();
+
+ $table = new CTable(null, 'warning');
+ $table->SetAlign('center');
+ $table->AddOption('style','width: 480px; margin-top: 100px;');
+ $table->SetHeader(array(
+ new CCol(S_ZABBIX_VER, 'left'),
+ SPACE
+ ),'header');
+
+ $table->AddRow(SPACE);
+
+ $img = new CImg('./images/general/warning16r.gif','warning',16,16,'img');
+ $msg = new CSpan(bold(SPACE.S_ZABBIX_IS_UNAVAILABLE.'!'));
+ $msg->AddOption('style','line-height: 20px; vertical-align: top;');
+
+ $table->AddRow(new CCol(array(
+ $img,
+ $msg),
+ 'center'));
+ $table->AddRow(SPACE);
+
+ $table->SetFooter(new CCol(new CButton('retry',S_RETRY,'javascript: document.location.reload();'),'left'),'footer');
+
+ $table->Show();
+ zbx_add_post_js('setTimeout("document.location.reload();",'.($refresh_rate*1000).');');
+ echo SBR;
+?>
+<?php
+
+include_once "include/page_footer.php"
+
+?>