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.jar / iuwebui / forms / tree_fsma / matchlists.php < prev    next >
PHP Script  |  2010-09-07  |  7KB  |  174 lines

  1. <?php 
  2.     include ("..\common\commonphp.php");
  3.  
  4.     $Page_Settings = array(    array(oid => '1.3.6.1.4.1.2213.20.1.100.40.10', type => GLOBAL_TBL));
  5.     
  6.     $MatchlistTypes = array(fsloc('Keywords'), fsloc('File patterns'), fsloc('Email addresses'));
  7.     
  8.     $oid_base = '1.3.6.1.4.1.2213.20.1';
  9.     
  10.     $Page_Affected_Settings = array(
  11.         '200.10.10.20', '200.10.10.30', '200.10.10.70', '200.10.10.290',
  12.         '200.10.20.20', '200.10.20.30', '200.10.20.130', '200.10.20.290',
  13.         '200.10.30.20', '200.10.30.30', '200.10.30.110', '200.10.50.110',
  14.         '200.10.50.130', '200.10.50.230', '200.10.60.20', '200.10.60.30',
  15.         '200.10.70.122', '200.10.70.123', '200.10.70.132', '200.10.70.133',
  16.         '200.10.110.10', '200.10.110.20', '200.20.10.20', '200.20.10.30',
  17.         '200.20.10.70', '200.20.10.290', '200.20.20.20', '200.20.20.30',
  18.         '200.20.20.130', '200.20.20.290', '200.20.30.20', '200.20.30.30',
  19.         '200.20.30.110', '200.20.50.110', '200.20.50.130', '200.20.50.230',
  20.         '200.20.60.20', '200.20.60.30', '200.20.110.10', '200.20.110.20',
  21.         '200.30.10.20', '200.30.10.30', '200.30.10.70', '200.30.10.290',
  22.         '200.30.20.20', '200.30.20.30', '200.30.20.130', '200.30.20.290',
  23.         '200.30.30.20', '200.30.30.30', '200.30.30.110', '200.30.50.110',
  24.         '200.30.50.130', '200.30.50.230', '200.30.60.20', '200.30.60.30',
  25.         '200.30.110.10', '200.30.110.20', 
  26.  
  27.         '300.10.20.80', '300.10.20.90',    '300.10.20.330', '300.10.30.20', 
  28.         '300.10.30.30', '300.10.50.110', '300.10.50.130', '300.30.10.20', 
  29.         '300.30.10.30', '300.30.10.70', '300.30.20.20', '300.30.20.30', 
  30.         '300.30.20.130', '300.30.30.20','300.30.30.30', '300.30.30.110', 
  31.         '300.30.50.110', '300.30.50.130'
  32.     );
  33.  
  34.     $tab_name = "tabFSMAMatchLists";
  35.     
  36.     $AFFECTED = array();
  37.     
  38.      if(!isset($_POST[SUBMIT_TABLE]))
  39.     {
  40.         /* first load of the page */
  41.         readSettings(&$Page_Settings);
  42.         foreach($Page_Affected_Settings as $entry)
  43.         {
  44.             settings_get_str($oid_base . '.' . $entry, &$value);
  45.             if($value != '')
  46.                 $AFFECTED[$value] = 1;
  47.         }
  48.         // not allowed to remove defaults
  49.         $PageDefSettings = array();
  50.         settings_get_default_table($Page_Settings[0][oid], &$PageDefSettings);        
  51.         foreach($PageDefSettings as $entry)
  52.             if($entry[1] != '')
  53.                 $AFFECTED[$entry[1]] = 2;
  54.     }
  55.     else 
  56.     {
  57.         if($_POST[RESTORE_TABLE] == 1)
  58.         {
  59.             readDefaultSettings(&$Page_Settings);
  60.         }
  61.         else
  62.         {
  63.             readSettings(&$Page_Settings);
  64.             if($_POST[REMOVE_ITEM] != -1)
  65.             {
  66.                 foreach ($Page_Settings[0][value] as $next_row) 
  67.                     $sortarr[] = $next_row[1];
  68.                 array_multisort($sortarr, $Page_Settings[0][value]);
  69.                 unset($Page_Settings[0][value][$_POST[REMOVE_ITEM]]);
  70.             }
  71.             writeSettings($Page_Settings);
  72.         }
  73.         exit(0);
  74.     }
  75.     show_form_management($tab_name);
  76.  
  77.     
  78.     foreach ($Page_Settings[0][value] as $next_row) 
  79.         $sortarr[] = $next_row[1];
  80.     array_multisort($sortarr, $Page_Settings[0][value]);
  81.  
  82.  
  83. ?>
  84.  
  85. <script language="javascript">
  86.     var matchlists = new Array();
  87.     var matchlistsReserved = new Array();
  88. <?php 
  89.     $index = 0;
  90.     foreach($AFFECTED as $key => $entry)
  91.         echo "matchlistsReserved[" . $index++ . "] = ".EscapeJSCodeString($key).";\n";
  92.     $index = 0;
  93.     foreach($Page_Settings[0][value] as $entry)
  94.         echo "matchlists[" . $index++ . "] = ".EscapeJSCodeString($entry[1]).";\n";
  95. ?>
  96.     tabFSMAMatchLists_remove_hit = function(item_index)
  97.     {
  98.         if(have_such_entry_simple(matchlistsReserved, matchlists[item_index]))
  99.         {    
  100.             show_webui_message_box(localized_strings.Warning, localized_strings.RemoveListConfirmation, 0);
  101.             return;
  102.         }
  103.         refreshed = true;
  104.         document.form_<?php echo $tab_name;?>.REMOVE_ITEM.value = item_index;
  105.         dojo.byId("tabFSMAMatchLists_submitit").click();
  106.     }
  107. </script>
  108.  
  109.  
  110. <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;">
  111.     <input type="hidden" name="RESTORE_TABLE" value="0">
  112.     <input type="hidden" name="SUBMIT_TABLE" value="0">
  113.     <input type="hidden" name="APPLY_SETTINGS" value="0">
  114.     <input type="hidden" name="REMOVE_ITEM" value="-1">
  115.     
  116.     <button style='display:none' type='submit' id='tabFSMAMatchLists_submitit'></button>
  117.  
  118.     <?php show_action_menu('Match Lists', $tab_name); ?>
  119.          
  120.     <table border=0 cellspacing="5" cellpadding="0">
  121.         <tr valign=top>
  122.             <td valign="top" style="padding: 5px;">
  123.  
  124.             <table style="table-layout:fixed;" border=0 cellpadding=0 cellspacing=0 bordercolorlight=D4D0C8>
  125.                 <tr>
  126.                     <td width="10px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_left.gif" alt="" class="left_top"/></div></td>
  127.                     <td align="left" width=140><div class="table_stats_heading"><span><?php echo $Page_Settings[0][lock] . fsloc('List name')?></span></div></td>
  128.                     <td align="left" width=120><div class="table_stats_heading"><span><?=fsloc('Type')?></span></div></td>
  129.                     <td align="left"><div class="table_stats_heading"><span><?=fsloc('Filter')?></span></div></td>
  130.                     <td align="right" nowrap><div class="table_stats_heading"><span><?php echo ($global_can_edit && !isset($Page_Settings[0][lock]) ? "<a href='javascript:;' onClick='EnableMatchlistDialog(\"NewItem\", \"\");'>" . fsloc('Add new list...') . "</a>" : ' ');?></span></div></td>
  131.                     <td width="10px"><div class="table_stats_heading"><img src="../pics/layout/corner_up_right.gif" alt="" class="right_top"/></div></td>
  132.                 </tr>
  133. <?php    
  134.         $index = 0;
  135.         $editable_as_word = $global_can_edit && !isset($Page_Settings[0][lock]) ? 'Edit' : 'View';
  136.         $tr_type = '';
  137.         foreach($Page_Settings[0][value] as $entry)
  138.         {
  139.             $tr_type = ($tr_type == '_odd') ? '_even' : '_odd';
  140.             $remove_text = ' ';
  141.             $oper_mode = $editable_as_word . 'ItemDefault';
  142.             $font_color = $entry[0] ? '' : ' color: #999999; ';
  143.             if($AFFECTED[$entry[1]] != 2 && $global_can_edit && !isset($Page_Settings[0][lock]))
  144.             {
  145.                 $remove_text = "<a href='javascript:;' onClick='javascript: tabFSMAMatchLists_remove_hit({$index});'>" . fsloc('remove') . "</a>";
  146.                 $oper_mode = isset($AFFECTED[$entry[1]]) ? 'EditItemLimited' : 'EditItemFull';
  147.             }
  148.             echo "
  149.                 <tr class='tr_setting$tr_type' style='height: 45px;'>
  150.                     <td></td>
  151.                     <td style='padding-left: 5px;'>
  152.                         <a href='javascript:;' 
  153.                             onClick='javascript: EnableMatchlistDialog(\"{$oper_mode}\", ".EscapeJSCodeString($entry[1]).");' 
  154.                             title='".htmlspecialchars($entry[4], ENT_QUOTES)."'>
  155.                                 ".htmlspecialchars($entry[1])."
  156.                         </a>
  157.                     </td>
  158.                     <td style='padding-left: 10px; $font_color'>{$MatchlistTypes[$entry[2]]}</td>
  159.                     <td style='padding-left: 10px; $font_color'>".htmlspecialchars($entry[3])."</td>
  160.                     <td align='right' style='padding-left: 5px;'>$remove_text</td>
  161.                     <td> </td>
  162.                 </tr>
  163.             ";
  164.             $index++;
  165.         }
  166. ?>
  167.  
  168.             </table>
  169.             </td>
  170.         </tr>
  171.         <?php show_action_buttons($tab_name, true, true); ?>
  172.     </table>
  173. </form>    
  174.