2009-02-13 Evi Vanoost <vanooste@rcbi.rochester.edu>

* general/logon_ok.php: Simplified and added correct ampersand tags
	
	* general/footer.php: Now use print_image function to print image
	
	* general/main_menu.php: Wrapped JS into CDATA
	
	* include/functions_events.php: Use print_image to print images. Use
	multibyte so Farsi/Arabian names don't mess up when cut. Also added
	&shy; tags every 8 characters to the Event Description so that long module
	names (like GigabitEthernet) don't break the table layout.
	
	* include/functions.php: Moved pandora_help to functions_ui.php, return
	valid refresh links and don't double encode safe_input (otherwise &amp;
	gets encoded as &amp;amp;)
	
	* include/functions_ui.php: Added print_help_icon and deprecated 
	pandora_help (new style function naming)
	
	* include/functions_html.php: Partially rewrote print_image for fully
	compatible functionality. Much simplified as well.
	
	* extensions/update_manager.php: Print out correct link and image tag
	
	* operation/agentes/networkmap.php: Is now correct HTML. Should work in
	all compliant browsers. If IE6 still doesn't work, upgrade
	
	* operation/agentes/tactical.php: Use print_image for images.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1456 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-02-13 20:23:44 +00:00
parent ef4af07eaf
commit 176f33d738
11 changed files with 187 additions and 118 deletions

View File

@ -1,3 +1,33 @@
2009-02-13 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/logon_ok.php: Simplified and added correct ampersand tags
* general/footer.php: Now use print_image function to print image
* general/main_menu.php: Wrapped JS into CDATA
* include/functions_events.php: Use print_image to print images. Use
multibyte so Farsi/Arabian names don't mess up when cut. Also added
&shy; tags every 8 characters to the Event Description so that long module
names (like GigabitEthernet) don't break the table layout.
* include/functions.php: Moved pandora_help to functions_ui.php, return
valid refresh links and don't double encode safe_input (otherwise &amp;
gets encoded as &amp;amp;)
* include/functions_ui.php: Added print_help_icon and deprecated
pandora_help (new style function naming)
* include/functions_html.php: Partially rewrote print_image for fully
compatible functionality. Much simplified as well.
* extensions/update_manager.php: Print out correct link and image tag
* operation/agentes/networkmap.php: Is now correct HTML. Should work in
all compliant browsers. If IE6 still doesn't work, upgrade
* operation/agentes/tactical.php: Use print_image for images.
2009-02-13 Sancho Lerena <slerena@artica.es>
* operation/events/events.php: Added new feature: Group similar event by

View File

@ -103,7 +103,7 @@ function pandora_update_manager_login () {
if (is_object ($package)) {
echo '<div class="notify">';
echo '<img src="images/information.png" /> ';
echo '<img src="images/information.png" alt="info" /> ';
echo __('There\'s a new update for Pandora');
echo '. <a href="index.php?sec=extensions&amp;sec2=extensions/update_manager">';
echo __('More info');

View File

@ -30,5 +30,7 @@ if ((isset($develop_bypass)) AND ($develop_bypass == 1)) {
echo ' - Saved '.format_numeric ($sql_cache["saved"]).' Queries';
}
echo '</a><br />';
echo '<a href="http://www.mozilla-europe.org/en/firefox/"><img src="images/firefox.png" align="middle" title="'.__('Pandora FMS console is best viewed with Firefox web browser').'" alt="'.__('Get Firefox').'" /></a>';
echo '<a href="http://www.mozilla-europe.org/en/firefox/">';
print_image ("images/firefox.png", false, array ("align" => "middle", "title" => __('Pandora FMS console is best viewed with Firefox web browser'), "alt" => __('Get Firefox')));
echo '</a>';
?>

View File

@ -76,14 +76,16 @@ $table->head = array ();
$table->data = array ();
$table->width = "100%";
$img = "reporting/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent=";
$table->data[0][0] ='<b>'.__('Monitor health').'</b>';
$table->data[1][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent='.$data["monitor_health"].'" title="'.$data["monitor_health"].'% '.__('of monitors up').'" />';
$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("title" => $data["monitor_health"].'% '.__('of monitors up')));
$table->data[2][0] = '<b>'.__('Module sanity').'</b>';
$table->data[3][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent='.$data["module_sanity"].'" title="'.$data["module_sanity"].'% '.__('of total modules inited').'" />';
$table->data[3][0] = print_image ($img.$data["module_sanity"], true, array ("title" => $data["module_sanity"].'% '.__('of total modules inited')));
$table->data[4][0] = '<b>'.__('Alert level').'</b>';
$table->data[5][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=280&mode=0&percent='.$data["alert_level"].'" title="'.$data["alert_level"].'% '.__('of defined alerts not fired').'" />';
$table->data[5][0] = print_image ($img.$data["alert_level"], true, array ("title" => $data["alert_level"].'% '.__('of defined alerts not fired')));
print_table ($table);
unset ($table);
@ -95,42 +97,42 @@ $cells = array ();
$cells[0][0] = __('Total agents');
$cells[0][1] = $data["total_agents"];
$cells[0]["color"] = "#000";
$cells[0]["href"] = "index.php?sec=estado&sec2=operation/agentes/estado_agente&refr=60";
$cells[0]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/estado_agente&amp;refr=60";
$cells[1][0] = __('Total checks');
$cells[1][1] = $data["total_checks"];
$cells[1]["color"] = "#000";
$cells[1]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=-1";
$cells[1]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=-1";
$cells[2][0] = __('Modules critical');
$cells[2][1] = $data["monitor_critical"];
$cells[2]["color"] = "#f00";
$cells[2]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=2";
$cells[2]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=2";
$cells[3][0] = __('Modules warning');
$cells[3][1] = $data["monitor_warning"];
$cells[3]["color"] = "#FFB900";
$cells[3]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=1";
$cells[3]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=1";
$cells[4][0] = __('Modules normal');
$cells[4][1] = $data["monitor_ok"];
$cells[4]["color"] = "#00ff00";
$cells[4]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=0";
$cells[4]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=0";
$cells[5][0] = __('Modules unknown');
$cells[5][1] = $data["monitor_unknown"];
$cells[5]["color"] = "#aaaaaa";
$cells[5]["href"] = "index.php?sec=estado&sec2=operation/agentes/status_monitor&refr=60&status=3";
$cells[5]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/status_monitor&amp;refr=60&amp;status=3";
$cells[6][0] = __('Alerts defined');
$cells[6][1] = $data["total_alerts"];
$cells[6]["color"] = "#000";
$cells[6]["href"] = "index.php?sec=estado&sec2=operation/agentes/alerts_status&refr=60";
$cells[6]["href"] = "index.php?sec=estado&amp;sec2=operation/agentes/alerts_status&amp;refr=60";
$cells[7][0] = __('Users defined');
$cells[7][1] = count (get_users ());
$cells[7]["color"] = "#000";
$cells[7]["href"] = "index.php?sec=usuarios&sec2=operation/users/user";
$cells[7]["href"] = "index.php?sec=usuarios&amp;sec2=operation/users/user";
foreach ($cells as $key => $row) {
//Switch class around
@ -148,7 +150,7 @@ echo '<div id="activity" style="width:700px;">';
// Show last activity from this user
echo "<h2>" . __('This is your last activity in Pandora FMS console') . "</h2>";
$table->width = '700px';
$table->width = 700; //Don't specify px
$table->data = array ();
$table->size = array ();
$table->size[2] = '130px';

View File

@ -138,6 +138,7 @@ require ("links_menu.php");
$config['jquery'][] = 'cookie';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
$(document).ready( function() {
$("img.toggle").click (function () {
$(this).siblings ("ul").toggle ();
@ -145,4 +146,5 @@ $(document).ready( function() {
return false;
});
});
/* ]]> */
</script>

View File

@ -22,22 +22,6 @@ require_once ('functions_ui.php');
define ('ENTERPRISE_NOT_HOOK', -1);
/**
* Prints a help tip icon.
*
* @param string $help_id Id of the help article
* @param bool $return Whether to return or output the result
*
* @return string The help tip
*/
function pandora_help ($help_id, $return = false) {
global $config;
$output = '&nbsp;<img class="img_help" src="images/help.png" onClick="pandora_help(\''.$help_id.'\')">';
if ($return)
return $output;
echo $output;
}
/**
* Cleans a string by encoding to UTF-8 and replacing the HTML
* entities. UTF-8 is necessary for foreign chars like asian
@ -54,7 +38,7 @@ function safe_input ($value) {
array_walk ($value, 'safe_input');
return $value;
}
return htmlentities (utf8_encode ($value), ENT_QUOTES, "UTF-8");
return htmlentities (utf8_encode ($value), ENT_QUOTES, "UTF-8", false);
}
/**
@ -1039,10 +1023,10 @@ function process_page_head ($string, $bitfield) {
/* Avoid the 1=1 */
if ($key == 1)
continue;
$query .= '&'.$key.'='.$value;
$query .= '&amp;'.$key.'='.$value;
}
foreach ($_POST as $key => $value) {
$query .= '&'.$key.'='.$value;
$query .= '&amp;'.$key.'='.$value;
}
$output .= '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query.'" />';

View File

@ -219,43 +219,44 @@ function print_events_table ($filter = "", $limit = 10, $width = 440, $return =
/* Colored box */
if ($event["estado"] == 0) {
$data[0] = '<img src="images/pixel_red.png" width="20" height="20" title="'.get_priority_name ($event["criticity"]).'" />';
$data[0] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
} else {
$data[0] = '<img src="images/pixel_green.png" width="20" height="20" title="'.get_priority_name ($event["criticity"]).'" />';
$data[0] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20, "title" => get_priority_name ($event["criticity"])));
}
/* Event type */
switch ($event["event_type"]) {
case "alert_recovered":
$data[1] = '<img src="images/error.png" title="'.__('Alert recovered').'" />';
$data[1] = print_image ("images/error.png", true, array ("title" => __('Alert recovered')));
break;
case "alert_manual_validation":
$data[1] = '<img src="images/eye.png" title="'.__('Alert manually validated').'" />';
$data[1] = print_image ("images/eye.png", true, array ("title" => __('Alert manually validated')));
break;
case "monitor_up":
$data[1] = '<img src="images/lightbulb.png" title="'.__('Monitor up').'" />';
$data[1] = print_image ("images/lightbulb.png", true, array ("title" => __('Monitor up')));
break;
case "monitor_down":
$data[1] = '<img src="images/lightbulb_off.png" title="'.__('Monitor down').'" />';
$data[1] = print_image ("images/lightbulb_off.png", true, array ("title" => __('Monitor down')));
break;
case "alert_fired":
$data[1] = '<img src="images/bell.png" title="'.__('Alert fired').'" />';
$data[1] = print_image ("images/bell.png", true, array ("title" => __('Alert fired')));
break;
case "system";
$data[1] = '<img src="images/cog.png" title="'.__('System').'" />';
$data[1] = print_image ("images/cog.png", true, array ("title" => __('System')));
break;
case "recon_host_detected";
$data[1] = '<img src="images/network.png" title="'.__('Host detected by recon server').'" />';
$data[1] = print_image ("images/network.png", true, array ("title" => __('Host detected by recon server')));
break;
default:
$data[1] = '<img src="images/err.png" title="'.$event["event_type"].'" />';
$data[1] = print_image ("images/err.png", true, array ("title" => $event["event_type"]));
break;
}
// Event description wrap around by default at 44 or ~3 lines (10 seems to be a good ratio to wrap around for most sizes. Smaller number gets longer strings)
$data[2] = '<span class="'.get_priority_class ($event["criticity"]).'f9" title="'.safe_input ($event["evento"]).'">'.safe_input (substr ($event["evento"],0, floor ($width / 10)));
$wrap = floor ($width / 10);
$data[2] = '<span class="'.get_priority_class ($event["criticity"]).'f9" title="'.safe_input ($event["evento"]).'">'.safe_input (chunk_split (mb_substr ($event["evento"],0, $wrap),8, "&shy;"));
if (strlen ($event["evento"]) > floor ($width / 10)) {
if (mb_strlen ($event["evento"]) > floor ($width / 10)) {
$data[2] .= "...";
}
$data[2] .= '</span>';

View File

@ -50,7 +50,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$attributes .= ' class="'.$class.'"';
}
if (!empty ($disabled)) {
$attributes .= ' disabled';
$attributes .= ' disabled="disabled"';
}
$output .= '<select id="'.$name.'" name="'.$name.'"'.$attributes.'>';
@ -58,7 +58,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
if ($nothing != '') {
$output .= '<option value="'.$nothing_value.'"';
if ($nothing_value == $selected) {
$output .= " selected";
$output .= ' selected="selected"';
}
//You should pass a translated string already
$output .= '>'.$nothing."</option>";
@ -71,9 +71,9 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
foreach ($fields as $value => $label) {
$output .= '<option value="'.$value.'"';
if (is_array ($selected) && in_array ($value, $selected)) {
$output .= ' selected';
$output .= ' selected="selected"';
} elseif (!is_array ($selected) && $value == $selected) {
$output .= ' selected';
$output .= ' selected="selected"';
}
if ($label === '') {
$output .= '>'.$value."</option>";
@ -169,7 +169,7 @@ function print_input_text_extended ($name, $value, $id, $alt, $size, $maxlength,
$output .= ' id="'.$htmlid.'"';
}
if ($disabled) //We want readonly, not disabled - disabled disables copying from the field as well
$output .= ' readonly';
$output .= ' readonly="readonly"';
if ($attributes != '')
$output .= ' '.$attributes;
@ -282,7 +282,7 @@ function print_submit_button ($label = 'OK', $name = '', $disabled = false, $att
$output .= '<input type="submit" id="submit-'.$name.'" name="'.$name.'" value="'. $label .'" '. $attributes;
if ($disabled)
$output .= ' disabled';
$output .= ' disabled="disabled"';
$output .= ' />';
if ($return)
return $output;
@ -333,7 +333,7 @@ function print_button ($label = 'OK', $name = '', $disabled = false, $script = '
*/
function print_textarea ($name, $rows, $columns, $value = '', $attributes = '', $return = false) {
$output = '<textarea id="textarea_'.$name.'" name="'.$name.'" cols="'.$columns.'" rows="'.$rows.'" '.$attributes.' >';
$output .= $value;
$output .= safe_input ($value);
$output .= '</textarea>';
if ($return)
@ -433,7 +433,7 @@ function print_table (&$table, $return = false) {
}
if (empty ($table->border)) {
$table->border = '0px';
$table->border = '0';
}
if (empty ($table->tablealign) || $table->tablealign != 'left' || $table->tablealign != 'right') {
@ -571,7 +571,7 @@ function print_radio_button_extended ($name, $value, $label, $checkedvalue, $dis
$output .= ' checked="checked"';
}
if ($disabled) {
$output .= ' disabled';
$output .= ' disabled="disabled"';
}
if ($script != '') {
$output .= ' onClick="'. $script . '"';
@ -624,7 +624,7 @@ function print_radio_button ($name, $value, $label = '', $checkedvalue = '', $re
* @return string HTML code if return parameter is true.
*/
function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $attributes, $return = false) {
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked': '');
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
$output .= ' id="checkbox-'.$name.'"';
if ($script != '') {
@ -632,7 +632,7 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
}
if ($disabled) {
$output .= ' disabled';
$output .= ' disabled="disabled"';
}
$output .= ' />';
@ -688,46 +688,66 @@ function print_help_tip ($text, $return = false) {
* @return string HTML code if return parameter is true.
*/
function print_image ($src, $return = false, $options = false) {
$output = '<img src="'.$src.'" ';
$output = '<img src="'.safe_input ($src).'" '; //safe input necessary to strip out html entities correctly
$style = '';
if ($options) {
if (!isset ($options['alt']))
$options['alt'] = ''; //Alt is one of those tags that has to be set for w3 compliance
$output .= 'alt="'.$options['alt'].'" ';
if (!empty ($options)) {
//Deprecated or value-less attributes
if (isset ($options["align"])) {
$style .= 'align:'.$options["align"].';'; //Align is deprecated, use styles.
}
if (isset ($options['border']))
$style .= 'border:'.$options['border'].';'; //Border is deprecated. Use styles
if (isset ($options["border"])) {
$style .= 'border:'.$options["border"].'px;'; //Border is deprecated, use styles
}
if (isset ($options["hspace"])) {
$style .= 'margin-left:'.$options["hspace"].'px;'; //hspace is deprecated, use styles
$style .= 'margin-right:'.$options["hspace"].'px;';
}
if (isset ($options['style']))
$style .= $options['style'];
if (isset ($options["ismap"])) {
$output .= 'ismap="ismap" '; //Defines the image as a server-side image map
}
if (isset ($options['title']))
$output .= 'title="'.$options['title'].'" ';
if (isset ($options["vspace"])) {
$style .= 'margin-top:'.$options["vspace"].'px;'; //hspace is deprecated, use styles
$style .= 'margin-bottom:'.$options["vspace"].'px;';
}
if (isset ($options["style"])) {
$style .= $options["style"];
}
if (isset ($options['width']))
$output .= 'width="'.$options['width'].'" ';
//Valid attributes (invalid attributes get skipped)
$attrs = array ("height", "longdesc", "usemap","width","id","class","title","lang","xml:lang",
"onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove",
"onmouseout", "onkeypress", "onkeydown", "onkeyup");
if (isset ($options['height']))
$output .= 'height="'.$options['height'].'" ';
if (isset ($options['class']))
$output .= 'class="'.$options['class'].'" ';
if (isset ($options['id']))
$output .= 'id="'.$options['id'].'" ';
if (isset ($options['onclick'])) {
$output .= 'onclick="'.$options['onclick'].'" ';
foreach ($attrs as $attribute) {
if (isset ($options[$attribute])) {
$output .= $attribute.'="'.safe_input ($options[$attribute]).'" ';
}
}
}
$output .= 'style="'.$style.'" />';
if (!isset ($options["alt"]) && isset ($options["title"])) {
$options["alt"] = $options["title"]; //Set alt to title if it's not set
} elseif (!isset ($options["alt"])) {
$options["alt"] = ''; //Alt is mandatory, empty string will do
}
if (!empty ($style)) {
$output .= 'style="'.$style.'" ';
}
if ($return)
return $output;
echo $output;
$output .= 'alt="'.safe_input ($options['alt']).'" />';
if (!$return) {
echo $output;
}
return $output;
}
/**

View File

@ -205,7 +205,7 @@ function print_os_icon ($id_os, $name = true, $return = false) {
*/
function print_agent_name ($id_agent, $return = false, $cutoff = 0) {
$agent_name = (string) get_agent_name ($id_agent);
$output = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agent.'" title="'.$agent_name.'"><b>';
$output = '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'" title="'.$agent_name.'"><b>';
if ($cutoff > 0 && (mb_strlen ($agent_name, "UTF-8") > $cutoff)) {
$output .= mb_substr (utf8_decode ($agent_name), 0, $cutoff, "UTF-8").'...';
} else {
@ -388,4 +388,26 @@ function print_alert_template_example ($id_alert_template, $return = false, $pri
echo $output;
}
/**
* DEPRECATED: Use print_help_icon to avoid confusion with pandora_help javascript function
*/
function pandora_help ($help_id, $return = false) {
return print_help_icon ($help_id, $return);
}
/**
* Prints a help tip icon.
*
* @param string $help_id Id of the help article
* @param bool $return Whether to return or output the result
*
* @return string The help tip
*/
function print_help_icon ($help_id, $return = false) {
$output = '&nbsp;'.print_image ("images/help.png", true, array ("class" => "img_help", "title" => __('Help'), "onclick" => "pandora_help ('".$help_id."')"));
if (!$return)
echo $output;
return $output;
}
?>

View File

@ -16,7 +16,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Load global vars
require ("include/config.php");
require_once ("include/config.php");
check_login ();
@ -253,11 +253,15 @@ $simple = (boolean) get_parameter ('simple', 0);
$regen = (boolean) get_parameter ('regen',1); // Always regen by default
$font_size = (int) get_parameter ('font_size', 12);
echo '<h2>'.__('Pandora Agents').' &gt; '.__('Network Map').'&nbsp';
echo '<h2>'.__('Pandora Agents').' &gt; '.__('Network Map').'&nbsp;';
if ($pure == 1) {
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=0"><img src="images/monitor.png" title="' . __('Normal screen') . '"></a>';
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;pure=0">';
print_image ("images/monitor.png", false, array ('title' => __('Normal screen'), 'alt' => __('Normal screen')));
echo '</a>';
} else {
echo '<a href="index.php?sec=estado&sec2=operation/agentes/networkmap&pure=1"><img src="images/monitor.png" title="' . __('Full screen') . '"></a>';
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;pure=1">';
print_image ("images/monitor.png", false, array ('title' => __('Normal screen'), 'alt' => __('Normal screen')));
echo '</a>';
}
echo '</h2>';
@ -269,7 +273,7 @@ $layout_array = array (
'spring2' => 'spring 2',
'flat' => 'flat');
echo '<form name="input" action="index.php?sec=estado&sec2=operation/agentes/networkmap&pure='.$pure.'" method="post">';
echo '<form action="index.php?sec=estado&amp;sec2=operation/agentes/networkmap&amp;pure='.$pure.'" method="post">';
echo '<table cellpadding="4" cellspacing="4" class="databox">';
echo '<tr>';
echo '<td valign="top">' . __('Layout') . ' &nbsp;';
@ -319,7 +323,7 @@ echo "</td>";
//echo ' Display groups <input type="checkbox" name="group" value="group" class="chk"/>';
echo '<td>';
echo '<input name="updbutton" type="submit" class="sub upd" value="'. __('Update'). '">';
print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"');
echo '</td></tr>';
echo '</table></form>';
@ -351,36 +355,35 @@ $filename_dot .= ".dot";
if ($regen != 1 && file_exists ($filename_img) && filemtime ($filename_img) > get_system_time () - 300) {
$result = true;
} else {
$fh = fopen ($filename_dot, 'w');
$fh = @fopen ($filename_dot, 'w');
if ($fh === false) {
$result = false;
break;
} else {
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd);
fclose ($fh);
unlink ($filename_dot);
}
fwrite ($fh, $graph);
$cmd = "$filter -Tcmapx -o".$filename_map." -Tpng -o".$filename_img." ".$filename_dot;
$result = system ($cmd);
fclose ($fh);
unlink ($filename_dot);
}
if ($result !== false) {
if (! file_exists ($filename_map)) {
echo '<h2 class="err">'.__('Map could not be generated').'</h2>';
echo $result;
echo "<br /> Apparently something went wrong reading the output.<br /> Is ".$filter." (usually part of GraphViz) installed and able to be executed by the webserver?";
echo "<br /> Is ".$config["attachment_store"]." writeable by the webserver?";
echo "<br /> Apparently something went wrong reading the output.<br />";
echo "<br /> Is ".$config["attachment_store"]." readable by the webserver process?";
return;
}
echo '<img src="'.$filename_img.'" usemap="#networkmap" />';
include ($filename_map);
print_image ($filename_img, false, array ("alt" => __('Network Map'), "usemap" => "#networkmap"));
require ($filename_map);
} else {
echo '<h2 class="err">'.__('Map could not be generated').'</h2>';
echo $result;
echo "<br /> Apparently something went wrong executing the command.";
echo "<br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver?";
echo "<br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
echo "<br /> Apparently something went wrong executing the command or writing the output.";
echo "<br /><br /> Is ".$filter." (usually part of GraphViz) and echo installed and able to be executed by the webserver process?";
echo "<br /><br /> Is your webserver restricted from executing command line tools through the <code>system()</code> call (PHP Safe Mode or SELinux)";
echo "<br /><br /> Is ".$config["attachment_store"]." writeable by the webserver process? To change this do the following (POSIX-based systems): chown &lt;apache user&gt; ".$config["attachment_store"];
return;
}
@ -388,6 +391,7 @@ $config['css'][] = 'cluetip';
$config['jquery'][] = 'cluetip';
?>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {
$("area[title!='<?php echo $pandora_name; ?>']").cluetip ({
arrows: true,
@ -395,4 +399,5 @@ $(document).ready (function () {
cluetipClass: 'default'
});
});
/* ]]> */
</script>

View File

@ -42,7 +42,7 @@ function print_cells_temp ($cells) {
if ($row[1] === 0) {
$row[1] = "-";
}
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.$row["href"].'" style="color: '.$row["color"].';">'.$row[1].'</a></td></tr>';
echo '<td class="'.$class.'" style="text-align:right;"><a class="big_data" href="'.safe_input ($row["href"]).'" style="color: '.$row["color"].';">'.$row[1].'</a></td></tr>';
}
}
@ -63,28 +63,30 @@ $table->head = array ();
$table->data = array ();
$table->style = array ();
$img = "reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent=";
$table->style[0] = "padding-top:4px; padding-bottom:4px;";
$table->data[0][0] ='<b>'.__('Monitor health').'</b>';
$table->style[1] = "padding-top:4px; padding-bottom:4px;";
$table->data[1][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent='.$data["monitor_health"].'" title="'.$data["monitor_health"].'% '.__('of monitors up').'" />';
$table->data[1][0] = print_image ($img.$data["monitor_health"], true, array ("title" => $data["monitor_health"].'% '.__('of monitors up')));
$table->style[2] = "padding-top:4px; padding-bottom:4px;";
$table->data[2][0] = '<b>'.__('Module sanity').'</b>';
$table->style[3] = "padding-top:4px; padding-bottom:4px;";
$table->data[3][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent='.$data["module_sanity"].'" title="'.$data["module_sanity"].'% '.__('of total modules inited').'" />';
$table->data[3][0] = print_image ($img.$data["module_sanity"], true, array ("title" => $data["module_sanity"].'% '.__('of total modules inited')));
$table->style[4] = "padding-top:4px; padding-bottom:4px;";
$table->data[4][0] = '<b>'.__('Alert level').'</b>';
$table->style[5] = "padding-top:4px; padding-bottom:4px;";
$table->data[5][0] = '<img src="reporting/fgraph.php?tipo=progress&height=20&width=260&mode=0&percent='.$data["alert_level"].'" title="'.$data["alert_level"].'% '.__('of defined alerts not fired').'" />';
$table->data[5][0] = print_image ($img.$data["alert_level"], true, array ("title" => $data["alert_level"].'% '.__('of defined alerts not fired')));
print_table ($table);
unset ($table);
echo '<table class="databox" cellpadding="4" cellspacing="4" style="width:100%;">';
echo '<table class="databox" cellpadding="4" cellspacing="4" width="100%">';
echo '<tr><th colspan="2">'.__('Monitor checks').'</th></tr>';
$cells = array ();
@ -180,18 +182,17 @@ if ($serverinfo) {
$data[0] = $server_info["name"];
if ($server_info["status"] == 0){
$data[1] = '<img src="images/pixel_red.png" width="20" height="20" />';
$data[1] = print_image ("images/pixel_red.png", true, array ("width" => 20, "height" => 20));
} else {
$data[1] = '<img src="images/pixel_green.png" width="20" height="20" />';
$data[1] = print_image ("images/pixel_green.png", true, array ("width" => 20, "height" => 20));
}
if ($server_info["modules"] > 0 && $total_modules > 0) {
$percent = $server_info["modules"] / ($total_modules / 100);
} else {
$percent = 0;
}
$data[2] = '<img src="reporting/fgraph.php?tipo=progress&percent='.$percent.'&height=18&width=80" title="'.$server_info["modules"]." ".__('of')." ".$total_modules.'" />';
$data[2] = print_image ("reporting/fgraph.php?tipo=progress&percent=".$percent."&height=18&width=80", true, array ("title" => $server_info["modules"]." ".__('of')." ".$total_modules));
$data[3] = $server_info["lag"]." / ".$server_info["module_lag"];
@ -210,7 +211,7 @@ if ($serverinfo) {
}
echo '</tbody></table>';
} else {
echo "<div class='nf'>".__('There are no servers configured into the database')."</div>";
echo '<div class="nf">'.__('There are no servers configured into the database').'</div>';
}
print_events_table ("", 10, 450);