function SETTINGS_PAGE(){ $squid=new squidbee(); $t=time(); $MonitConfig=defaults_values(); $t=time(); $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $EnableFailover=$sock->GET_INFO("EnableFailover"); if(!is_numeric($EnableFailover)){$EnableFailover=1;} $SquidCacheReloadTTL=$sock->GET_INFO("SquidCacheReloadTTL"); if(!is_numeric($SquidCacheReloadTTL)){$SquidCacheReloadTTL=10;} $html="<div style='width:98%' class=form> ". Paragraphe_switch_img("{enable_watchdog}", "{enable_watchdog_squid_explain}", "watchdog",$MonitConfig["watchdog"],null,750). Paragraphe_switch_img("{enable} {failover}", "{EnableFailover_explain}", "EnableFailover",$EnableFailover,null,750). Paragraphe_switch_img("{ALLOW_RETURN_1CPU}", "{ALLOW_RETURN_1CPU_EXPLAIN}", "ALLOW_RETURN_1CPU",$MonitConfig["ALLOW_RETURN_1CPU"],null,750). Paragraphe_switch_img("{DisableWebFilteringNetFailed}", "{DisableWebFilteringNetFailed_explain}", "DisableWebFilteringNetFailed",$MonitConfig["DisableWebFilteringNetFailed"],null,750)." <table style='width:100%'> <tr> <td class=legend style='font-size:18px'>{failover_ttl}:</td> <td style='font-size:18px'>". Field_text("MinTimeFailOverSwitch",$MonitConfig["MinTimeFailOverSwitch"], "font-size:18px;width:190px")." {minutes}</td> <td width=1%>". help_icon("{failover_ttl_explain}")."</td> </tr> <tr> <td class=legend style='font-size:18px'>{max_attempts} (CPU):</td> <td style='font-size:18px'>". Field_text("WEBPROCISSUE",$MonitConfig["WEBPROCISSUE"], "font-size:18px;width:190px")." {errors}</td> <td width=1%></td> </tr> <tr><td colspan=3 style='font-size:22px'>{services_timeout}</td></tr> <tr> <td class=legend style='font-size:18px'>{StopMaxTTL}:</td> <td style='font-size:18px'>". Field_text("StopMaxTTL",$MonitConfig["StopMaxTTL"], "font-size:18px;width:90px")." {seconds}</td> <td width=1%>". help_icon("{StopMaxTTL_explain}")."</td> </tr> <tr> <td align='right' class=legend style='font-size:18px'>{shutdown_lifetime}</strong>:</td> <td align='left' style='font-size:18px'>" . Field_text("shutdown_lifetime-$t",$squid->shutdown_lifetime,'width:90px;font-size:18px')." {seconds}</td> <td width=1%>" . help_icon('{shutdown_lifetime_text}',true)."</td> </tr> <tr> <td class=legend style='font-size:18px'>{minimum_reload_interval}:</td> <td style='font-size:18px'>". Field_text("SquidCacheReloadTTL",$SquidCacheReloadTTL, "font-size:18px;width:190px")." {minutes}</td> <td width=1%>". help_icon("{SquidCacheReloadTTL_explain}")."</td> </tr> <tr> <td class=legend style='font-size:18px'>{minimum_reboot_interval}:</td> <td style='font-size:18px'>". Field_text("REBOOT_INTERVAL",$MonitConfig["REBOOT_INTERVAL"], "font-size:18px;width:190px")." {minutes}</td> <td width=1%>". help_icon("{minimum_reboot_interval_explain}")."</td> </tr> <tr> <td class=legend style='font-size:18px'>{SQUID_MAX_RESTART}:</td> <td style='font-size:18px'>". Field_text("MAX_RESTART",$MonitConfig["MAX_RESTART"], "font-size:18px;width:190px")." </td> <td width=1%>". help_icon("{SQUID_MAX_RESTART_EXPLAIN}")."</td> </tr> <tr><td colspan=3 style='font-size:24px'>{when_fetching_proxy_informations}</td></tr> <tr><td colspan=3 ><div class=text-info style='font-size:16px'>{when_fetching_proxy_informations_explain}</div> <tr> <td class=legend style='font-size:18px'>{tests_timeout}:</td> <td style='font-size:18px'>". Field_text("MgrInfosMaxTimeOut",$MonitConfig["MgrInfosMaxTimeOut"], "font-size:18px;width:190px")." {seconds}</td> <td width=1%></td> </tr> <tr> <td class=legend style='font-size:18px'>{max_failed_before_action}:</td> <td style='font-size:18px'>". Field_text("MgrInfosMaxFailed",$MonitConfig["MgrInfosMaxFailed"], "font-size:18px;width:90px")." {times}</td> <td width=1%></td> </tr> <tr> <td class=legend style='font-size:18px'>{restart_if_failed}:</td> <td style='font-size:18px'>". Field_checkbox("MgrInfosRestartFailed",1,$MonitConfig["MgrInfosRestartFailed"])." </td> <td width=1%></td> </tr> <tr> <td class=legend style='font-size:18px'>{failover_if_failed}:</td> <td style='font-size:18px'>". Field_checkbox("MgrInfosFaileOverFailed",1,$MonitConfig["MgrInfosFaileOverFailed"])." </td> <td width=1%></td> </tr> <tr> <td colspan=3 align='right'><hr>". button("{apply}","Save$t()",24)."</td> </div> <script> var xSave$t= function (obj) { var results=obj.responseText; UnlockPage(); RefreshTab('watchdog_settings_tabs'); } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('SAVEGLOBAL','yes'); XHR.appendData('watchdog',document.getElementById('watchdog').value); XHR.appendData('EnableFailover',document.getElementById('EnableFailover').value); XHR.appendData('ALLOW_RETURN_1CPU',document.getElementById('ALLOW_RETURN_1CPU').value); XHR.appendData('WEBPROCISSUE',document.getElementById('WEBPROCISSUE').value); XHR.appendData('DisableWebFilteringNetFailed',document.getElementById('DisableWebFilteringNetFailed').value); XHR.appendData('SquidCacheReloadTTL',document.getElementById('SquidCacheReloadTTL').value); XHR.appendData('REBOOT_INTERVAL',document.getElementById('REBOOT_INTERVAL').value); XHR.appendData('MAX_RESTART',document.getElementById('MAX_RESTART').value); XHR.appendData('MgrInfosMaxTimeOut',document.getElementById('MgrInfosMaxTimeOut').value); XHR.appendData('MgrInfosMaxFailed',document.getElementById('MgrInfosMaxFailed').value); XHR.appendData('shutdown_lifetime',document.getElementById('shutdown_lifetime-$t').value); XHR.appendData('StopMaxTTL',document.getElementById('StopMaxTTL').value); if(document.getElementById('MgrInfosRestartFailed').checked){ XHR.appendData('MgrInfosRestartFailed',1); }else{ XHR.appendData('MgrInfosRestartFailed',0); } if(document.getElementById('MgrInfosFaileOverFailed').checked){ XHR.appendData('MgrInfosFaileOverFailed',1); }else{ XHR.appendData('MgrInfosFaileOverFailed',0); } XHR.sendAndLoad('$page', 'POST',xSave$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function SETTINGS_PAGE() { $squid = new squidbee(); $t = time(); $MonitConfig = defaults_values(); $t = time(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $EnableFailover = $sock->GET_INFO("EnableFailover"); if (!is_numeric($EnableFailover)) { $EnableFailover = 1; } $SquidCacheReloadTTL = $sock->GET_INFO("SquidCacheReloadTTL"); if (!is_numeric($SquidCacheReloadTTL)) { $SquidCacheReloadTTL = 10; } $MonitSquidMaxRestartMem = intval($sock->GET_INFO("MonitSquidMaxRestartMem")); $MonitSquidMaxCPU = intval($sock->GET_INFO("MonitSquidMaxCPU")); $CPU[0] = "{disabled}"; for ($i = 50; $i < 101; $i++) { $CPU[$i] = "{$i}%"; } $html = "<div style='width:98%' class=form>\n\t\t\t" . Paragraphe_switch_img("{enable_watchdog}", "{enable_watchdog_squid_explain}", "watchdog", $MonitConfig["watchdog"], null, 960) . "\n\t\t\t\t\t\t\t\t\t\t\n\n\t<table style='width:100%'>\n\t<tr><td colspan=2 style='font-size:30px'>{restart_service}</td></tr>\n\t<tr>\t\t\t\t\n\t\t<td style='font-size:22px;' class=legend>{if_system_cpu_exceed}:</td>\n\t\t<td>" . Field_array_Hash($CPU, "MonitSquidMaxCPU", $MonitSquidMaxCPU, "style:font-size:22px") . "</td>\t\t\t\t\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:22px;' class=legend>{if_system_memory_exceed}:</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("MonitSquidMaxRestartMem", $MonitSquidMaxRestartMem, "font-size:22px;width:190px") . " MB</td>\n\t</tr>\n\t<tr><td colspan=2 style='font-size:30px'><hr></td></tr>\t\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{failover}", "{EnableFailover_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_checkbox_design("EnableFailover", 1, $EnableFailover) . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{ALLOW_RETURN_1CPU}", "{ALLOW_RETURN_1CPU_EXPLAIN}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_checkbox_design("ALLOW_RETURN_1CPU", 1, $MonitConfig["ALLOW_RETURN_1CPU"]) . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{DisableWebFilteringNetFailed}", "{DisableWebFilteringNetFailed_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_checkbox_design("DisableWebFilteringNetFailed", 1, $MonitConfig["DisableWebFilteringNetFailed"]) . "</td>\n\t</tr>\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{failover_ttl}", "{failover_ttl_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("MinTimeFailOverSwitch", $MonitConfig["MinTimeFailOverSwitch"], "font-size:22px;width:190px") . " {minutes}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{max_attempts} (CPU):</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("WEBPROCISSUE", $MonitConfig["WEBPROCISSUE"], "font-size:22px;width:190px") . " {errors}</td>\n\t\t\n\t</tr>\n<tr><td colspan=2 style='font-size:30px'><hr></td></tr>\t\n<tr><td colspan=2 style='font-size:30px'>{services_timeout}</td></tr>\n\t\t\t\t\t\n\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{StopMaxTTL}", "{StopMaxTTL_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("StopMaxTTL", $MonitConfig["StopMaxTTL"], "font-size:22px;width:90px") . " {seconds}</td>\n\t\t\n\t</tr>\t\n\t\t<tr>\n\t\t\t<td align='right' class=legend style='font-size:22px'>" . texttooltip("{shutdown_lifetime}", "{shutdown_lifetime_text}") . "</strong>:</td>\n\t\t\t<td align='left' style='font-size:22px'>" . Field_text("shutdown_lifetime-{$t}", $squid->shutdown_lifetime, 'width:90px;font-size:22px') . " {seconds}</td>\n\t\t</tr>\n\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{minimum_reload_interval}", "{SquidCacheReloadTTL_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("SquidCacheReloadTTL", $SquidCacheReloadTTL, "font-size:22px;width:190px") . " {minutes}</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{minimum_reboot_interval}", "{minimum_reboot_interval_explain}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("REBOOT_INTERVAL", $MonitConfig["REBOOT_INTERVAL"], "font-size:22px;width:190px") . " {minutes}</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>" . texttooltip("{SQUID_MAX_RESTART}", "{SQUID_MAX_RESTART_EXPLAIN}") . ":</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("MAX_RESTART", $MonitConfig["MAX_RESTART"], "font-size:22px;width:190px") . " </td>\n\t\t\n\t</tr>\n\t\t\t\t\n\t<tr><td colspan=2 style='font-size:30px'><hr></td></tr>\t\t\t\t\n\t<tr><td colspan=2 style='font-size:28px'>" . texttooltip("{when_fetching_proxy_informations}", "{when_fetching_proxy_informations_explain}") . "</td></tr>\n\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{tests_timeout}:</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("MgrInfosMaxTimeOut", $MonitConfig["MgrInfosMaxTimeOut"], "font-size:22px;width:190px") . " {seconds}</td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{max_failed_before_action}:</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_text("MgrInfosMaxFailed", $MonitConfig["MgrInfosMaxFailed"], "font-size:22px;width:90px") . " {times}</td>\n\t\t\n\t</tr>\t\t\t\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{restart_if_failed}:</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_checkbox_design("MgrInfosRestartFailed", 1, $MonitConfig["MgrInfosRestartFailed"]) . " </td>\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:22px'>{failover_if_failed}:</td>\n\t\t<td\tstyle='font-size:22px'>" . Field_checkbox_design("MgrInfosFaileOverFailed", 1, $MonitConfig["MgrInfosFaileOverFailed"]) . " </td>\n\t\t\n\t</tr>\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t<tr>\n<td colspan=2 align='right'><hr>" . button("{apply}", "Save{$t}()", 40) . "</td>\n</tr>\n</table>\n\t</div>\n\t<script>\n\tvar xSave{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tUnlockPage();\n\tRefreshTab('watchdog_settings_tabs');\n\tLoadjs('monit.restart.progress.php');\n\t}\n\t\n\tfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('SAVEGLOBAL','yes');\n\tXHR.appendData('watchdog',document.getElementById('watchdog').value);\n\tXHR.appendData('WEBPROCISSUE',document.getElementById('WEBPROCISSUE').value);\n\tXHR.appendData('MonitSquidMaxCPU',document.getElementById('MonitSquidMaxCPU').value);\n\tXHR.appendData('MonitSquidMaxRestartMem',document.getElementById('MonitSquidMaxRestartMem').value);\n\tXHR.appendData('SquidCacheReloadTTL',document.getElementById('SquidCacheReloadTTL').value);\n\tXHR.appendData('REBOOT_INTERVAL',document.getElementById('REBOOT_INTERVAL').value);\n\tXHR.appendData('MAX_RESTART',document.getElementById('MAX_RESTART').value);\n\tXHR.appendData('MgrInfosMaxTimeOut',document.getElementById('MgrInfosMaxTimeOut').value);\n\tXHR.appendData('MgrInfosMaxFailed',document.getElementById('MgrInfosMaxFailed').value);\n\tXHR.appendData('shutdown_lifetime',document.getElementById('shutdown_lifetime-{$t}').value);\n\tXHR.appendData('StopMaxTTL',document.getElementById('StopMaxTTL').value);\n\t\n\t\n\tif(document.getElementById('DisableWebFilteringNetFailed').checked){\n\t\tXHR.appendData('DisableWebFilteringNetFailed',1);\n\t}else{\n\t\tXHR.appendData('DisableWebFilteringNetFailed',0);\n\t}\n\tif(document.getElementById('ALLOW_RETURN_1CPU').checked){\n\t\tXHR.appendData('ALLOW_RETURN_1CPU',1);\n\t}else{\n\t\tXHR.appendData('ALLOW_RETURN_1CPU',0);\n\t}\t\n\tif(document.getElementById('EnableFailover').checked){\n\t\tXHR.appendData('EnableFailover',1);\n\t}else{\n\t\tXHR.appendData('EnableFailover',0);\n\t}\t\t\n\t\n\t\n\t\n\t\n\tif(document.getElementById('MgrInfosRestartFailed').checked){ XHR.appendData('MgrInfosRestartFailed',1); }else{ XHR.appendData('MgrInfosRestartFailed',0); }\n\tif(document.getElementById('MgrInfosFaileOverFailed').checked){ XHR.appendData('MgrInfosFaileOverFailed',1); }else{ XHR.appendData('MgrInfosFaileOverFailed',0); }\n\t\n\t\n\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n\t}\n\t</script>\n\t"; echo $tpl->_ENGINE_parse_body($html); }