2009-03-16 Evi Vanoost <vanooste@rcbi.rochester.edu>

* general/logoff.php: Cleaned up invalid html

	* general/login_page.php: Clean up ampersands
	
	* include/functions_html.php: Fixes bug #2661439
	
	* index.php: Style cleanup
	
	* godmode/modules/manage_network_templates.php: Export function
	gives a CSV file of the templates. Import pending although you
	can use it already to import back into pure SQL.

git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1539 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
guruevi 2009-03-16 17:50:06 +00:00
parent 683cb2f9fc
commit 5d69e0d636
6 changed files with 157 additions and 106 deletions

View File

@ -1,8 +1,22 @@
2009-03-16 Evi Vanoost <vanooste@rcbi.rochester.edu>
* general/logoff.php: Cleaned up invalid html
* general/login_page.php: Clean up ampersands
* include/functions_html.php: Fixes bug #2661439
* index.php: Style cleanup
* godmode/modules/manage_network_templates.php: Export function
gives a CSV file of the templates. Import pending although you
can use it already to import back into pure SQL.
2009-03-16 Jorge Gonzalez <jorgegonz@artica.es>
* include/help/en/help_planned_downtime.php,
include/help/es/help_planned_downtime.php: Added more information
about the scheduled downtime.
* include/help/en/help_planned_downtime.php,
include/help/es/help_planned_downtime.php: Added more information
about the scheduled downtime.
2009-03-16 Esteban Sanchez <estebans@artica.es>

View File

@ -20,7 +20,7 @@ $url = '?login=1';
//These variables come from index.php
if (!empty ($page) && !empty ($sec)) {
foreach ($_GET as $key => $value) {
$url .= '&'.$key.'='.$value;
$url .= '&amp;'.$key.'='.$value;
}
}
@ -71,8 +71,11 @@ echo '</td><td class="f9b">
</table>
</form>
</div>
<div id="ip">'.__('Your IP').': <b class="f10">'.$config["remote_addr"].'</b>
</div>
</div><script type="text/javascript">document.getElementById(\'nick\').focus();</script>';
<div id="ip">'.__('Your IP').': <b class="f10">'.$config["remote_addr"].'</b></div>
</div>';
?>
<script type="text/javascript" language="javascript">
/* <![CDATA[ */
document.getElementById('nick').focus();
/* ]]> */
</script>

View File

@ -16,27 +16,20 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
?>
<center>
<div class='databox' id='login'>
<h1 id='log'><?php echo __('Logged Out'); ?></h1>
<div class='databox' style='width: 400px;'>
<form method="post" action="index.php?login=1">
<table cellpadding='4' cellspacing='1' width='400'>
<tr><td align='left'>
<a href="index.php">
<img src="images/pandora_logo.png" border="0" alt="logo"></a><br>
<?php echo $pandora_version; ?>
</td><td valign='bottom'>
<?php echo __('Your session is over. Please close your browser window to close session on Pandora.<br><br>'); ?>
<div class="databox" id="login">
<h1 id="log"><?php echo __('Logged Out'); ?></h1>
<div class="databox" style="width: 400px;">
<table cellpadding="4" cellspacing="1" width="400">
<tr><td align="left">
<?php
echo '<a href="index.php">';
print_image ("images/pandora_logo.png", false, array ("alt" => "logo", "border" => 0));
echo '</a> '.$pandora_version;
?>
</td><td valign="bottom">
<?php echo __('Your session is over. Please close your browser window to close this Pandora session.').'<br /><br />'; ?>
</td></tr>
</table>
</form>
</div>
<div id="ip"><?php echo 'IP: <b class="f10">'.$REMOTE_ADDR.'</b>'; ?></div>
</div>
</center>
</div>

View File

@ -18,7 +18,7 @@
// Load global vars
require("include/config.php");
require_once ("include/config.php");
check_login ();
@ -29,67 +29,107 @@ if (! give_acl ($config['id_user'], 0, "PM")) {
exit;
}
if (isset($_GET["delete"])){ // if delete
$id_np = entrada_limpia ($_GET["delete"]);
$sql_delete= "DELETE FROM tnetwork_profile WHERE id_np = ".$id_np;
$result=mysql_query($sql_delete);
if (! $result)
echo "<h3 class='error'>".__('Not deleted. Error deleting data')."</h3>";
else
echo "<h3 class='suc'>".__('Deleted successfully')."</h3>";
if (isset ($_POST["delete_profile"])) { // if delete
$id_np = (int) get_parameter_post ("delete_profile", 0);
$sql = sprintf ("DELETE FROM tnetwork_profile WHERE id_np = %d", $id_np);
$result = process_sql ($sql);
print_error_message ($result, __('Template successfully deleted'), __('Error deleting template'));
}
if (isset ($_POST["export_profile"])) {
$id_np = (int) get_parameter_post ("export_profile", 0);
$profile_info = get_db_row ("tnetwork_profile", "id_np", $id_np);
$result=mysql_query($sql_delete);
}
echo "<h2>".__('Module management')." &gt; ";
echo __('Module template management')."</h2>";
$sql1='SELECT * FROM tnetwork_profile ORDER BY name';
$result=mysql_query($sql1);
$color=0;
if (mysql_num_rows($result)) {
echo "<table cellpadding='4' cellspacing='4' width='650' class='databox'>";
echo "<th>".__('Name')."</th>";
echo "<th>".__('Description')."</th>";
echo "<th>".__('Action')."</th>";
}
while ($row=mysql_fetch_array($result)){
if ($color == 1){
$tdcolor = "datos";
$color = 0;
if (empty ($profile_info)) {
print_error_message (false,'', __('This template does not exist'));
return;
}
//It's important to keep the structure and order in the same way for backwards compatibility.
$sql = sprintf ("SELECT components.name, components.description, components.type, components.max, components.min, components.module_interval,
components.tcp_port, components.tcp_send, components.tcp_rcv, components.snmp_community, components.snmp_oid,
components.id_module_group, components.id_modulo, components.plugin_user, components.plugin_pass, components.plugin_parameter,
components.max_timeout, components.history_data, components.min_warning, components.max_warning, components.min_critical,
components.max_critical, components.min_ff_event, comp_group.name AS group_name
FROM `tnetwork_component` AS components, tnetwork_profile_component AS tpc, tnetwork_component_group AS comp_group
WHERE tpc.id_nc = components.id_nc AND components.id_group = comp_group.id_sg AND tpc.id_np = %d", $id_np);
$components = get_db_all_rows_sql ($sql);
$row_names = array ();
$inv_names = array ();
//Find the names of the rows that we are getting and throw away the duplicate numeric keys
foreach ($components[0] as $row_name => $detail) {
if (is_numeric ($row_name)) {
$inv_names[] = $row_name;
} else {
$row_names[] = $row_name;
}
else {
$tdcolor = "datos2";
$color = 1;
}
echo "
<tr>
<td class='$tdcolor'>
<b><a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates_form&id_np=".$row["id_np"]."'>".$row["name"]."</a></b>
</td>
<td class='$tdcolor'>
".$row["description"]."
</td>
<td class='$tdcolor' align='center'>
<a href='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates&delete=".$row["id_np"]."'
onClick='if (!confirm(\' ".__('Are you sure?')."\'))
return false;'>
<img border='0' src='images/cross.png'></a>
</td>
</tr>";
while (@ob_end_clean()); //Clean up output buffering
//Send headers to tell the browser we're sending a file
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=".preg_replace ('/\s/', '_', $profile_info["name"]).".csv");
header("Pragma: no-cache");
header("Expires: 0");
//Then print the first line (row names)
echo '"'.implode ('","', $row_names).'"';
echo "\n";
//Then print the rest of the data. Encapsulate in quotes in case we have comma's in any of the descriptions
foreach ($components as $row) {
foreach ($inv_names as $bad_key) {
unset ($row[$bad_key]);
}
echo '"'.implode ('","', $row).'"';
echo "\n";
}
exit; //We're done here. The original page will still be there.
}
if (mysql_num_rows($result)) {
echo "</table>";
echo "<table width='650px'>";
echo "<h2>".__('Module management')." &gt; ".__('Module template management')."</h2>";
$result = get_db_all_rows_in_table ("tnetwork_profile", "name");
$table->cellpadding = 4;
$table->cellspacing = 4;
$table->width = "95%";
$table->class = "databox";
$table->head = array ();
$table->head[0] = __('Name');
$table->head[1] = __('Description');
$table->head[2] = __('Action');
$table->align = array ();
$table->align[2] = "center";
$table->data = array ();
foreach ($result as $row) {
$data = array ();
$data[0] = '<a href="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np='.$row["id_np"].'">'.safe_input ($row["name"]).'</a>';
$data[1] = safe_input ($row["description"]);
$data[2] = print_input_image ("delete_profile", "images/cross.png", $row["id_np"],'', true, array ('onclick' => 'if (!confirm(\''.__('Are you sure?').'\')) return false;', 'border' => 0));
$data[2] .= print_input_image ("export_profile", "images/lightning_go.png", $row["id_np"], '', true, array ('border' => 0));
array_push ($table->data, $data);
}
if (!empty ($table->data)) {
echo '<form method="post" action="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates">';
print_table ($table);
echo '</form>';
} else {
echo "<div class='nf'>".__('There are no defined network profiles')."</div>";
echo "<table>";
echo '<div class="nf" style="width:90%">'.__('There are no defined network profiles').'</div>';
}
unset ($table);
echo "<tr><td align='right'>";
echo "<form method=post action='index.php?sec=gmodules&sec2=godmode/modules/manage_network_templates_form&id_np=-1'>";
echo "<input type='submit' class='sub next' name='crt' value='".__('Create')."'>";
echo "</form></td></tr></table>";
echo '<form method="post" action="index.php?sec=gmodules&amp;sec2=godmode/modules/manage_network_templates_form&amp;id_np=-1">';
echo '<div style="width:90%; text-align:right;">';
print_submit_button (__('Create'), "crt", '', 'class="sub next"');
echo '</div></form>';
?>

View File

@ -41,14 +41,15 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
static $idcounter = array ();
//If duplicate names exist, it will start numbering. Otherwise it won't (for backwards compatibility)
//If duplicate names exist, it will start numbering. Otherwise it won't
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.'-'.$idcounter[$name];
} else {
$idcounter[$name] = 0;
}
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.$idcounter[$name]);
$attributes = "";
if (!empty ($script)) {
$attributes .= ' onchange="'.$script.'"';
@ -63,7 +64,7 @@ function print_select ($fields, $name, $selected = '', $script = '', $nothing =
$attributes .= ' disabled="disabled"';
}
$output .= '<select id="'.str_replace (array ("[", "]"), '', $name).'" name="'.$name.'"'.$attributes.'>';
$output .= '<select id="'.$id.'" name="'.$name.'"'.$attributes.'>';
if ($nothing != '' || empty ($fields)) {
if ($nothing == '') {
@ -284,13 +285,11 @@ function print_input_image ($name, $src, $value, $style = '', $return = false, $
foreach ($attrs as $attribute) {
if (isset ($options[$attribute])) {
$output .= $attribute.'="'.safe_input ($options[$attribute]).'" ';
$output .= ' '.$attribute.'="'.safe_input ($options[$attribute]).'"';
}
}
$output .= 'value="'.$value;
$output .= '" />';
$output .= ' value="'.$value.'" />';
if ($return)
return $output;
@ -697,16 +696,17 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
//If duplicate names exist, it will start numbering. Otherwise it won't
if (isset ($idcounter[$name])) {
$idcounter[$name]++;
$name = $name.$idcounter[$name];
} else {
$idcounter[$name] = 0;
}
$id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.$idcounter[$name]);
$output = '<input name="'.$name.'" type="checkbox" value="'.$value.'" '. ($checked ? 'checked="checked"': '');
$output .= ' id="checkbox-'.str_replace (array ("[", "]"), '', $name).'"'; //[ and ] are some of those things that can't be in an id string. Add more where necessary
$output .= ' id="checkbox-'.$id.'"';
if ($script != '') {
$output .= ' onClick="'. $script . '"';
$output .= ' onclick="'. $script . '"';
}
if ($disabled) {
@ -715,9 +715,11 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
$output .= ' />';
$output .= "\n";
if ($return)
return $output;
echo $output;
if ($return === false)
echo $output;
return $output;
}
/**
@ -733,9 +735,10 @@ function print_checkbox_extended ($name, $value, $checked, $disabled, $script, $
function print_checkbox ($name, $value, $checked = false, $return = false) {
$output = print_checkbox_extended ($name, $value, (bool) $checked, false, '', '', true);
if ($return)
return $output;
echo $output;
if ($return === false)
echo $output;
return $output;
}
/**

View File

@ -203,11 +203,9 @@ if ($config["pure"] == 0) {
}
// Check permissions
if (!is_writable("attachment")){
echo "<h3 class='error'>".__('Attachment directory is not writtable by HTTP Server')."</h3>";
echo '<p>';
echo __('Please check that {HOMEDIR}/attachment directory has write rights for HTTP server');
echo "</p>";
if (!is_writable ("attachment")){
echo '<h3 class="error">'.__('Attachment directory is not writable by HTTP Server').'</h3>';
echo '<p>'.__('Please check that the web server has write rights on the {HOMEDIR}/attachment directory').'</p>';
}
// Page loader / selector