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 / common / common2.php next >
PHP Script  |  2010-09-07  |  22KB  |  622 lines

  1. <?php
  2.  
  3. function GetEditableAsWord($editable, $ellipsis)
  4. {
  5.     if ($editable)
  6.         if ($ellipsis)
  7.             return fsloc('Edit...');
  8.         else
  9.             return fsloc('Edit');
  10.     else
  11.         if ($ellipsis)
  12.             return fsloc('View...');
  13.         else
  14.             return fsloc('View');
  15. }
  16.  
  17. function GetConfigurableAsWord($editable, $ellipsis)
  18. {
  19.     if ($editable)
  20.         if ($ellipsis)
  21.             return fsloc('Configure...');
  22.         else
  23.             return fsloc('Configure');
  24.     else 
  25.         if ($ellipsis)
  26.             return fsloc('View...');
  27.         else
  28.             return fsloc('View');
  29. }
  30.  
  31. function show_common_lists($table, $set_array, $index, $form_name, $mixed_mode = true, $target_type = 'list', $target_extra_type = 1)
  32. {
  33.     global     $global_can_edit;
  34.  
  35.     $setting_is_editable = $global_can_edit;
  36.     $value = 0;
  37.     if($set_array != 0)
  38.     {
  39.         $value = $set_array[$index][value];
  40.         $setting_is_editable = $global_can_edit && !isset($set_array[$index][lock]);
  41.     }
  42.     
  43.     $show_blank = true;
  44.     if($target_type == 'template_must')
  45.     {
  46.         $show_blank = false;
  47.         $target_type = 'template';
  48.     }
  49.     else if($target_type == 'list_must')
  50.     {
  51.         $show_blank = false;
  52.         $target_type = 'list';
  53.     }
  54.  
  55.     $dialog_func = ($target_type == 'list') ? 'EnableMatchlistDialog' : 'EnableTemplateDialog';
  56.  
  57.     $sel_options = '';
  58.     $item_id = 0;
  59.     foreach($table as $id => $entry)
  60.     {
  61.         $sel_text = '';
  62.         if($entry[1] === $value)
  63.         {    
  64.             $sel_text = 'selected';
  65.             $item_id = $id;        
  66.         }
  67.         $entry_norm = $entry[1];
  68.         if(strlen($entry[1]) > 39)
  69.             $entry_norm = substr($entry[1], 0, 39) . '...';
  70.         if($target_type != 'list' || $entry[2] == $target_extra_type)
  71.             $sel_options .= "<option value='".htmlspecialchars($entry[1], ENT_QUOTES)."' $sel_text>".htmlspecialchars($entry_norm);
  72.     }
  73.  
  74.     if($sel_options == '')
  75.         $extra_style = 'style=\'width:100px;\'';
  76.  
  77.     echo "
  78.         <td name='".htmlspecialchars($value, ENT_QUOTES)."' width='100%'>
  79.             <select name='VAR_PAGE_SETTINGS_$index' id='VAR_PAGE_SETTINGS_$index' $extra_style class='web_select{$target_type}{$target_extra_type}'>
  80.     ";
  81.     
  82.     if($show_blank)
  83.         echo ($value == '') ? "<option value='' selected>" : "<option value=''>";
  84.  
  85.     $editable_as_word = $setting_is_editable ? 'Edit' : 'View';
  86.  
  87.      echo "
  88.                 $sel_options
  89.             </select>
  90.         </td>
  91.         <td width='70' nowrap>
  92.             <button dojoType='fs:Button' onClick='javascript: {$dialog_func}(\"{$editable_as_word}Item\", document.$form_name.VAR_PAGE_SETTINGS_$index.value);' style='width: 60px;'><div class='button" . (get_lang() == 'ITA' || get_lang() == 'FRA' ? 60 : 40) . "p'>" . GetEditableAsWord($setting_is_editable, false) . "...</div></button>
  93.         </td>
  94.     ";
  95.         
  96.  
  97.     $pad_el = ($target_type == 'list' && $mixed_mode) ? 'style="padding-right: 30px;"' : '';
  98.         
  99.  
  100.     if($setting_is_editable)
  101.     echo "
  102.         <td  nowrap>
  103.             <a href='javascript: {$dialog_func}(\"NewItem\", \"$target_extra_type\");' $pad_el>" . fsloc("New {$target_type}...") . "</a>  
  104.         </td>
  105.     ";
  106. }
  107.  
  108. function show_action_buttons($tabname, $show_apply=false, $show_restore=false, $show_query=false, $show_reset=false, $alwaysEnabled=false)
  109. {
  110.     $canEditSettings = $alwaysEnabled || can_edit_settings();
  111.     echo "
  112.         <tr height=35px valign=bottom><td>
  113.             <div class='boxButtonRight'>
  114.                         <input style='display:none' id='{$tabname}_checker' onClick='{$tabname}_is_closing();'>
  115.                         <input style='display:none' type='submit' id='submitit_{$tabname}' onClick='if(document.form_{$tabname}.SUBMIT_TABLE.value == 0)document.form_{$tabname}.SUBMIT_TABLE.value=1;'>
  116.     ";    
  117.                     if($show_apply) 
  118.                         echo "<button dojoType='fs:Button' id='apply_{$tabname}' onClick='{$tabname}_apply_hit();'".($canEditSettings ? "" : " disabled='1'")."><div class='button100p'>" . fsloc('Apply') . "</div></button>";
  119.                     if($show_restore)
  120.                         echo "<button dojoType='fs:Button' id='restore_{$tabname}' onClick='RestoreDefaultsHit(\"$tabname\");' ".($canEditSettings ? "" : " disabled='1'")."><div ".(get_lang()=="FRA" ? "style='width:120px'" : "")." class='button100p'>" . fsloc("Defaults") . "</div></button>";
  121.                     if($show_query)
  122.                         echo "<button dojoType='fs:Button' id='query_{$tabname}' onClick='{$tabname}_query_hit();'><div class='button100p'>" . fsloc('Query') . "</div></button>";
  123.                     if($show_reset)
  124.                         echo "<button dojoType='fs:Button' id='reset_{$tabname}' onClick='{$tabname}_reset_hit();'><div class='button100p'>" . fsloc('Reset') . "</div></button>";
  125.     
  126.     echo '        </div> 
  127.         </tr>
  128.     ';
  129. }
  130. function show_action_menu($page_name, $pane_name, $extra='')
  131. {
  132.     if($extra == '')
  133.     {
  134.         $extra = "refreshTabPage('{$pane_name}')";
  135.     }
  136.     $page_name = ($page_name != '') ? fsloc($page_name) : ' ';
  137.  
  138.     
  139.     $infrmr = '<img src="/pics/icon/icon_blue.gif" style=" vertical-align:middle; padding-bottom: 2px;"\> ' . fsloc('There are changed settings. Click Apply to take them in use.');
  140.     $err = settings_last_error();
  141.     if($err != 0)
  142.     {
  143.         $infrmr = '<img src="/pics/icon/icon_red.gif" style=" vertical-align:middle; padding-bottom: 2px;"\> ' . fsloc('Failed to write settings into policy.') . ($err == 12 ? ' ' . fsloc('One of the settings has Final attribute.') : '') . '<a style="padding-left: 30px;"href="javascript:;" onclick="javascript: reset_unsaved_settings();">' . fsloc('Reset changes') . '</a>';
  144.     }    
  145.  
  146.     echo '
  147.         <div style="position: relative; top: 2px; left: 0px; margin: 0px; padding: 0px; line-height: 25px;">
  148.             <div style="position: absolute; top: 0px; right: 20px; height: 30px; margin: 0px; padding: 0px;">
  149.                 <a id="refresh: '.$pane_name.'" class="refreshpage" href="javascript:;" onclick="' . $extra . '">' . fsloc('Refresh') . '</a>
  150.                 <a id="help: '.$pane_name.'" class="helpme" href="javascript:;" onClick="clickHelpButton(\'' . $pane_name . '\');">' . fsloc('Help') . '</a>
  151.             </div>    
  152.             <div class="header" style="position: relative; top: 0px; left: 5px; width: 400px; height: 35px; margin: 0px; padding: 0px;">' . $page_name . '</div>
  153.             <div class="SettingsInformerCont"><div class="SettingsInformer">
  154.                 <img src="/pics/layout/corner_up_left.gif" alt="" class="left_top"/>
  155.                 <img src="/pics/layout/corner_up_right.gif" alt="" class="right_top"/>
  156.                 ' . $infrmr . '    
  157.             </div>
  158.             <p style="margin: 0; padding-top: 10px;">
  159.             </div>
  160.             <input id="counter: '.$pane_name.'" type=hidden value="'.time().'"/>
  161.         </div>
  162.     ';
  163. }
  164. function show_ss_action_menu($page_name)
  165. {
  166.     $page_name = ($page_name != '') ? fsloc($page_name) : ' ';
  167.  
  168.     echo '
  169.         <div style="position: relative; top: 5px; left: 0px; margin: 0px; padding: 0px; height: 30px; line-height: 25px;">
  170.             <div class="header" style="position: absolute; top: 0px; left: 5px; width: 300px; height: 30px; margin: 0px; padding: 0px;">' . $page_name . '</div>
  171.             <div style="position: absolute; top: 0px; right: 10px; height: 30px; margin: 0px; padding: 0px;">
  172.                 <a class="helpme" href="javascript:;" onClick="clickHelpButton();">' . fsloc('Help') . '</a>
  173.             </div>    
  174.         </div>
  175.     ';
  176. }
  177.  
  178.  
  179. function show_section_title($title, $extra_style='')
  180. {
  181.     $title = ($title != '') ? fsloc($title) : ' ';
  182.  
  183.     echo "
  184.         <tr><td colspan='4' style='padding-bottom: 0px; $extra_style'>
  185.             <div class='table_heading'>
  186.                 <img src='/pics/layout/corner_up_left.gif' alt='' class='left_top'/>
  187.                 <img src='/pics/layout/corner_up_right.gif' alt='' class='right_top'/>
  188.                 <div>$title</div>
  189.             </div>
  190.         </td></tr>
  191.     ";
  192. }
  193.  
  194. function show_section_title2($title)
  195. {
  196.     $title = ($title != '') ? fsloc($title) : ' ';
  197.  
  198.     echo "<div class=\"title_header\">$title</div>";
  199. }
  200.  
  201. function show_tasks_title($title)
  202. {
  203.     $title = ($title != '') ? fsloc($title) : ' ';
  204.  
  205.     echo "
  206.         <tr><td class='table_toolbox2' valign='top'>
  207.             <div class='toolboxBar'>
  208.             <img src='../pics/layout/corner_up_left.gif' alt='' class='left_top'/>
  209.             <img src='../pics/layout/corner_up_right.gif' alt='' class='right_top'/>
  210.             <img src='../pics/icon/icon_tool.gif' alt='' class='toolbox_icon'/>
  211.             <img src='../pics/layout/dottedline.gif' alt='' class='dottedline'/>
  212.             <span class='toolboxBarText'>$title</span>
  213.             </div>
  214.         </td></tr>
  215.     ";
  216. }
  217.  
  218. $global_can_edit = false;
  219. function show_form_management($tab_name, $set_edit_mode = 2)
  220. {
  221.     global     $global_can_edit, $Page_Settings;
  222.     
  223.     $disabled_settings = '';    
  224.     $disabled_settings_str = '';    
  225.     if(count($Page_Settings) > 0)
  226.     foreach($Page_Settings as $k => $v)
  227.         if(isset($v[lock]))
  228.         {
  229.             $disabled_settings .= ($disabled_settings != '' ? ',' : '') . $k;    
  230.             $disabled_settings_str .= "disable_form_setting('{$tab_name}', {$k});\n";
  231.         }
  232.  
  233.     $global_can_edit = can_edit_settings($set_edit_mode);
  234.  
  235.     $set_action = $global_can_edit ? 'element.onfocus = SetCanBeSubmitted;':
  236.                                      'element.disabled = true;';
  237.     echo "
  238.         <script language='JavaScript' type='text/javascript'>
  239.             var refreshed = false;
  240.             var disabled_settings_{$tab_name} = [{$disabled_settings}];
  241.             {$tab_name}_can_edit_settings = " . ($global_can_edit ? 'true' : 'false') . ";
  242.  
  243.             {$tab_name}_is_closing = function()
  244.             {
  245.                 if(rdefs_tab_name != '')
  246.                     return;  // No need so save changes as this is restore of defaults
  247.  
  248.                 var myform = document.form_{$tab_name};
  249.                 if(!myform)
  250.                     return;
  251.  
  252.                 if(myform.APPLY_SETTINGS)
  253.                     myform.APPLY_SETTINGS.value=0;
  254.                 
  255.                 if(!page_can_be_submitted)
  256.                     return;
  257.  
  258.                 support_disabled_checkboxes(myform);                
  259.  
  260.                 page_can_be_submitted = false;
  261.                 if(window.{$tab_name}_settings_check && {$tab_name}_settings_check() == false)    
  262.                     return;
  263.                 if(!{$tab_name}_can_edit_settings) 
  264.                     return;
  265.                 setTimeout('check_unsaved_settings(def_attempts_unsaved_settings)', 1000);
  266.                 dojo.byId('submitit_{$tab_name}').click();
  267.             }
  268.                                         
  269.             {$tab_name}_apply_hit = function()
  270.             {
  271.                 var myform = document.form_{$tab_name};
  272.                 if(!myform)
  273.                     return;
  274.  
  275.                 if(window.{$tab_name}_settings_check && {$tab_name}_settings_check() == false)    
  276.                     return;
  277.                 if(!{$tab_name}_can_edit_settings) 
  278.                     return;
  279.  
  280.                 support_disabled_checkboxes(myform);                
  281.  
  282.                 myform.APPLY_SETTINGS.value=1;
  283.                         setTimeout('RefreshActiveContentPane(); check_unsaved_settings(def_attempts_unsaved_settings);', 2000);
  284.                 dojo.byId('submitit_{$tab_name}').click();
  285.             }
  286.             {$tab_name}_restore_hit = function()
  287.             {
  288.                 if(!{$tab_name}_can_edit_settings) return;
  289.                 refreshed = true;
  290.                 page_can_be_submitted = true;
  291.                 document.form_{$tab_name}.RESTORE_TABLE.value=1;
  292.                 dojo.byId('submitit_{$tab_name}').click();
  293.             }
  294.             function init() 
  295.             {
  296.                 if (!safeFormBind(
  297.                     'form_{$tab_name}', 
  298.                     function(type, data, e)
  299.                     {
  300.                         if(refreshed)
  301.                         {
  302.                             refreshTabPage('{$tab_name}');
  303.                             refreshed = false;
  304.                         }
  305.                     }
  306.                 ))
  307.                     return;
  308.                         
  309.                 dojo.event.connect('after', dojo.widget.byId('{$tab_name}'), 'hide', 
  310.                     function(evt){{$tab_name}_is_closing();}
  311.                 );
  312.  
  313.                 {$disabled_settings_str}
  314.  
  315.                 if(typeof startup{$tab_name}enableControls == 'function')
  316.                     startup{$tab_name}enableControls();
  317.  
  318.                 for(var i = 0; i < document.form_{$tab_name}.elements.length; i++)
  319.                 {
  320.                     element = document.form_{$tab_name}.elements[i];
  321.                     if(    element.name && element.name.length > 0)                  
  322.                         $set_action
  323.                 }
  324.                 popup_unsaved_settings();
  325.             }
  326.             dojo.addOnLoad(init);
  327.         </script>
  328.     ";
  329. }
  330.  
  331. function can_edit_settings($set_edit_mode = 2)
  332. {
  333.     if($set_edit_mode == 0)
  334.         return true;
  335.  
  336.     if($_SERVER[CACHED_TAG] != $_SERVER[MASTER_CACHE])
  337.         return false;
  338.     
  339. // Starting from MSE 9.10 settings are editable in centralized mode 
  340. /*
  341.     if($set_edit_mode == 2)
  342.     {
  343.         @dfp_get_policy_int('1.3.6.1.4.1.2213.11.1.14.1', &$res); 
  344.         if($res == 2)
  345.             return false;
  346.     }
  347. */
  348.     return true;    
  349. }
  350.  
  351. function show_dialog_buttons($table_width, $dialog, $can_edit_settings, $has_refresh=false)
  352. {
  353.     if($can_edit_settings)
  354.     {
  355.         $margin = $table_width - ($has_refresh ? 270 : 180);
  356.         if($has_refresh)
  357.         {
  358.             $refresh_btn = "
  359.                 <button style='display:none;' index='-1' type='submit' id='{$dialog}_refreshit' onClick='{$dialog}_refreshit_hit()'></button>
  360.                 <button dojoType='fs:Button' onClick='javascript: void(dojo.byId(\"{$dialog}_refreshit\").click());'><div class='button60p'>" . fsloc('Refresh') . "</div></button>
  361.             ";
  362.         }
  363.         
  364.         echo "
  365.             <div style= 'display: block; text-align: center; margin-left: {$margin}px;'>
  366.                 <button style='display:none' type='submit' id='{$dialog}_submitit'></button>
  367.                 <button id='dlg_ok_{$dialog}' dojoType='fs:Button' onClick='dojo.byId(\"{$dialog}_submitit\").click();'><div class='button60p'>" . fsloc('OK') . "</div></button>
  368.                 <button id='dlg_cancel_{$dialog}' dojoType='fs:Button' onClick='{$dialog}_hideit_hit();'><div class='button60p'>" . fsloc('Cancel') . "</div></button>
  369.                 $refresh_btn
  370.             </div>
  371.         ";
  372.     }
  373.     else
  374.     {
  375.         $margin = $table_width - 80;
  376.         echo "
  377.             <div style='display: block; text-align: center; margin-left: {$margin}px;'>
  378.                 <button id='dlg_cancel_{$dialog}' dojoType='fs:Button' onClick='{$dialog}_hideit_hit();'><div class='button60p'>" . fsloc('Close') . "</div></button>
  379.             </div>
  380.         ";
  381.     }
  382. }
  383.  
  384. function show_form_disabling($form_name)
  385. {
  386.     echo "
  387.         if(document.{$form_name})
  388.         for(var i = 0; i < document.{$form_name}.elements.length; i++)
  389.         {
  390.             element = document.{$form_name}.elements[i];
  391.             if(    element.name && element.name.length > 0)                  
  392.                 element.disabled = true;
  393.         }
  394.     ";
  395. }
  396.  
  397. $fsma_severities = array(fsloc('Informational'), fsloc('Warning'), fsloc('Error'), fsloc('Fatal Error'), fsloc('Security'));
  398. $fsma_severityImages = array('/pics/InfoAlert.png', '/pics/WarnAlert.png', '/pics/ErrorAlert.png', '/pics/FatalErrorAlert.png', '/pics/SecurityAlert.png');
  399. $fsma_alertMediaCodes = array('2.4'/*Always*/,'10'/*PM*/, '4'/*LUI*/, '2.5'/*SMTP*/, 
  400.                          '2.3'/*EventLog*/, '1.1'/*SNMP*/, '1.2'/*Tivoli*/);
  401.  
  402. function make_smtp_recipient_id($product, $email)
  403. {
  404.     return "$product->$email";
  405. }
  406.                          
  407. function parse_fsma_alerting_table($table, $alert_config, $smtp_forwards, $my_smtp_forwards)
  408. {
  409.     global $fsma_alertMediaCodes;
  410.     for($index = 0; $index < count($table); $index++)
  411.     {
  412.         $entry_string = $table[$index][1];
  413.         /* Fill the table Delivery Medias - Alert Severities */
  414.         for($media_index = 0; $media_index < count($fsma_alertMediaCodes); $media_index++)
  415.         {
  416.             $found_position = -1;
  417.             while(($found_position = strpos($entry_string, $fsma_alertMediaCodes[$media_index], $found_position + 1)) !== false)
  418.             {
  419.                 if($found_position == 0 || $entry_string[$found_position - 1] == ',')
  420.                 {
  421.                     $alert_config[$index][$media_index] = 1;
  422.                     if($fsma_alertMediaCodes[$media_index] == '2.5')
  423.                     {
  424.                         $oidstart = strpos($entry_string, ':2213.', $found_position + 1);
  425.                         while($oidstart)
  426.                         {
  427.                             $oids_unparsed = substr($entry_string, $oidstart + 1,  7);
  428.                             $mails_begin = $oidstart + 10;
  429.                             $mails_end = strpos($entry_string, '"', $mails_begin);
  430.                             //echo '<br>' . $oids_unparsed . ' ' . $mails_begin . ' ' . $mails_end;
  431.                             $mails_str = substr($entry_string, $mails_begin,  $mails_end - $mails_begin);
  432.                             $smtp_forwards[$index][$oids_unparsed] = $mails_str;
  433.                             $product_id = fsma_alerting_table_oid_to_product($oids_unparsed);
  434.                             if ($product_id != null)
  435.                             {
  436.                                 $mail_entry = strtok($mails_str, ',');
  437.                                 while($mail_entry)
  438.                                 {
  439.                                     // $entryId - unique key for associative array my_smtp_forwards. 
  440.                                     // Has no meaning for client code, it just uniquely identifies the entry.
  441.                                     $entryId = make_smtp_recipient_id($product_id, $mail_entry); 
  442.                                     
  443.                                     $my_smtp_forwards[$entryId][$index] = 1;
  444.                                     $my_smtp_forwards[$entryId]["e-mail"] = $mail_entry;
  445.                                     $my_smtp_forwards[$entryId]["product"] = $product_id;
  446.                                     
  447.                                     $mail_entry = strtok(',');
  448.                                 }
  449.                             }
  450.                             $oidstart = strpos($entry_string, ':2213.', $oidstart + 1);
  451.                         }
  452.                     }
  453.                     break;
  454.                 }
  455.             }
  456.         }
  457.     }
  458. }
  459.  
  460. function fsma_alerting_table_product_to_oids($productId)
  461. {
  462.     if ($productId == "srv")
  463.         return array("2213.12");
  464.     if ($productId == "mse")
  465.         return array("2213.18", "2213.20");
  466.     return array();
  467. }
  468.  
  469. function fsma_alerting_table_oid_to_product($oids_unparsed)
  470. {
  471.     $mseInstalled = products_is_av4mse_installed();
  472.     $srvInstalled = products_is_av4srv_installed();
  473.     //$mseInstalled = true;
  474.     //$srvInstalled = true;
  475.     $product_id = null;
  476.     if ($mseInstalled && ($oids_unparsed == '2213.18' || $oids_unparsed == '2213.20' ||
  477.        $oids_unparsed == '2213.22' || $oids_unparsed == '2213.24'))
  478.     {
  479.         $product_id = "mse";
  480.     }
  481.     if ($srvInstalled && ($oids_unparsed == '2213.12'))
  482.     {
  483.         $product_id = "srv";
  484.     }
  485.     return $product_id;
  486. }
  487.  
  488. function create_fsma_alerting_table($table, $alert_config, $smtp_forwards)
  489. {
  490.     global $fsma_alertMediaCodes;
  491.     for($index = 0; $index < count($table); $index++)
  492.     {
  493.         if(!isset($alert_config[$index][0]))
  494.             $alert_config[$index][0] = 1;
  495.         if(!isset($alert_config[$index][3]) && isset($smtp_forwards[$index]))
  496.             $alert_config[$index][3] = '';
  497.  
  498.         $entry_string = '';
  499.         if(isset($alert_config[$index]))
  500.         foreach($alert_config[$index] as $entry => $value)
  501.         {
  502.             if($entry_string != '') $entry_string .= ',';
  503.             if($fsma_alertMediaCodes[$entry] == '2.5')
  504.             {
  505.                 $extra_recip = '';
  506.                 foreach($smtp_forwards[$index] as $oid => $mails)
  507.                     if(isset($mails) &&  $mails != '')
  508.                         $extra_recip .= ":{$oid}:\"{$mails}\"";
  509.                 $entry_string .= $fsma_alertMediaCodes[$entry] . $extra_recip;
  510.             }
  511.             else
  512.                 $entry_string .= $fsma_alertMediaCodes[$entry];
  513.         }
  514.         $table[$index][1] = $entry_string;
  515.     }
  516. }
  517. function show_info_pannel($in_text, $templ_id = '', $state, $is_ss=false)
  518. {
  519.     if($in_text == 'INFO_NO_ADMINMAILBOX')
  520.     {
  521.         $ini_array = parse_ini_file('../../bin/webui.cnf', true);
  522.         if($ini_array && $ini_array[General][ExchangeVersion] < 4)         
  523.             return;    
  524.         $adm_mbx = '';
  525.         dfp_get_policy_str('1.3.6.1.4.1.2213.20.1.300.30.100.50', &$adm_mbx); 
  526.         if($adm_mbx != '')         
  527.             return;    
  528.         $p_text = fsloc('Scanning inside public folders is disabled because #1#Administrator\'s mailbox#2# is not specified.');
  529.         $p_text = str_replace(array('#1#', '#2#'), array('<a href="javascript:;" onClick="selectTreeNode(\'ManualScanning\', \'tabStorageManualGeneral\');">', '</a>'), $p_text);        
  530.     }
  531.     else
  532.         $p_text = fsloc('This feature is disabled because Virus Scanning is disabled. Enable Virus Scanning to enable this feature.');
  533.  
  534.     $left_padding = ($is_ss ? 5 : 0);    
  535.  
  536.     if($state)
  537.         $bar_hider = 'display: none; visibility: hidden';
  538.  
  539.     echo '
  540.         <div id="'. $templ_id . '" class="table_heading" style="position: relative; top: 0px; left: ' . $left_padding . 'px; height: 27px; background-color: #fff0a1; padding: 0; margin: 5px 0 0 0; height: 30px; width: ' . ($is_ss ? '715' : '735') . 'px ;' . $bar_hider . '">
  541.             <img src="/pics/layout/corner_up_left.gif" alt="" class="left_top"/>
  542.             <img src="/pics/layout/corner_up_right.gif" alt="" class="right_top"/>
  543.             <img src="/pics/icon/icon_blue.gif" style="position: absolute; top: 5px; left: 10px; margin: 0; padding: 0;"/>
  544.             <div style="position: absolute; top: 7px; left: 35px; padding: 0; margin: 0; font-size: 11px;">' . $p_text . '</div>
  545.         </div>
  546.     ';
  547. }
  548.  
  549. function show_delayload_logic($ContentPanes)
  550. {
  551.     $ContentPanesTxt = '';
  552.     foreach($ContentPanes as $tabentry)
  553.         $ContentPanesTxt .= "\nvar pane = dojo.widget.byId('{$tabentry[0]}'); if(pane) pane.setUrl('{$tabentry[1]}');";
  554.  
  555.     echo "
  556.         <script>
  557.             LoadPages = function()
  558.             {
  559.                 $ContentPanesTxt
  560.             }
  561.             setTimeout('LoadPages()', 200);
  562.         </script>  
  563.     ";
  564. }
  565.  
  566. function show_virscan_logic($ContentPanes, $TreePrefix, $Page_param, $vir_scan_value, $disable_id)
  567. {
  568.     $ContentPanesTxt = '';
  569.     foreach($ContentPanes as $tabentry)
  570.         $ContentPanesTxt .= "\nvar pane = dojo.widget.byId('{$tabentry[0]}'); if(pane) pane.setUrl('{$tabentry[1]}');";
  571.  
  572.     echo "
  573.         <script>
  574.             setVirusScanStatus('{$TreePrefix}{$Page_param}', $vir_scan_value, false);
  575.             ChangeAffectedTabs = function()
  576.             {
  577.                 var status;
  578.                 if(arguments.length > 0)
  579.                 {
  580.                     setVirusScanStatus('{$TreePrefix}{$Page_param}', arguments[0], true);
  581.                     status = arguments[0];
  582.                             }
  583.                 else
  584.                     status = getVirusScanStatus('{$TreePrefix}{$Page_param}');
  585.         
  586.                 change_tab_state('{$ContentPanes[$disable_id][0]}', '" . fsloc('Grayware') . "', status);
  587.                 change_tab_state('{$ContentPanes[$disable_id + 1][0]}', '" . fsloc('Archives') . "', status);
  588.                 if(typeof tab{$TreePrefix}{$Page_param}GraywareScanningChangeTabStatus == 'function')
  589.                     tab{$TreePrefix}{$Page_param}GraywareScanningChangeTabStatus(status);
  590.                 if(typeof tab{$TreePrefix}{$Page_param}ArchiveProcessingChangeTabStatus == 'function')
  591.                     tab{$TreePrefix}{$Page_param}ArchiveProcessingChangeTabStatus(status);
  592.             }
  593.             LoadPages = function()
  594.             {
  595.                 $ContentPanesTxt
  596.                 ChangeAffectedTabs();
  597.             }
  598.             setTimeout('LoadPages()', 10);
  599.         </script>  
  600.     ";
  601. }
  602.  
  603. function GetLanguageSpecificStyle()
  604. {
  605.     if (get_lang()=="JPN")
  606.         return "font-family:MS UI Gothic, arial, helvetica, verdana, sans-serif;";
  607.     return "";
  608. }
  609.  
  610. function DateTimeToStr($timestamp) // this function is a replacement for strftime("%c") becuase strftime() cannot return utf8 strings. See CTS-69415.
  611. {
  612.     // Get variant from timespamp
  613.     $v = variant_date_from_timestamp($timestamp);
  614.     // Make a new variant configured to be converted to string using utf-8
  615.     $v = new Variant($v, VT_DATE, CP_UTF8);
  616.     // Convert to string
  617.     return "$v";
  618. }
  619.  
  620. ?>
  621.  
  622.