home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.f-secure.com
/
2014.06.ftp.f-secure.com.tar
/
ftp.f-secure.com
/
support
/
hotfix
/
fsav-server
/
FSAVSRV900_HF07.fsfix
/
iuwebui
/
forms
/
tree_fsma
/
alerting.php
next >
Wrap
PHP Script
|
2010-09-07
|
11KB
|
277 lines
<?php
include ("..\common\commonphp.php");
$tab_name = "tabFSMAAlerting";
$Page_Settings = array( array(oid => '1.3.6.1.4.1.2213.11.1.18.2.5.1', type => GLOBAL_STR),
array(oid => '1.3.6.1.4.1.2213.11.1.18.2.5.2', type => GLOBAL_STR),
array(oid => '1.3.6.1.4.1.2213.11.1.18.2.5.3', type => GLOBAL_STR),
array(oid => '1.3.6.1.4.1.2213.11.1.18.20', type => GLOBAL_TBL));
$alert_config = array();
$smtp_forwards = array();
$my_smtp_forwards = array();
if(!isset($_POST[SUBMIT_TABLE]))
{
/* first load of the page */
readSettings(&$Page_Settings);
parse_fsma_alerting_table($Page_Settings[3][value], &$alert_config, &$smtp_forwards, &$my_smtp_forwards);
}
else
{
if($_POST[RESTORE_TABLE] == 1)
{
/* user wants to restore defaults */
readDefaultSettings(&$Page_Settings);
}
else
{
readSettings(&$Page_Settings);
readPageData(&$Page_Settings);
parse_fsma_alerting_table($Page_Settings[3][value], &$alert_config, &$smtp_forwards, &$my_smtp_forwards);
foreach($_POST["VAR"] as $severity => $content)
foreach($content as $product => $value)
{
if($value == 1)
$alert_config[$severity][$product] = $value;
else
unset($alert_config[$severity][$product]);
}
if($_POST[REMOVE_ITEM] != -1)
{
if (($tmp = $my_smtp_forwards[$_POST[REMOVE_ITEM]]) != null)
{
$oids = fsma_alerting_table_product_to_oids($tmp["product"]);
$email = $tmp["e-mail"];
$old_size = strlen($email);
foreach($smtp_forwards as $severity => $entry)
foreach($entry as $oid => $emails)
{
foreach ($oids as $oid2)
{
if ($oid2 != $oid)
continue;
$found_item = strpos($emails, $email);
if($found_item !== false)
{
if(strlen($emails) == $old_size)
unset($smtp_forwards[$severity][$oid]);
else if($found_item === 0)
$smtp_forwards[$severity][$oid] = substr_replace($smtp_forwards[$severity][$oid], '', 0, $old_size + 1);
else
$smtp_forwards[$severity][$oid] = substr_replace($smtp_forwards[$severity][$oid], '', $found_item - 1, $old_size + 1);
}
}
}
}
}
create_fsma_alerting_table(&$Page_Settings[3][value], $alert_config, $smtp_forwards);
if($_POST[SUBMIT_TABLE] == 1)
writeSettings($Page_Settings);
}
exit(0);
}
show_form_management($tab_name);
?>
<script language="javascript">
tabFSMAAlerting_remove_hit = function(item_index)
{
refreshed = true;
document.form_tabFSMAAlerting.REMOVE_ITEM.value = item_index;
document.form_tabFSMAAlerting.SUBMIT_TABLE.value = 1;
dojo.byId("tabFSMAAlerting_submitit").click();
}
<?php echo $tab_name;?>_settings_check = function()
{
var frm = document.form_<?php echo $tab_name;?>;
var msg = validate_string(frm.VAR_PAGE_SETTINGS_0.value);
if (msg == null)
{
msg = validate_string(frm.VAR_PAGE_SETTINGS_2.value);
}
if (msg == null)
{
msg = validate_string(frm.VAR_PAGE_SETTINGS_1.value);
}
if (msg != null)
{
show_webui_message_box(localized_strings.InvalidInput, msg, 0);
return false;
}
return true;
}
</script>
<form method="POST" action='<?php echo "{$_SERVER['PHP_SELF']}?{$_SERVER['QUERY_STRING']}";?>' id="form_<?php echo $tab_name;?>" name="form_<?php echo $tab_name;?>" style="padding: 0; margin: 0;">
<input type="hidden" name="SUBMIT_TABLE" value="0">
<input type="hidden" name="RESTORE_TABLE" value="0">
<input type="hidden" name="APPLY_SETTINGS" value="0">
<input type="hidden" name="REMOVE_ITEM" value="">
<button style='display:none' type='submit' id='tabFSMAAlerting_submitit'></button>
<?php show_action_menu('Alerts', $tab_name); ?>
<table border="0" cellspacing="5" cellpadding="0" class="main_page_table">
<tr>
<td valign="top" width=100%>
<table cellspacing="0" cellpadding="0" border="0" width=100% class="table_settings">
<tr class="table_heading">
<td width="10px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_left.gif" alt="" class="left_top"/></div></td>
<td align="left" width=155><div class="table_stats_heading"><span style='margin-left: 0px; padding-left: 0px;'><?=fsloc("Destinations")?></span></div></td>
<?php
for($entry = 0; $entry < 5; $entry++)
echo "<td align='center' width=100><table cellpadding=0 cellspacing=0><tr><td>{$fsma_severities[$entry]}<td width=20px align=right><img src='{$fsma_severityImages[$entry]}' border=0></table></td>";
?>
<td width="10px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_right.gif" alt="" class="right_top"/></div></td>
</tr>
<tr class="tr_setting"><td><td><?=fsloc("F-Secure Policy Manager")?></td>
<?php
for($entry = 0; $entry < 5; $entry++)
echo "
<td align=center><input type='hidden' name='VAR[{$entry}][1]' value='0'>
<input type='checkbox' name='VAR[{$entry}][1]' value='1' " . ($alert_config[$entry][1] == 1 ? 'checked' : '') . "></td>
";
?>
<td></tr><tr class="tr_setting"><td><td><?=fsloc("Windows Event Log")?>
<?php
for($entry = 0; $entry < 5; $entry++)
echo "
<td align=center><input type='hidden' name='VAR[{$entry}][4]' value='0'>
<input type='checkbox' name='VAR[{$entry}][4]' value='1' " . ($alert_config[$entry][4] == 1 ? 'checked' : '') . "></td>
";
?>
<td></tr>
</table>
<table cellspacing="0" cellpadding="0" border="0" width=100% class="table_settings">
<?php show_section_title('Sending alerts by SMTP');?>
<tr class="tr_setting"><td class="td_setting" width=200>
<?=$Page_Settings[0][lock];?>
<?=fsloc("SMTP server address:")?>
</td><td><input type="text" size=90 name="VAR_PAGE_SETTINGS_0" value="<?php echo htmlspecialchars($Page_Settings[0][value]);?>">
</td></tr><tr class="tr_setting">
<td class="td_setting">
<?=$Page_Settings[2][lock];?>
<?=fsloc("E-mail subject:")?>
</td><td><input type="text" size=90 name="VAR_PAGE_SETTINGS_2" value="<?php echo htmlspecialchars($Page_Settings[2][value]);?>">
</td></tr><tr class="tr_setting"><td class="td_setting">
<?=$Page_Settings[1][lock];?>
<?=fsloc("E-mail return address:")?>
</td><td><input type="text" size=90 name="VAR_PAGE_SETTINGS_1" value="<?php echo htmlspecialchars($Page_Settings[1][value]);?>">
</td></tr>
</table>
<?php
$products = array();
if (products_is_av4srv_installed())
{
$products["srv"] = "Anti-Virus for Windows Servers";
}
if (products_is_av4mse_installed())
{
$products["mse"] = "Anti-Virus for Microsoft Exchange";
}
$showProductName = count($products) > 1;
?>
<?php foreach ($products as $productID => $productName) {
$productForwards = 0;
if ($my_smtp_forwards)
foreach($my_smtp_forwards as $entry)
if ($productID == $entry["product"])
++$productForwards;
?>
<table border="0" cellpadding="0" cellspacing="0" width=100% class="table_settings">
<tr class="table_heading">
<td width="15px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_left.gif" alt="" class="left_top"/></div></td>
<td align="left" vAlign='top' width=300 <?=$showProductName ? "height=40" : ""?> >
<div class="table_stats_heading">
<span style='margin: 0px; padding: 0px;'>
<?=fsloc("Alert recipients")?>
</span>
<?php if ($showProductName) { ?>
<br>
<span style='margin: 0px; padding: 0px; position: relative; top: -7px; white-space:nowrap'>(<?=$productName?>)</span>
<?php } ?>
</div>
</td>
<?php
for($entry = 0; $entry < 5; $entry++)
echo "<td align='center' vAlign='center' width=120><div class='table_stats_heading'><span><img src='{$fsma_severityImages[$entry]}' border=0></span></div></td>";
?>
<td align="right" vAlign='center' style="width:200px" class="table_stats_heading">
<?php if ($global_can_edit) { ?>
<a href="javascript:;" style='padding: 0; margin: 0' onClick="EnableExtraDialog('/tree_fsma/popup_alerts.php?NewItem&0&<?=$productID?>');">
<img src='../pics/icon/add-16.png' border='0' style='position: relative; top: 3px; background: #F3F3F3;' />
<?=fsloc("Add new recipient...")?>
</a>
<?php } ?>
</td>
<td width="15px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_right.gif" alt="" class="right_top"/></div></td>
</tr>
<?php
if($productForwards == 0)
{
echo '<tr class="tr_setting">' .
($global_can_edit ? "<td class='td_setting' colspan=7>".fsloc("No recipients are specified.")."</td></tr>" : '</tr>');
}
else
{
$index = -1;
$tr_type = '';
/*echo "<pre>";
var_dump($smtp_forwards);
echo "</pre>";*/
foreach($my_smtp_forwards as $key=>$entry)
{
$index++;
if ($productID != $entry["product"])
continue;
$email_address = $entry["e-mail"];
$checked_array = $entry;
$tr_type = ($tr_type == '_odd') ? '_even' : '_odd';
$remove_text = $global_can_edit ? "<a href='javascript:;' onClick='javascript: tabFSMAAlerting_remove_hit(\"{$key}\");'>".fsloc('remove')."</a>" : ' ';
$locs = array(fsloc('Yes'), fsloc('No'));
echo "
<tr class='tr_setting$tr_type' style='line-height: 30px;'><td></td>
<td style='padding-left: 0px;'><a href='javascript:;' onClick='javascript: EnableExtraDialog(\"/tree_fsma/popup_alerts.php?EditItemFull&{$index}\");'>{$email_address}</a></td>
<td align='center' style='padding-left: 10px;'><font color=#4068b8>" . ($checked_array[0] ? $locs[0] : $locs[1]) . "</font></td>
<td align='center' style='padding-left: 10px;'><font color=#4068b8>" . ($checked_array[1] ? $locs[0] : $locs[1]) . "</font></td>
<td align='center' style='padding-left: 10px;'><font color=#4068b8>" . ($checked_array[2] ? $locs[0] : $locs[1]) . "</font></td>
<td align='center' style='padding-left: 10px;'><font color=#4068b8>" . ($checked_array[3] ? $locs[0] : $locs[1]) . "</font></td>
<td align='center' style='padding-left: 10px;'><font color=#4068b8>" . ($checked_array[4] ? $locs[0] : $locs[1]) . "</font></td>
<td align='right' style='padding-left: 0px;'>$remove_text</td><td> </td>
</tr>
";
}
}
?>
</table>
<?php } // foreach ?>
</td>
</tr>
<?php show_action_buttons($tab_name, true, true); ?>
</table>
</form>