diff options
-rw-r--r-- | frontends/php/css.css | 29 | ||||
-rw-r--r-- | frontends/php/images/general/error_small.gif | bin | 0 -> 875 bytes | |||
-rw-r--r-- | frontends/php/images/general/warning_small.gif | bin | 0 -> 863 bytes | |||
-rw-r--r-- | frontends/php/include/classes/cbutton.inc.php | 6 | ||||
-rw-r--r-- | frontends/php/include/config.inc.php | 101 | ||||
-rw-r--r-- | frontends/php/include/copt.lib.php | 41 | ||||
-rw-r--r-- | frontends/php/include/page_header.php | 13 | ||||
-rw-r--r-- | frontends/php/queue.php | 2 |
8 files changed, 100 insertions, 92 deletions
diff --git a/frontends/php/css.css b/frontends/php/css.css index 599dd1f9..95a04e12 100644 --- a/frontends/php/css.css +++ b/frontends/php/css.css @@ -274,6 +274,8 @@ table.tableinfo border-color: #0B198C; } table.tableinfo td { + white-space: nowrap; + word-spacing: nowrap; font-family:verdana, arial, helvetica, sans-serif; font-size:8pt; text-decoration: none; @@ -1040,3 +1042,30 @@ ul width: 100%; text-align: center; } + +ul.messages +{ + vertical-align: top; + border: 1px dashed #000000; + background-color: #FFFFFF; + margin: 5px; +} + +ul.messages li +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 8pt; +} + +ul.messages li.info +{ + color:#000000; + list-style: url('images/general/warning_small.gif') inside; +} + +ul.messages li.error +{ + color:#AA0000; + list-style: url('images/general/error_small.gif') inside; +} + diff --git a/frontends/php/images/general/error_small.gif b/frontends/php/images/general/error_small.gif Binary files differnew file mode 100644 index 00000000..a96ccf05 --- /dev/null +++ b/frontends/php/images/general/error_small.gif diff --git a/frontends/php/images/general/warning_small.gif b/frontends/php/images/general/warning_small.gif Binary files differnew file mode 100644 index 00000000..6f7cb414 --- /dev/null +++ b/frontends/php/images/general/warning_small.gif diff --git a/frontends/php/include/classes/cbutton.inc.php b/frontends/php/include/classes/cbutton.inc.php index dc37d085..42c31afa 100644 --- a/frontends/php/include/classes/cbutton.inc.php +++ b/frontends/php/include/classes/cbutton.inc.php @@ -86,11 +86,15 @@ var $do_redirect;*/ function CButtonQMessage($name, $caption, $msg=NULL, $vars=NULL, $do_redirect=true){ + $this->vars = null; + $this->msg = null; $this->name = $name; + $this->do_redirect = $do_redirect; + parent::CButton($name,$caption); + $this->SetMessage($msg); $this->SetVars($vars); - $this->do_redirect = $do_redirect; } function SetVars($value=NULL){ if(!is_string($value) && !is_null($value)){ diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php index e7890b66..a59214ee 100644 --- a/frontends/php/include/config.inc.php +++ b/frontends/php/include/config.inc.php @@ -28,10 +28,10 @@ function VDP($var, $msg=null) { echo "DEBUG DUMP: "; if(isset($msg)) echo '"'.$m require_once "include/copt.lib.php"; // GLOBALS + global $USER_DETAILS, $USER_RIGHTS; + $USER_DETAILS = array(); $USER_RIGHTS = array(); - $ERROR_MSG = array(); - $INFO_MSG = array(); // END OF GLOBALS // if magic quotes on then get rid of them @@ -117,6 +117,7 @@ function VDP($var, $msg=null) { echo "DEBUG DUMP: "; if(isset($msg)) echo '"'.$m } unset($local_node_data); + function read_configuration_file($file='conf/zabbix.conf.php') { global $ZBX_CONFIGURATION_FILE; @@ -166,29 +167,22 @@ function VDP($var, $msg=null) { echo "DEBUG DUMP: "; if(isset($msg)) echo '"'.$m function info($msg) { - global $INFO_MSG; + global $ZBX_MESSAGES; - if(is_array($INFO_MSG)) - { - array_push($INFO_MSG,$msg); - } - else - { - $INFO_MSG=array($msg); - } + if(is_null($ZBX_MESSAGES)) + $ZBX_MESSAGES = array(); + + array_push($ZBX_MESSAGES, array('type' => 'info', 'message' => $msg)); } function error($msg) { - global $ERROR_MSG; - if(is_array($ERROR_MSG)) - { - array_push($ERROR_MSG,$msg); - } - else - { - $ERROR_MSG=array($msg); - } + global $ZBX_MESSAGES; + + if(is_null($ZBX_MESSAGES)) + $ZBX_MESSAGES = array(); + + array_push($ZBX_MESSAGES, array('type' => 'error', 'message' => $msg)); } function fatal_error($msg) @@ -455,9 +449,7 @@ else function show_messages($bool=TRUE,$okmsg=NULL,$errmsg=NULL) { - global $ERROR_MSG; - global $INFO_MSG; - global $page; + global $page, $ZBX_MESSAGES; if(!isset($page["type"])) $page["type"] = PAGE_TYPE_HTML; @@ -491,56 +483,41 @@ else } } - if(is_array($INFO_MSG) && count($INFO_MSG)>0) - { - switch($page["type"]) - { - case PAGE_TYPE_IMAGE: - while($val = array_shift($INFO_MSG)) - { - array_push($message, array( - 'text' => $val, - 'color' => array('R'=>155,'G'=>155,'B'=>55), - 'font' => 2)); - $width = max($width, ImageFontWidth(2) * strlen($val) + 1); - $height += imagefontheight(2) + 1; - } - break; - case PAGE_TYPE_HTML: - echo "<p align=center class=\"info\">"; - while($val = array_shift($INFO_MSG)) - { - echo htmlspecialchars($val).BR; - } - echo "</p>"; - break; - } - } - if(is_array($ERROR_MSG) && count($ERROR_MSG)>0) + if(isset($ZBX_MESSAGES)) { - switch($page["type"]) + + if($page["type"] == PAGE_TYPE_IMAGE) { - case PAGE_TYPE_IMAGE: - while($val = array_shift($ERROR_MSG)) + foreach($ZBX_MESSAGES as $msg) + { + if($msg['type'] == 'error') { array_push($message, array( - 'text' => $val, + 'text' => $msg['message'], 'color' => array('R'=>255,'G'=>55,'B'=>55), 'font' => 2)); - $width = max($width, ImageFontWidth(2) * strlen($val) + 1); - $height += imagefontheight(2) + 1; } - break; - case PAGE_TYPE_HTML: - echo "<p align=center class=\"error\">"; - while($val = array_shift($ERROR_MSG)) + else { - echo htmlspecialchars($val).BR; + array_push($message, array( + 'text' => $msg['message'], + 'color' => array('R'=>155,'G'=>155,'B'=>55), + 'font' => 2)); } - echo "</p>"; - break; + $width = max($width, ImageFontWidth(2) * strlen($msg['message']) + 1); + $height += imagefontheight(2) + 1; + } + } + else + { + $lst_error = new CList(null,'messages'); + foreach($ZBX_MESSAGES as $msg) + $lst_error->AddItem($msg['message'], $msg['type']); + $lst_error->Show(false); + unset($lst_error); } + $ZBX_MESSAGES = null; } if($page["type"] == PAGE_TYPE_IMAGE && count($message) > 0) diff --git a/frontends/php/include/copt.lib.php b/frontends/php/include/copt.lib.php index 8ab70aae..ec1cb294 100644 --- a/frontends/php/include/copt.lib.php +++ b/frontends/php/include/copt.lib.php @@ -331,34 +331,21 @@ else } else { - if(version_compare(phpversion(),'5.0','<')) - { - eval(' - class COpt - { - /* public static */ function profiling_start($type=NULL) {} - /* public static */ function profiling_stop($type=NULL) {} - /* public static */ function savesqlrequest($sql) {} - /* public static */ function showmemoryusage($descr=null) {} - /* public static */ function compare_files_with_menu($menu=null) {} - /* public static */ function counter_up($type=NULL) {} - }' - ); - } - else + $static = null; + if(version_compare(phpversion(),'5.0','>=')) + $static = 'static'; + + eval(' + class COpt { - eval(' - class COpt - { - static function profiling_start($type=NULL) {} - static function profiling_stop($type=NULL) {} - static function savesqlrequest($sql) {} - static function showmemoryusage($descr=null) {} - static function compare_files_with_menu($menu=null) {} - static function counter_up($type=NULL) {} - }' - ); - } + '.$static.' function profiling_start($type=NULL) {} + '.$static.' function profiling_stop($type=NULL) {} + '.$static.' function savesqlrequest($sql) {} + '.$static.' function showmemoryusage($descr=null) {} + '.$static.' function compare_files_with_menu($menu=null) {} + '.$static.' function counter_up($type=NULL) {} + }' + ); } ?> diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php index 5f4e7b4b..a6345d65 100644 --- a/frontends/php/include/page_header.php +++ b/frontends/php/include/page_header.php @@ -198,7 +198,7 @@ COpt::profiling_start("page"); ), "admin"=>array( "label" => S_ADMINISTRATION, - "default_page_id" => 0, + "default_page_id" => 1, "pages"=>array( ZBX_DISTRIBUTED ? array("url"=>"nodes.php" ,"label"=>S_NODES) : null , array("url"=>"users.php" ,"label"=>S_USERS , @@ -407,4 +407,15 @@ COpt::compare_files_with_menu($ZBX_MENU); { access_deny(); } + + if(version_compare(phpversion(), '5.1.0RC1', '>=') && $page['type'] != PAGE_TYPE_IMAGE) + { + $tmezone = ini_get('date.timezone'); + if(empty($tmezone)) + { + info('Timezone for PHP is not set. Please set "date.timezone" option in php.ini.'); + date_default_timezone_set('UTC'); + } + unset($tmezone); + } ?> diff --git a/frontends/php/queue.php b/frontends/php/queue.php index e2211bde..48e56d45 100644 --- a/frontends/php/queue.php +++ b/frontends/php/queue.php @@ -54,7 +54,7 @@ include_once "include/page_header.php"; <?php $now = time(); - $result = DBselect("select i.itemid, i.nextcheck, i.description, i.key_, h.host,h.hostid ". + $result = DBselect("select i.itemid,i.nextcheck,i.description,i.key_,i.type,h.host,h.hostid ". " from items i,hosts h ". " where i.status=".ITEM_STATUS_ACTIVE." and i.type not in (".ITEM_TYPE_TRAPPER.") ". " and ((h.status=".HOST_STATUS_MONITORED." and h.available != ".HOST_AVAILABLE_FALSE.") ". |