function page(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $t=time(); $html="<div style='font-size:26px;margin-bottom:20px'>{APP_LOGGERS}</div> <div style='font-size:16px' class=text-info>{APP_LOGGERS_SQUID_EXPLAIN}</div> <div id='logger-status'></div> <script> function LoggerStatus$t(){ LoadAjax('logger-status','$page?logger-status=yes',false); } LoggerStatus$t(); </script> "; echo $tpl->_ENGINE_parse_body($html); }
function page(){ $sock=new sockets(); $tpl=new templates(); $IsInstalled=trim($sock->getFrameWork("system.php?phpmyadmin-installed=yes")); if($IsInstalled<>"TRUE"){ $button=button("{reinstall_software}","Loadjs('system.mysql.phpmyadmin.install.php')",36); echo FATAL_WARNING_SHOW_128("<span style='font-size:26px'>{ERROR_SERVICE_NOT_INSTALLED}</span><center style='margin:20px'>$button</center>"); } $version=trim($sock->getFrameWork("system.php?phpmyadpmin-version=yes")); $html=" <div style='width:100%;text-align:center'> <center> <center style='width:70%;margin:30px' class=form> <div style='font-size:26px'>PHPMyAdmin v.$version</div> <p> </p> ". button("PHPMyAdmin Front-end","document.location.href='/mysql';",40)."<p> </p></center></center></div>"; echo $tpl->_ENGINE_parse_body($html); }
function tabs(){ $sock=new sockets(); $results=base64_decode($sock->getFrameWork("squid.php?ziproxy-isinstalled=yes")); if($results<>"TRUE"){ echo FATAL_WARNING_SHOW_128("{the_specified_module_is_not_installed}"); return; } $tpl=new templates(); $page=CurrentPageName(); $array["status"]='{status}'; $array["popup"]='{parameters}'; $array["events-ziproxy"]='{compressor_requests}'; $t=time(); while (list ($num, $ligne) = each ($array) ){ if($num=="events-ziproxy"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.zipproxy.access.php?popup=yes\" style='font-size:18px'><span>$ligne</span></a></li>\n"); continue; } $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"$page?$num=yes\" style='font-size:18px'><span>$ligne</span></a></li>\n"); } echo build_artica_tabs($html, "main_zipproxy_tabs"); }
function popup() { $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $RemoteUfdbCat=intval($sock->GET_INFO("RemoteUfdbCat")); if($RemoteUfdbCat==0){ $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>0){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_ufdbcat_disabled}")); return; } } $t=time(); $html="<div style='font-size:16px' class=text-info>{squid_test_categories_perform}</div> <div style='width:95%;padding:15px' class=form> <center> ". Field_text("test-$t",null,"font-size:22px;letter-spacing:2px",null,null,null,false,"Run$t(event)",false)." </center> </div> <div id='results-$t'></div> <script> function Run$t(e){ if(!checkEnter(e)){return;} LoadAjax('results-$t','$page?test='+document.getElementById('test-$t').value,true); } </script>"; echo $tpl->_ENGINE_parse_body($html); }
function page() { $page = CurrentPageName(); $tpl = new templates(); $users = new usersMenus(); if (!$users->APACHE_MOD_BW) { echo FATAL_WARNING_SHOW_128("{the_specified_module_is_not_installed}"); return; } $servername_enc = urlencode($_GET["servername"]); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $sock = new sockets(); $free = new freeweb($_GET["servername"]); $Params = $free->Params; $t = time(); $ForceBandWidthModule = intval($Params["ModeBw"]["ForceBandWidthModule"]); $BandwidthAll = intval($Params["ModeBw"]["BandwidthAll"]); if ($BandwidthAll == 0) { $BandwidthAll = 1536000; } $BandwidthAll = $BandwidthAll / 1024; $html = "\n\n\t<div style='width:98%' class=form>\n\t" . Paragraphe_switch_img("{apache_Bandwidth_enable}", "{apache_Bandwidth_explain}", "bandlimit", "{$free->bandlimit}", null, 650) . "\n\t<table style='width:100%'>\n\t<td colspan=3 align=right>" . button("{rules}", "Loadjs('freeweb.mod.bw.php?servername={$servername_enc}')", 24) . "</td>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{limit_all_requests}:</td>\n\t\t<td>" . Field_checkbox("ForceBandWidthModule", 1, $ForceBandWidthModule) . "</td>\n\t\t<td></td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{default_limit}:</td>\n\t\t<td style='font-size:18px'>" . Field_text("BandwidthAll", $BandwidthAll, "font-size:18px;width:90px") . " KB/s</td>\n\t\t<td></td>\n\t</tr>\n\n\t<tr>\n\t\t<td colspan=3 align=right><hr>" . button("{apply}", "Save{$t}()", 24) . "</td>\n\t</tr>\n\t</table>\n\t<p> </p>\n\t</div>\n<script>\n\tvar xSave{$t}=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tRefreshTab('main_freeweb_qos');\n\t}\n\t\nfunction Save{$t}(){\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('bandlimit',document.getElementById('bandlimit').value);\n\tif(document.getElementById('ForceBandWidthModule').checked){\n\t\tXHR.appendData('ForceBandWidthModule',1);\n\t}else{\n\t\tXHR.appendData('ForceBandWidthModule',0);\n\t}\n\t\n\t\n\tXHR.appendData('BandwidthAll',document.getElementById('BandwidthAll').value);\n\tXHR.appendData('servername','{$_GET["servername"]}');\n\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\n}\n</script>"; echo $tpl->_ENGINE_parse_body($html); }
function tabs(){ $tpl=new templates(); $q=new mysql_squid_builder(); $sock=new sockets(); $status=trim($sock->getFrameWork("squid.php?videocache-streamsquidcache=yes")); if($status<>"TRUE"){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{module_in_squid_not_installed}<hr>{EnableStreamCache_text}")); return; } $page=CurrentPageName(); $array["status"]='{status}'; $array["parameters"]='{parameters}'; $array["events"]='{events}'; $array["events-retriver"]='{retreiver_events}'; if($q->TABLE_EXISTS("videocacheA")){ $array["stats"]='{statistics}'; } $array["websites"]="{supported_websites}"; $t=time(); while (list ($num, $ligne) = each ($array) ){ if($num=="events"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.videocache.events.php\" style='font-size:18px'><span>$ligne</span></a></li>\n"); continue; } if($num=="events-retriver"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.videocache.events-retreiver.php\" style='font-size:18px'><span>$ligne</span></a></li>\n"); continue; } if($num=="master"){ $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"squid.master-proxy.php?byQuicklinks=yes\" style='font-size:18px'><span>$ligne</span></a></li>\n"); continue; } $html[]= $tpl->_ENGINE_parse_body("<li><a href=\"$page?$num=yes\" style='font-size:18px'><span>$ligne</span></a></li>\n"); } echo build_artica_tabs($html, "main_squid_videocache_tabs",1200)."<script>LeftDesign('videocache-256-white-opac20.png');</script>"; }
function tabs() { $ID = intval($_GET["ID"]); $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $title = $tpl->javascript_parse_text("{new_server}"); $sock = new sockets(); $EnableNginx = intval($sock->GET_INFO("EnableNginx")); if ($EnableNginx == 0) { echo FATAL_WARNING_SHOW_128("\n\t\t{enable_reverse_proxy_service}\n\t\t<center style='margin:30px'>" . button("{enable_reverse_proxy_service}", "Loadjs('{$page}?EnableNginx=yes')", 42) . "</center>"); return; } if ($ID > 0) { $q = new mysql_squid_builder(); $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT ipaddr FROM reverse_sources WHERE ID='{$ID}'")); $title = $ligne["ipaddr"]; } $array["general-settings"] = $title; $array["web-servers"] = '{web_servers}'; $fontsize = 18; while (list($num, $ligne) = each($array)) { if ($num == "web-servers") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.peer.www.php?ID={$ID}\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "events") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.events.php?ID={$ID}\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "destinations") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.destinations.php?ID={$ID}\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } $tab[] = "<li style='font-size:{$fontsize}px'><a href=\"{$page}?{$num}=yes&ID={$ID}\"><span >{$ligne}</span></a></li>\n"; } $t = time(); // echo build_artica_tabs($tab, "main_source_{$ID}") . "<script>"; }
function popup(){ $tpl=new templates(); $sock=new sockets(); $page=CurrentPageName(); $users=new usersMenus(); $squid=new squidbee(); $EnableArticaHotSpot=$sock->GET_INFO("EnableArticaHotSpot"); $SquidHotSpotPort=intval($sock->GET_INFO("SquidHotSpotPort")); $ArticaHotSpotPort=intval($sock->GET_INFO("ArticaHotSpotPort")); $ArticaSSLHotSpotPort=$sock->GET_INFO("ArticaSSLHotSpotPort"); $ArticaSplashHotSpotPort=$sock->GET_INFO("ArticaSplashHotSpotPort"); $ArticaSplashHotSpotPortSSL=$sock->GET_INFO("ArticaSplashHotSpotPortSSL"); $ArticaSplashHotSpotCacheAuth=$sock->GET_INFO("ArticaSplashHotSpotCacheAuth"); $ArticaSplashHotSpotCertificate=$sock->GET_INFO("ArticaSplashHotSpotCertificate"); $ArticaSplashHotSpotEndTime=$sock->GET_INFO("ArticaSplashHotSpotEndTime"); $SquidHotSpotSSLPort=intval($sock->GET_INFO("SquidHotSpotSSLPort")); $WifiDogDebugLevel=intval($sock->GET_INFO("WifiDogDebugLevel")); $ArticaHotSpotInterface2=$sock->GET_INFO("ArticaHotSpotInterface2"); if(!is_numeric($ArticaSplashHotSpotCacheAuth)){$ArticaSplashHotSpotCacheAuth=60;} if(!is_numeric($ArticaSplashHotSpotEndTime)){$ArticaSplashHotSpotEndTime=0;} $ArticaHotSpotInterface=$sock->GET_INFO("ArticaHotSpotInterface"); if(!$users->CONNTRACK_INSTALLED){ echo FATAL_WARNING_SHOW_128("{conntrackd_not_installed}"); } for($i=0;$i<11;$i++){ $WifiDogDebugLevelZ[$i]=$i; } $Timez[60]="1 {hour}"; $Timez[120]="2 {hours}"; $Timez[180]="3 {hours}"; $Timez[360]="6 {hours}"; $Timez[720]="12 {hours}"; $Timez[1440]="1 {day}"; $Timez[2880]="2 {days}"; $Timez[10080]="1 {week}"; $Timez[0]="{unlimited}"; $Timez[30]="30 {minutes}"; $Timez[60]="1 {hour}"; $Timez[120]="2 {hours}"; $Timez[180]="3 {hours}"; $Timez[360]="6 {hours}"; $Timez[720]="12 {hours}"; $Timez[1440]="1 {day}"; $Timez[2880]="2 {days}"; $Timez[10080]="1 {week}"; $Timez[20160]="2 {weeks}"; $Timez[40320]="1 {month}"; $ArticaHotSpotEnableMIT=$sock->GET_INFO("ArticaHotSpotEnableMIT"); $ArticaHotSpotEnableProxy=$sock->GET_INFO("ArticaHotSpotEnableProxy"); if(!is_numeric($ArticaHotSpotEnableMIT)){$ArticaHotSpotEnableMIT=1;} if(!is_numeric($ArticaHotSpotEnableProxy)){$ArticaHotSpotEnableProxy=1;} if(!is_numeric($ArticaHotSpotPort)){$ArticaHotSpotPort=0;} if(!is_numeric($ArticaSplashHotSpotPort)){$ArticaSplashHotSpotPort=16080;} if(!is_numeric($ArticaSplashHotSpotPortSSL)){$ArticaSplashHotSpotPortSSL=16443;} $ArticaSplashHotSpotTitle=$sock->GET_INFO("ArticaSplashHotSpotTitle"); if($ArticaSplashHotSpotTitle==null){$ArticaSplashHotSpotTitle="HotSpot system";} if($ArticaHotSpotPort==0){ $ArticaHotSpotPort=rand(38000, 64000); $sock->SET_INFO("ArticaHotSpotPort", $ArticaHotSpotPort); } if($ArticaSSLHotSpotPort==0){ $ArticaSSLHotSpotPort=rand(38500, 64000); $sock->SET_INFO("ArticaSSLHotSpotPort", $ArticaSSLHotSpotPort); } if($SquidHotSpotPort==0){ $SquidHotSpotPort=rand(40000, 64000); $sock->SET_INFO("SquidHotSpotPort", $SquidHotSpotPort); } if($SquidHotSpotSSLPort==0){ $SquidHotSpotSSLPort=rand(40500, 64000); $sock->SET_INFO("SquidHotSpotSSLPort", $SquidHotSpotSSLPort); } $tcp=new networking(); $interfacesZ=$tcp->Local_interfaces(); while (list ($interface, $line) = each ($interfacesZ) ){ $p=new system_nic($interface); if($p->IsBridged($interface)){continue;} $interfaces[$interface]=$p->NICNAME; } $interfaces[null]="{none}"; include_once(dirname(__FILE__)."/ressources/class.squid.reverse.inc"); $squid_reverse=new squid_reverse(); $sslcertificates=$squid_reverse->ssl_certificates_list(); $t=time(); $html=" <div id='$t' class=text-info style='font-size:18px'>{HotSpot_text}</div> <div style='width:98%' class=form> <table style='width:99%'> <tr> <td colspan=2> <center><img src='img/hotspot-howto.png' align=center></center> </td> </tr> <tr> <td style='font-size:42px' colspan>{service2}:</td> </tr> <tr> <td class=legend style='font-size:22px'>{listen_port} (HotSpot):</td> <td>". Field_text("ArticaHotSpotPort",$ArticaHotSpotPort,"font-size:22px;width:110px")."</td> </tr> <tr> <td class=legend style='font-size:22px'>{interface} (IN):</td> <td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface", $ArticaHotSpotInterface,"style:font-size:22px")."</td> </tr> <tr> <td class=legend style='font-size:22px'>{interface} (OUT):</td> <td>". Field_array_Hash($interfaces,"ArticaHotSpotInterface2", $ArticaHotSpotInterface2,"style:font-size:22px")."</td> </tr> <tr> <td class=legend style='font-size:22px'>{log_level}:</td> <td>". Field_array_Hash($WifiDogDebugLevelZ,"WifiDogDebugLevel", $WifiDogDebugLevel,"style:font-size:22px")."</td> </tr> <tr> <td style='font-size:42px' colspan>{webserver}:</td> </tr> <tr> <td class=legend style='font-size:22px'>{listen_port} (splash):</td> <td>". Field_text("ArticaSplashHotSpotPort",$ArticaSplashHotSpotPort,"font-size:22px;width:110px")."</td> </tr> <tr> <td class=legend style='font-size:22px'>{listen_port} (splash/SSL):</td> <td>". Field_text("ArticaSplashHotSpotPortSSL",$ArticaSplashHotSpotPortSSL,"font-size:22px;width:110px")."</td> </tr> <tr> <td style='font-size:42px' colspan>Proxy:</td> </tr> <tr> <td class=legend style='font-size:22px'>{transparent_ssl}:</td> <td>". Field_checkbox("ArticaHotSpotEnableMIT",1,$ArticaHotSpotEnableMIT)."</td> </tr> <tr> <td class=legend style='font-size:22px'>{transparent_http}:</td> <td>". Field_checkbox("ArticaHotSpotEnableProxy",1,$ArticaHotSpotEnableProxy)."</td> </tr> <tr> <td class=legend style='font-size:22px'>{listen_port} (Proxy HTTP):</td> <td>". Field_text("SquidHotSpotPort",$SquidHotSpotPort,"font-size:22px;width:110px")."</td> </tr> <tr> <td class=legend style='font-size:22px'>{listen_port} (Proxy SSL):</td> <td>". Field_text("SquidHotSpotSSLPort",$SquidHotSpotSSLPort,"font-size:22px;width:110px")."</td> </tr> <tr> <td style='font-size:42px' colspan>{defaults}:</td> </tr> <tr> <td class=legend style='font-size:22px;text-transform:capitalize'>{re_authenticate_each} ({default}):</td> <td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotCacheAuth", $ArticaSplashHotSpotCacheAuth,null,null,0,"font-size:22px")."</td> </tr> <tr> <td class=legend style='font-size:22px;text-transform:capitalize'>{endtime} ({default}):</td> <td style='font-size:18px'>". Field_array_Hash($Timez,"ArticaSplashHotSpotEndTime", $ArticaSplashHotSpotEndTime,null,null,0,"font-size:22px")."</td> </tr> <tr> <td style='font-size:42px' colspan>{web_page}:</td> </tr> <tr> <td class=legend style='font-size:22px'>{title2}:</td> <td>". Field_text("ArticaSplashHotSpotTitle",$ArticaSplashHotSpotTitle,"font-size:22px;width:390px")."</td> </tr> <tr> <td class=legend nowrap style='font-size:22px;'>{certificate}:</td> <td >". Field_array_Hash($sslcertificates, "ArticaSplashHotSpotCertificate", $ArticaSplashHotSpotCertificate,null,null,0,"font-size:22px")."</td> </tr> <tr> <td colspan=2 align='right'><hr>". button("{apply}","SaveHotSpot()","42px")."</td> </tr> </table> </div> <script> var x_SaveHotSpot= function (obj) { var results=obj.responseText; if(results.length>3){alert(results);return;} Loadjs('squid.webauth.restart.php'); } function SaveHotSpot(){ var XHR = new XHRConnection(); XHR.appendData('ArticaHotSpotPort',document.getElementById('ArticaHotSpotPort').value); XHR.appendData('SquidHotSpotPort',document.getElementById('SquidHotSpotPort').value); XHR.appendData('ArticaSplashHotSpotPort',document.getElementById('ArticaSplashHotSpotPort').value); XHR.appendData('ArticaSplashHotSpotPortSSL',document.getElementById('ArticaSplashHotSpotPortSSL').value); XHR.appendData('ArticaHotSpotInterface',document.getElementById('ArticaHotSpotInterface').value); XHR.appendData('ArticaHotSpotInterface2',document.getElementById('ArticaHotSpotInterface2').value); XHR.appendData('ArticaSplashHotSpotCacheAuth',document.getElementById('ArticaSplashHotSpotCacheAuth').value); XHR.appendData('ArticaSplashHotSpotCertificate',document.getElementById('ArticaSplashHotSpotCertificate').value); XHR.appendData('ArticaSplashHotSpotEndTime',document.getElementById('ArticaSplashHotSpotEndTime').value); XHR.appendData('WifiDogDebugLevel',document.getElementById('WifiDogDebugLevel').value); if(document.getElementById('ArticaHotSpotEnableMIT').checked){ XHR.appendData('ArticaHotSpotEnableMIT',1); }else{ XHR.appendData('ArticaHotSpotEnableMIT',0); } if(document.getElementById('ArticaHotSpotEnableProxy').checked){ XHR.appendData('ArticaHotSpotEnableProxy',1); }else{ XHR.appendData('ArticaHotSpotEnableProxy',0); } var ArticaSplashHotSpotTitle=encodeURIComponent(document.getElementById('ArticaSplashHotSpotTitle').value); XHR.appendData('ArticaSplashHotSpotTitle',document.getElementById('ArticaSplashHotSpotTitle').value); XHR.sendAndLoad('$page', 'POST',x_SaveHotSpot); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function iptables_status(){ $page=CurrentPageName(); $tpl=new templates(); $eth=$_GET["eth"]; $sock=new sockets(); $EnableArticaAsGateway=intval($sock->GET_INFO("EnableArticaAsGateway")); $ethC=new system_nic($eth); $isFW=$ethC->isFW; $isFWAcceptNet=$ethC->isFWAcceptNet; $isFWLogBlocked=$ethC->isFWLogBlocked; if($ethC->Bridged==1){ $text=$tpl->_ENGINE_parse_body("{warn_this_interface_is_bridged_to}"); $text=str_replace("%s", $ethC->BridgedTo, $text); $error_bridge=FATAL_WARNING_SHOW_128($text); } if(preg_match("#^br([0-9]+)#", $eth,$re)){ $q=new mysql(); $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT isFW,isFWAcceptNet,isFWLogBlocked FROM nics_bridge WHERE ID='{$re[1]}'","artica_backup")); if(!$q->ok){echo "<p class=text-error>$q->mysql_error</p>";} $isFW=$ligne["isFW"]; $isFWAcceptNet=$ligne["isFWAcceptNet"]; $isFWLogBlocked=$ligne["isFWLogBlocked"]; $error_bridge=null; } if(!is_numeric($isFWAcceptNet)){$isFWAcceptNet=1;} if(!is_numeric($isFWLogBlocked)){$isFWLogBlocked=0;} $t=time(); $EnableArticaAsGateway=Paragraphe_switch_img('{ARTICA_AS_GATEWAY}','{ARTICA_AS_GATEWAY_EXPLAIN}',"EnableArticaAsGateway-$t",$EnableArticaAsGateway,null,550); $p=Paragraphe_switch_img("{activate_firewall_nic}", "{activate_firewall_nic_explain}","isFW-$t",$isFW,null,550); $p1=Paragraphe_switch_img("{trust_local_networks}", "{trust_local_networks_explain}","isFWAcceptNet-$t",$isFWAcceptNet,null,550); $p2=Paragraphe_switch_img("{isFWLogBlocked}", "{isFWLogBlocked_explain}","isFWLogBlocked-$t",$isFWLogBlocked,null,550); $html="<div style='width:98%' class=form> $error_bridge <table style='width:100%'> <tr> <td colspan=2 align='right' style='font-size:22px'><hr> ". button("{firewall_rules}","Save$t();Loadjs('firewall.view.php')",22)." | ". button("{apply_firewall_rules}","Save$t();Loadjs('firewall.restart.php')",22)." <hr> </td> </tr> <tr> <td colspan=2> $EnableArticaAsGateway <div style='text-align:right'><hr>". button("{apply}","SaveGateway$t()",22)."</div> </td> </tr> <tr> <td colspan=2>$p</td> </tr> <tr> <td colspan=2>$p1</td> </tr> <tr> <td colspan=2>$p2</td> </tr> <tr> <td colspan=2 align='right'><hr>". button("{apply}","Save$t()",22)."</td> </tr> </table> </div> <script> var xSave$t= function (obj) { var res=obj.responseText; if (res.length>3){alert(res);} RefreshTab('main_firewall_table_$eth'); } function Save$t(){ var XHR = new XHRConnection(); XHR.appendData('eth', '$eth'); XHR.appendData('isFW', document.getElementById('isFW-$t').value); XHR.appendData('isFWLogBlocked', document.getElementById('isFWLogBlocked-$t').value); XHR.appendData('isFWAcceptNet', document.getElementById('isFWAcceptNet-$t').value); XHR.sendAndLoad('$page', 'POST',xSave$t); } function SaveGateway$t(){ var XHR = new XHRConnection(); XHR.appendData('EnableArticaAsGateway', document.getElementById('EnableArticaAsGateway-$t').value); XHR.sendAndLoad('$page', 'POST',xSave$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function page(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $t=time(); $events=$tpl->_ENGINE_parse_body("{events}"); $zdate=$tpl->_ENGINE_parse_body("{zDate}"); $proto=$tpl->_ENGINE_parse_body("{proto}"); $uri=$tpl->_ENGINE_parse_body("{url}"); $member=$tpl->_ENGINE_parse_body("{member}"); if(function_exists("date_default_timezone_get")){$timezone=" - ".date_default_timezone_get();} $title=$tpl->_ENGINE_parse_body("{today}: {realtime_requests} ".date("H")."h$timezone"); $zoom=$tpl->_ENGINE_parse_body("{zoom}"); $button1="{name: 'Zoom', bclass: 'Search', onpress : ZoomSquidAccessLogs},"; $stopRefresh=$tpl->javascript_parse_text("{stop_refresh}"); $logs_container=$tpl->javascript_parse_text("{logs_container}"); $refresh=$tpl->javascript_parse_text("{refresh}"); $items=$tpl->_ENGINE_parse_body("{items}"); $size=$tpl->_ENGINE_parse_body("{size}"); $SaveToDisk=$tpl->_ENGINE_parse_body("{SaveToDisk}"); $addCat=$tpl->_ENGINE_parse_body("{add} {category}"); $date=$tpl->_ENGINE_parse_body("{zDate}"); $task=$tpl->_ENGINE_parse_body("{task}"); $new_schedule=$tpl->_ENGINE_parse_body("{new_rotate}"); $explain=$tpl->_ENGINE_parse_body("{explain_squid_tasks}"); $run=$tpl->_ENGINE_parse_body("{run}"); $task=$tpl->_ENGINE_parse_body("{task}"); $size=$tpl->_ENGINE_parse_body("{size}"); $filename=$tpl->_ENGINE_parse_body("{filename}"); $empty=$tpl->_ENGINE_parse_body("{empty}"); $askdelete=$tpl->javascript_parse_text("{empty_store} ?"); $files=$tpl->_ENGINE_parse_body("{files}"); $ext=$tpl->_ENGINE_parse_body("{extension}"); $back_to_events=$tpl->_ENGINE_parse_body("{back_to_events}"); $Compressedsize=$tpl->_ENGINE_parse_body("{compressed_size}"); $realsize=$tpl->_ENGINE_parse_body("{realsize}"); $delete_file=$tpl->javascript_parse_text("{delete_file}"); $rotate_logs=$tpl->javascript_parse_text("{rotate_logs}"); $change_date=$tpl->javascript_parse_text("{change_date}"); $MAC=$tpl->_ENGINE_parse_body("{MAC}"); $reload_proxy_service=$tpl->_ENGINE_parse_body("{reload_proxy_service}"); $table_size=855; $url_row=650; $member_row=330; $table_height=500; $distance_width=230; $tableprc="100%"; $margin="-10"; $margin_left="-15"; if(is_numeric($_GET["table-size"])){$table_size=$_GET["table-size"];} if(is_numeric($_GET["url-row"])){$url_row=$_GET["url-row"];} $parameters=$tpl->_ENGINE_parse_body("{parameters}"); if(isset($_GET["bypopup"])){ $table_size=1019; $url_row=650; $member_row=333; $distance_width=352; $margin=0; $margin_left="-5"; $tableprc="99%"; $button1="{name: '<strong id=refresh-$t>$stopRefresh</stong>', bclass: 'Reload', onpress : StartStopRefresh$t},"; $table_height=590; $Start="StartRefresh$t()"; } $q=new mysql_squid_builder(); $countContainers=$q->COUNT_ROWS("squid_storelogs"); if($countContainers>0){ $button2="{name: '<strong id=container-log-$t>$logs_container</stong>', bclass: 'SSQL', onpress : StartLogsContainer$t},"; $button_container="{name: '<strong id=container-log-$t>$back_to_events</stong>', bclass: 'SSQL', onpress : StartLogsSquidTable$t},"; $button_container_delall="{name: '$empty', bclass: 'Delz', onpress : EmptyStore$t},"; $ligne=mysql_fetch_array($q->QUERY_SQL("SELECT SUM(Compressedsize) as tsize FROM squid_storelogs")); $title_table_storage="$logs_container $countContainers $files (".FormatBytes($ligne["tsize"]/1024).")"; } $ipaddr=$tpl->javascript_parse_text("{ipaddr}"); $error=$tpl->javascript_parse_text("{error}"); $sitename=$tpl->javascript_parse_text("{sitename}"); //$button3="{name: '<strong id=container-log-$t>$rotate_logs</stong>', bclass: 'Reload', onpress : SquidRotate$t},"; $buttons[]="{name: '<strong>$parameters</stong>', bclass: 'Settings', onpress : Settings$t},"; //$buttons[]="{name: '<strong>$reload_proxy_service</stong>', bclass: 'Reload', onpress : ReloadProxy$t},"; $buttons=@implode("", $buttons); $html=" <div style='margin:{$margin}px;margin-left:{$margin_left}px' id='$t-main-form'> <table class='flexRT$t' style='display: none' id='flexRT$t' style='width:$tableprc'></table> </div> <input type='hidden' id='refresh$t' value='1'> <script> var mem$t=''; function StartLogsSquidTable$t(){ document.getElementById('$t-main-form').innerHTML=''; document.getElementById('$t-main-form').innerHTML='<table class=\"flexRT$\" style=\"display: none\" id=\"flexRT$t\" style=\"width:$tableprc\"></table>'; $('#flexRT$t').flexigrid({ url: '$page?events-list=yes', dataType: 'json', colModel : [ {display: ' ', name : 'filetime', width :16, sortable : true, align: 'left'}, {display: '$zdate', name : 'zDate', width :52, sortable : true, align: 'left'}, {display: '$uri', name : 'events', width : $url_row, sortable : false, align: 'left'}, {display: '$member', name : 'mmeber', width : $member_row, sortable : false, align: 'left'}, ], buttons : [ $buttons ], searchitems : [ {display: '$sitename', name : 'sitename'}, {display: '$uri', name : 'uri'}, {display: '$member', name : 'uid'}, {display: '$error', name : 'TYPE'}, {display: '$ipaddr', name : 'CLIENT'}, {display: '$MAC', name : 'MAC'}, ], sortname: 'zDate', sortorder: 'desc', usepager: true, title: '<span style=\"font-size:16px\">$title</span>', useRp: true, rp: 50, showTableToggleBtn: false, width: '99%', height: $table_height, singleSelect: true, rpOptions: [10, 20, 30, 50,100,200] }); } function OnlyCached$t(){ $('#flexRT$t').flexOptions({url: '$page?events-list=yes&cached=1'}).flexReload(); } function OnlyAll$t(){ $('#flexRT$t').flexOptions({url: '$page?events-list=yes'}).flexReload(); } function Settings$t(){ Loadjs('$page?logfile-daemon-js=yes'); } function ReloadProxy$t(){ Loadjs('squid.reload.progress.php'); } function ChangeDate$t(){ Loadjs('$page?change-date-js=yes&t=$t'); } function StartLogsContainer$t(){ document.getElementById('$t-main-form').innerHTML=''; document.getElementById('$t-main-form').innerHTML='<span id=\"StopRefreshNewTable$t\"></span><table class=\"flexRT$\" style=\"display: none\" id=\"flexRT$t\" style=\"width:$tableprc\"></table>'; $(document).ready(function(){ $('#flexRT$t').flexigrid({ url: '$page?container-list=yes&t=$t', dataType: 'json', colModel : [ {display: '$zdate', name : 'filetime', width :162, sortable : true, align: 'left'}, {display: ' ', name : 'filetime', width :$distance_width, sortable : true, align: 'left'}, {display: '$filename', name : 'filename', width :154, sortable : false, align: 'left'}, {display: '$ext', name : 'fileext', width :33, sortable : false, align: 'center'}, {display: '$size', name : 'filesize', width : 92, sortable : true, align: 'left'}, {display: '$Compressedsize', name : 'Compressedsize', width : 92, sortable : true, align: 'left'}, {display: '$delete', name : 'delete', width : 31, sortable : false, align: 'center'}, ], buttons : [ $button_container ], searchitems : [ {display: '$sitename', name : 'sitename'}, {display: '$uri', name : 'uri'}, {display: '$member', name : 'uid'}, {display: '$error', name : 'TYPE'}, {display: '$ipaddr', name : 'CLIENT'}, ], sortname: 'zDate', sortorder: 'desc', usepager: true, title: '$title_table_storage', useRp: true, rp: 50, showTableToggleBtn: false, width: $table_size, height: $table_height, singleSelect: true, rpOptions: [10, 20, 30, 50,100,200] }); }); } function SelectGrid2(com, grid) { var items = $('.trSelected',grid); var id=items[0].id; id = id.substring(id.lastIndexOf('row')+3); if (com == 'Select') { LoadAjax('table-1-selected','$page?familysite-show='+id); } } $('table-1-selected').remove(); $('flex1').remove(); function ZoomSquidAccessLogs(){ s_PopUp('squid.accesslogs.php?external=yes',1024,768); } function StartStopRefresh$t(){ var ratxt='$stopRefresh'; var rstxt='$refresh'; var refresh=document.getElementById('refresh$t').value; if(refresh==1){ document.getElementById('refresh$t').value=0; document.getElementById('refresh-$t').innerHTML='$refresh'; }else{ document.getElementById('refresh$t').value=1; document.getElementById('refresh-$t').innerHTML='$stopRefresh'; $('#flexRT$t').flexReload(); } } function StartRefresh$t(){ if(!document.getElementById('flexRT$t')){return;} var refresh=document.getElementById('refresh$t').value; if(refresh==1){ if(!document.getElementById('StopRefreshNewTable$t')){ $('#flexRT$t').flexReload(); } } setTimeout('StartRefresh$t()',5000); } function LogsContainer$t(){ StartLogsContainer$t() } function SquidRotate$t(){ Loadjs('squid.perf.logrotate.php?tabs=squid_main_svc'); } var x_LogsCsvDelte$t = function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue);return;} $('#row'+mem$t).remove(); } var x_EmptyStore$t = function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue);return;} $('#flexRT$t').flexReload(); } function EmptyStore$t(){ if(confirm('$askdelete')){ var XHR = new XHRConnection(); XHR.appendData('empty-store','yes'); XHR.sendAndLoad('$page', 'POST',x_EmptyStore$t); } } function LogsCsvDelte$t(ID,md5){ mem$t=md5; if(confirm('$delete_file :'+ID)){ var XHR = new XHRConnection(); XHR.appendData('csv-delete',ID); XHR.sendAndLoad('$page', 'POST',x_LogsCsvDelte$t); } } setTimeout('StartLogsSquidTable$t()',800); $Start; </script> "; echo $html; }
function page(){ $tpl=new templates(); $page=CurrentPageName(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $tt=time(); $t=time(); $html=" <div id='main-page-squid-statistics-central'> <div class=text-info style='font-size:16px'>{squid_stats_central_progress_explain}</div> <center style='font-size:32px;margin:15px' id='squid-stats-central-progress-title-$t'></center> <div id='squid-stats-central-progress' style='height:50px'></div> <center style='margin:20px'>". button("{execute_now}", "Loadjs('$page?execute-js=yes',false)",26)."</center> <div id='squid-stats-central-details'></div> </div> <script> $('#squid-stats-central-progress').progressbar({ value: 0 }); LoadAjaxSilent('squid-stats-central-details','$page?squid-stats-central-details=yes&t=$t'); </script> "; echo $tpl->_ENGINE_parse_body($html); }
function central_information(){ $t=$_GET["t"]; $page=CurrentPageName(); $tpl=new templates(); $users=new usersMenus(); $TRPTEXT=null; $sock=new sockets(); $processes=unserialize(base64_decode($sock->getFrameWork("squidstats.php?processes-queue=yes"))); $DisableArticaProxyStatistics=$sock->GET_INFO("DisableArticaProxyStatistics"); if(!is_numeric($DisableArticaProxyStatistics)){$DisableArticaProxyStatistics=0;} $APP_SQUIDDB_INSTALLED=trim($sock->getFrameWork("squid.php?IS_APP_SQUIDDB_INSTALLED=yes")); if(is_array($processes)){ $TRP[]="<table style='width:99%' class=form>"; while (list ($index, $ligne) = each ($processes) ){ $TTL=$ligne["TTL"]; $PID=$ligne["PID"]; $day=$ligne["day"]; $TRP[]="<tr> <td width=1%><img src='img/preloader.gif'></td> <td style='font-weight:bold'>{processing} $day PID:$PID {since} $TTL</td> </tr>"; } $TRP[]="</table>"; $TRPTEXT=@implode("\n", $TRP); } //database-connect-settings-32.png $squiddb=Paragraphe32('mysql_statistics_engine','mysql_statistics_engine_params' ,"blur()","database-connect-settings-32-grey.png"); if($users->PROXYTINY_APPLIANCE){$squiddb=null;} if(!$users->PROXYTINY_APPLIANCE){ //$tr[]=Paragraphe32("old_statistics_interface", "old_statistics_interface_text", "SquidQuickLinksStatistics();", "status_statistics-22.png"); if(!$users->PROXYTINY_APPLIANCE){ $tr[]=Paragraphe32('remote_statistics_server','remote_statistics_server_text',"javascript:Loadjs('squid.stats-appliance.php',true)",'syslog-32-client.png'); if($DisableArticaProxyStatistics==0){ $tr[]=Paragraphe32('import_squid_logs','import_squid_logs_explain',"Loadjs('squid.logs.import.php',true)",'32-import.png'); } $tr[]=Paragraphe32('APP_ARTICADB','APP_ARTICADB_TEXT',"Loadjs('squid.categories.php?onlyDB=yes',true)",'32-categories.png'); if($DisableArticaProxyStatistics==0){ $tr[]=table_heures_enretard(); $tr[]=Paragraphe32('remote_mysql_server','remote_mysqlsquidserver_text',"Loadjs('squid.remote-mysql.php',true)","artica-meta-32.png"); $tr[]=Paragraphe32('restore_purged_statistics','restore_purged_statistics_explain',"Loadjs('squid.artica.statistics.restore.php',true)","32-import.png"); } $tr[]=Paragraphe32('source_logs','source_logs_squid_text' ,"Loadjs('squid.logrotate.php',true)","32-logs.png"); $tr[]=Paragraphe32('enable_disable_statistics','ARTICA_STATISTICS_TEXT' ,"Loadjs('squid.artica.statistics.php',true)","statistics-32.png"); } if(!$users->CORP_LICENSE){$more_features="<div class=text-info style='font-size:16px;'>{squid_stats_nolicence_explain}</div>";} if($DisableArticaProxyStatistics==1){ $more_features="<div class=text-info style='font-size:16px;'>{squid_stats_disabled_explain}</div>"; } } // $tr[]=Paragraphe32('APP_SARG','APP_SARG_TXT',"Loadjs('sarg.php',true)","sarg-logo-32.png"); $tr[]=Paragraphe32('APP_SARG_HOWTO','APP_SARG_HOWTO_TXT', "s_PopUpFull('http://proxy-appliance.org/index.php?cID=203',1024,768,'Statistics');","help-32.png"); if($users->URLSNARF_INSTALLED){ //$tr[]=Paragraphe32('APP_URLSNARF','APP_URLSNARF_TEXT',"Loadjs('urlsnarf.php')","website-32.png"); } $table=CompileTr2($tr,true); $garphs="<div id='graph1-$t' style='height:250px'><center style='margin:50px'><img src='img/wait-clock.gif'></center></div> <div style='text-align:right'>". imgtootltip("refresh-24.png","{refresh}","Loadjs('$page?graphique_heure=yes&container=graph1-$t');")."</div>"; $garphsjs="Loadjs('$page?graphique_heure=yes&container=graph1-$t');"; if($sock->SQUID_LOCAL_STATS_DISABLED()){ $garphs=$tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); $garphsjs=null; } $EnableSquidRemoteMySQL=$sock->GET_INFO("EnableSquidRemoteMySQL"); if(!is_numeric($EnableSquidRemoteMySQL)){$EnableSquidRemoteMySQL=0;} if($EnableSquidRemoteMySQL==1){ $garphs="<div id='graph1-$t' style='height:250px'><center style='margin:50px'><img src='img/wait-clock.gif'></center></div> <div style='text-align:right'>". imgtootltip("refresh-24.png","{refresh}","Loadjs('$page?graphique_heure=yes&container=graph1-$t');")."</div>"; $garphsjs="Loadjs('$page?graphique_heure=yes&container=graph1-$t');"; $more_features=null;} $html=" <div style='font-size:22px;margin-bottom:15px'>{SQUID_STATS}</div> $garphs $TRPTEXT $more_features <center> <div style='margin-top:15px;width:80%'>$table</div> </center> <script> LoadAjax('info-gene-$t','squid.traffic.statistics.php?squid-status-stats=yes',true); $garphsjs </script> "; echo $tpl->_ENGINE_parse_body($html); }
function step8(){ $tpl=new templates(); $sock=new sockets(); $net=new networking(); $page=CurrentPageName(); $MAIN=unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth=$MAIN["eth"]; $t=time(); if(!is_numeric($MAIN["SLAVE_SSL"])){$MAIN["SLAVE_SSL"]=1;} $proto="http"; if($MAIN["SLAVE_SSL"]==1){$proto="https";} $MAIN=unserialize(base64_decode($sock->GET_INFO("HASettings"))); $eth=$MAIN["eth"]; $nic=new system_nic($eth); $MAIN["BALANCE_IP"]=$nic->IPADDR; $SEND_SETTING=urlencode(base64_encode(serialize($MAIN))); $uri="$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]}/nodes.listener.php?ucarp3=$SEND_SETTING"; $curl=new ccurl($uri); $curl->NoHTTP_POST=true; if(!$curl->get()){ $deb=debug_curl($curl->CURL_ALL_INFOS); echo FATAL_WARNING_SHOW_128($curl->error."<hr> <strong>$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} SSL:{$MAIN["SLAVE_SSL"]}</strong> <hr> $deb<hr>".wizard_restart()); return; } if(!preg_match("#<RESULTS>(.+?)</RESULTS>#is", $curl->data,$re)){ echo FATAL_WARNING_SHOW_128("<hr> <strong>$proto://{$MAIN["SLAVE"]}:{$MAIN["SLAVE_PORT"]} SSL:{$MAIN["SLAVE_SSL"]}</strong> <br> {protocol_error} <br> {check_same_version_artica}<br>$curl->data<br>$deb".wizard_restart()); return; } $sock=new sockets(); $sock->getFrameWork("network.php?reconfigure-restart=yes"); $reboot_remote_server_net=$tpl->javascript_parse_text("{success}"); echo "<script> function Start$t(){ document.getElementById('failover-title').innerHTML='$reboot_remote_server_net'; YahooWin6Hide(); CacheOff(); RefreshTab('main_failover_tabs'); } setTimeout('Start$t()',2000); </script> "; }
function table(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $tt=time(); $t=$_GET["t"]; $ipaddr=$tpl->javascript_parse_text("{ipaddr}"); $hostname=$tpl->_ENGINE_parse_body("{hostname}"); $uid=$tpl->javascript_parse_text("{uid}"); $MAC=$tpl->javascript_parse_text("{MAC}"); $QuerySize=$tpl->javascript_parse_text("{size}"); $hits=$tpl->javascript_parse_text("{hits}"); $maintitle=$tpl->_ENGINE_parse_body("{members}"); //ipaddr | hostname | uid | MAC | account | QuerySize | hits $buttons=" buttons : [ {name: '$new_text', bclass: 'add', onpress : NewRule$tt}, {name: '$apply', bclass: 'Reconf', onpress : Apply$tt}, ],"; $buttons=null; $html=" <table class='flexRT$tt' style='display: none' id='flexRT$tt' style='width:100%'></table> <script> function Start$tt(){ $('#flexRT$tt').flexigrid({ url: '$page?items=yes&t=$tt', dataType: 'json', colModel : [ {display: '$ipaddr', name : 'ipaddr', width : 124, sortable : false, align: 'left'}, {display: '$hostname', name : 'hostname', width :330, sortable : true, align: 'left'}, {display: '$uid', name : 'uid', width : 226, sortable : true, align: 'left'}, {display: '$MAC', name : 'MAC', width : 129, sortable : false, align: 'left'}, {display: '$QuerySize', name : 'size', width : 107, sortable : false, align: 'left'}, {display: '$hits', name : 'hits', width : 100, sortable : true, align: 'left'}, ], $buttons searchitems : [ {display: '$ipaddr', name : 'ipaddr'}, {display: '$hostname', name : 'hostname'}, {display: '$uid', name : 'uid'}, {display: '$MAC', name : 'MAC'}, ], sortname: 'QuerySize', sortorder: 'desc', usepager: true, title: '<span style=font-size:22px>$maintitle</span>', useRp: true, rp: 50, showTableToggleBtn: false, width: '99%', height: 450, singleSelect: true, rpOptions: [10, 20, 30, 50,100,200] }); } Start$tt(); </script> "; echo $html; }
function server_settings() { $vpn = new openvpn(); $nic = new networking(); $sock = new sockets(); $OpenVpnPasswordCert = $sock->GET_INFO("OpenVpnPasswordCert"); if ($OpenVpnPasswordCert == null) { $OpenVpnPasswordCert = "MyKey"; } //openvpn_access_interface $DEV_TYPE = $vpn->main_array["GLOBAL"]["DEV_TYPE"]; $dev = Field_array_Hash(array("tun" => "{routed_IP_tunnel}", "tap0" => "{ethernet_tunnel}"), "DEV_TYPE", $vpn->main_array["GLOBAL"]["DEV_TYPE"], "OpenVPNChangeServerMode()", null, 0, 'font-size:16px;padding:3px'); $dev = "{routed_IP_tunnel}<input type='hidden' name='DEV_TYPE' id='DEV_TYPE' value='tun'>"; if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $vpn->main_array["GLOBAL"]["IP_START"] = "10.8.0.0"; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $vpn->main_array["GLOBAL"]["NETMASK"] = "255.255.255.0"; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $openvpn_local = null; } $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"]; if ($CLIENT_NAT_PORT == null) { $CLIENT_NAT_PORT = $vpn->main_array["GLOBAL"]["LISTEN_PORT"]; } $vpn->main_array["GLOBAL"]["PUBLIC_IP"]; $vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"]; $vpn->main_array["GLOBAL"]["LISTEN_PORT"]; $vpn->main_array["GLOBAL"]["LISTEN_PROTO"]; $vpn->main_array["GLOBAL"]["ENABLE_SERVER"]; $vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"]; $vpn->main_array["GLOBAL"]["IP_START"]; $vpn->main_array["GLOBAL"]["IPTABLES_ETH"]; if ($vpn->main_array["GLOBAL"]["PUBLIC_IP"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{public_ip_addr}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["LISTEN_PORT"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["CLIENT_NAT_PORT"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{listen_port}:{public_ip_addr}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["LISTEN_PROTO"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{protocol}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["IP_START"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{from_ip_address}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $status = FATAL_WARNING_SHOW_128("<strong>{MISSING_PARAMETER}</strong><hr>{MISSING_PARAMETER_TEXT}<br><strong>{netmask}</strong><p><center>" . button("{settings}", "Loadjs('index.openvpn.server.php')", 22) . "</p></center>"); } $LDAP_AUTH = "{no}"; $EnableOpenVPNEndUserPage = "{no}"; if ($vpn->main_array["GLOBAL"]["LDAP_AUTH"] == 1) { $LDAP_AUTH = "{yes}"; } if ($sock->GET_INFO("EnableOpenVPNEndUserPage") == 1) { $EnableOpenVPNEndUserPage = "{yes}"; } $wake_up_ip = $vpn->main_array["GLOBAL"]["WAKEUP_IP"]; $tcp_ip = new ip(); if (!$tcp_ip->isValid($wake_up_ip)) { $wake_up_ip = "{disabled}"; } $ahref_edit = "<a href=\"javascript:blur();\" OnClick=\"Loadjs('index.openvpn.server.php');\" style='font-size:16px;text-decoration:underline'>"; $button_edit = button("{change_settings}", "Loadjs('index.openvpn.server.php')", 34); $openvpn_local = "\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{openvpn_local}</a>:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["LOCAL_BIND"]}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>"; $mandatories = "<table style='width:99%'>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{listen_port}:</a></td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["LISTEN_PORT"]} {$vpn->main_array["GLOBAL"]["LISTEN_PROTO"]}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t</tr>\n\t\t\t{$openvpn_local}\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{public_ip_addr}</a>:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px;'>{$vpn->main_array["GLOBAL"]["PUBLIC_IP"]}:{$CLIENT_NAT_PORT}</a></td>\n\t\t\t\t<td> </td>\n\t\t\t<tr>\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:20px'>{password}:</a></td>\n\t\t\t\t<td style='font-weight:bold;font-size:20px'>*****</a></td>\n\t\t\t\t<td> </td>\n\t\t\t<tr>\n\t\t\t</table>"; $proxy = "{no}"; if ($vpn->main_array["GLOBAL"]["USE_RPROXY"] == 1) { $proxy = "{$vpn->main_array["GLOBAL"]["PROXYADDR"]}:{$vpn->main_array["GLOBAL"]["PROXYPORT"]}"; } if ($vpn->main_array["GLOBAL"]["IPTABLES_ETH"] == null) { $vpn->main_array["GLOBAL"]["IPTABLES_ETH"] = "{no}"; } $mode_tun = "<table style='width:99%'>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{enable_authentication}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$LDAP_AUTH}</td>\n\t\t<td> </td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{EnableOpenVPNEndUserPage}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$EnableOpenVPNEndUserPage}</td>\n\t\t<td> </td>\n\t<tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{reverse_proxy}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$proxy}</td>\n\t\t<td> </td>\n\t<tr>\t\n\t\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{from_ip_address}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["IP_START"]}</td>\n\t\t<td> </td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{netmask}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["NETMASK"]}</a></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{openvpn_access_interface}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$vpn->main_array["GLOBAL"]["IPTABLES_ETH"]}</a></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:20px'>{wake_up_ip}</a>:</td>\n\t\t<td style='font-weight:bold;font-size:20px'>{$wake_up_ip}</a></td>\n\t\t<td> </td>\n\t</tr>\t\n\t\n</table>"; $VPN_SERVER_IP = $vpn->main_array["GLOBAL"]["VPN_SERVER_IP"]; $VPN_DHCP_FROM = $vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"]; $VPN_DHCP_TO = $vpn->main_array["GLOBAL"]["VPN_DHCP_TO"]; $tcp = new networking(); if ($vpn->main_array["GLOBAL"]["BRIDGE_ETH"] == null) { $vpn->main_array["GLOBAL"]["BRIDGE_ETH"] = "eth0"; } $array_ip = $tcp->GetNicInfos($vpn->main_array["GLOBAL"]["BRIDGE_ETH"]); if ($vpn->main_array["GLOBAL"]["VPN_SERVER_IP"] == null) { $vpn->main_array["GLOBAL"]["VPN_SERVER_IP"] = $array_ip["IPADDR"]; } if ($vpn->main_array["GLOBAL"]["NETMASK"] == null) { $vpn->main_array["GLOBAL"]["NETMASK"] = $array_ip["NETMASK"]; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $nics = Field_array_Hash($vpn->virtual_ip_lists(), 'BRIDGE_ETH', $vpn->main_array["GLOBAL"]["BRIDGE_ETH"]); } $mode_tap = "\n\t<div style='width:100%;margin-bottom:5px'>\n\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<div id='nicvpninfo' style='float:right;margin:5px;'>" . ShowIPConfig($vpn->main_array["GLOBAL"]["BRIDGE_ETH"]) . "</div>\n\t\t\t\t</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<div class=text-info>{SERVER_MODE_TAP}</div>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t</table>\n\t</div>\n<table style='width:100%'>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{BRIDGE_ETH}:</td>\n\t\t<td width=1% nowrap>{$nics}</td>\n\t\t<td align='left' style='font-weight:bold;font-size:20px' width=1% nowrap>" . texttooltip("{add_virtual_ip_address}", "{add_virtual_ip_address}", "Loadjs('system.nic.config.php?js-add-nic=yes')", null, 0, "font-size:16px;padding:3px") . "</td>\n\t<tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{BRIDGE_ADDR}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap >" . Field_text('BRIDGE_ADDR', $vpn->main_array["GLOBAL"]["BRIDGE_ADDR"], 'width:120px;font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{VPN_DHCP_FROM}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap>" . Field_text('VPN_DHCP_FROM', $vpn->main_array["GLOBAL"]["VPN_DHCP_FROM"], 'width:120px;font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend nowrap style='font-size:20px'>{VPN_DHCP_TO}:</td>\n\t\t<td width=1% style='font-weight:bold;font-size:20px' nowrap>" . Field_text('VPN_DHCP_TO', $vpn->main_array["GLOBAL"]["VPN_DHCP_TO"], 'width:120px;font-size:16px;padding:3px') . "</td>\n\t\t<td> </td>\n\t</tr>\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{apply}", "SaveServerSettings()") . "</td>\n\t</tr>\t\t\t\t\n</table>\n"; $mode = $mode_tun; if ($vpn->main_array["GLOBAL"]["DEV_TYPE"] == "tap0") { $mode = $mode_tap; } if ($vpn->main_array["GLOBAL"]["ENABLE_BRIDGE_MODE"] == 1) { $mode = $mode_tap; } if ($vpn->main_array["GLOBAL"]["ENABLE_SERVER"] != 1) { $status = FATAL_WARNING_SHOW_128("<strong style='font-size:22px'>{OPENVPN_NOT_ENABLED}</strong><hr>\n\t\t\t{OPENVPN_NOT_ENABLED_TEXT}\n\t\t\t<center>" . button("{enable_service}", "Loadjs('index.openvpn.enable.progress.php')", 42) . "</center>"); } if ($status == null) { $button_apply = button("{OPENVPN_APPLY_CONFIG}", "Loadjs('index.openvpn.apply.progress.php')", 34) . " | "; $button_script = button("{BUILD_OPENVPN_CLIENT_CONFIG}", "Loadjs('index.openvpn.build.client.php')", 22); } $html = "\n<div style='font-size:28px;margin-bottom:30px'>{OPENVPN_SERVER_SETTINGS}</div>\n{$status}\n<div style='width:98%' class=form>\n\n\n<div id='OPENVPN_SERVER_SETTINGS'>\n<div style='text-align:right'>{$button_script}</div>\n{$mandatories}\n{$mode}\n<div style='margin-top:15px;text-align:right;font-size:34px'><hr>{$button_apply}{$button_edit}</div>\t\n</div>\n"; $tpl = new templates(); echo $tpl->_ENGINE_parse_body($html); // openvpn --remote touzeau.ath.cx --port 1194 --dev tun --comp-lzo --tls-client --ca /home/dtouzeau/ca.crt --cert /home/dtouzeau/dtouzeau.crt --key /home/dtouzeau/dtouzeau.key --verb 5 --pull }
function page(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $t=time(); $events=$tpl->_ENGINE_parse_body("{events}"); $zdate=$tpl->_ENGINE_parse_body("{hour}"); $proto=$tpl->_ENGINE_parse_body("{proto}"); $uri=$tpl->_ENGINE_parse_body("{url}"); $member=$tpl->_ENGINE_parse_body("{member}"); if(function_exists("date_default_timezone_get")){$timezone=" - ".date_default_timezone_get();} $title=$tpl->_ENGINE_parse_body("{today}: {realtime_requests}"); $zoom=$tpl->_ENGINE_parse_body("{zoom}"); $button1="{name: 'Zoom', bclass: 'Search', onpress : ZoomSquidAccessLogs},"; $stopRefresh=$tpl->javascript_parse_text("{stop_refresh}"); $logs_container=$tpl->javascript_parse_text("{logs_container}"); $refresh=$tpl->javascript_parse_text("{refresh}"); $items=$tpl->_ENGINE_parse_body("{items}"); $size=$tpl->_ENGINE_parse_body("{size}"); $SaveToDisk=$tpl->_ENGINE_parse_body("{SaveToDisk}"); $addCat=$tpl->_ENGINE_parse_body("{add} {category}"); $date=$tpl->_ENGINE_parse_body("{zDate}"); $task=$tpl->_ENGINE_parse_body("{task}"); $new_schedule=$tpl->_ENGINE_parse_body("{new_rotate}"); $explain=$tpl->_ENGINE_parse_body("{explain_squid_tasks}"); $run=$tpl->_ENGINE_parse_body("{run}"); $task=$tpl->_ENGINE_parse_body("{task}"); $size=$tpl->_ENGINE_parse_body("{size}"); $filename=$tpl->_ENGINE_parse_body("{filename}"); $empty=$tpl->_ENGINE_parse_body("{empty}"); $askdelete=$tpl->javascript_parse_text("{empty_store} ?"); $files=$tpl->_ENGINE_parse_body("{files}"); $ext=$tpl->_ENGINE_parse_body("{extension}"); $back_to_events=$tpl->_ENGINE_parse_body("{back_to_events}"); $Compressedsize=$tpl->_ENGINE_parse_body("{compressed_size}"); $realsize=$tpl->_ENGINE_parse_body("{realsize}"); $delete_file=$tpl->javascript_parse_text("{delete_file}"); $rotate_logs=$tpl->javascript_parse_text("{rotate_logs}"); $MAC=$tpl->_ENGINE_parse_body("{MAC}"); $table_size=855; $url_row=505; $member_row=276; $table_height=420; $distance_width=230; $tableprc="100%"; $margin="-10"; $margin_left="-15"; if(is_numeric($_GET["table-size"])){$table_size=$_GET["table-size"];} if(is_numeric($_GET["url-row"])){$url_row=$_GET["url-row"];} $q=new mysql_squid_builder(); $table=date("Ymd")."_hour"; if(!$q->TABLE_EXISTS($table)){ $hierx=strtotime($q->HIER()." 00:00:00"); $table=date("Ymd",$hierx)."_hour"; $title=$tpl->_ENGINE_parse_body("{yesterday}: {realtime_requests}"); } $ipaddr=$tpl->javascript_parse_text("{ipaddr}"); $error=$tpl->javascript_parse_text("{error}"); $sitename=$tpl->javascript_parse_text("{sitename}"); $button3="{name: '<strong id=container-log-$t>$rotate_logs</stong>', bclass: 'Reload', onpress : SquidRotate$t},"; $html=" <table class='flexRT$t' style='display: none' id='flexRT$t' style='width:$tableprc'></table> <script> var mem$t=''; function StartLogsSquidTable$t(){ $('#flexRT$t').flexigrid({ url: '$page?events-list=yes', dataType: 'json', colModel : [ {display: ' ', name : 'filetime', width :16, sortable : true, align: 'left'}, {display: '$zdate', name : 'hour', width :52, sortable : true, align: 'left'}, {display: '$uri', name : 'servername', width : $url_row, sortable : false, align: 'left'}, {display: '$size', name : 'size', width : 110, sortable : true, align: 'left'}, {display: '$member', name : 'uid', width : $member_row, sortable : false, align: 'left'}, ], searchitems : [ {display: '$sitename', name : 'sitename'}, {display: '$member', name : 'uid'}, {display: '$error', name : 'TYPE'}, {display: '$ipaddr', name : 'CLIENT'}, {display: '$MAC', name : 'MAC'}, ], sortname: 'hour', sortorder: 'desc', usepager: true, title: '<span style=\"font-size:16px\">$title</span>', useRp: true, rp: 50, showTableToggleBtn: false, width: '99%', height: $table_height, singleSelect: true, rpOptions: [10, 20, 30, 50,100,200] }); } setTimeout('StartLogsSquidTable$t()',800); </script> "; echo $html; }
function params(){ $t=time(); $sock=new sockets(); $tpl=new templates(); $page=CurrentPageName(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled_see_performance}")); return; } $DisableArticaProxyStatistics=$sock->GET_INFO("DisableArticaProxyStatistics"); $EnableSquidRemoteMySQL=$sock->GET_INFO("EnableSquidRemoteMySQL"); $CleanArticaSquidDatabases=$sock->GET_INFO("CleanArticaSquidDatabases"); $EnableProxyLogHostnames=$sock->GET_INFO("EnableProxyLogHostnames"); $MacResolvInterface=$sock->GET_INFO("MacResolvInterface"); if(!is_numeric($EnableSquidRemoteMySQL)){$EnableSquidRemoteMySQL=0;} if(!is_numeric($DisableArticaProxyStatistics)){$DisableArticaProxyStatistics=0;} if(!is_numeric($CleanArticaSquidDatabases)){$CleanArticaSquidDatabases=0;} if(!is_numeric($EnableProxyLogHostnames)){$EnableProxyLogHostnames=0;} $net=new networking(); $interfaces=$net->Local_interfaces(); $array[null]="{none}"; while (list ($eth, $line) = each ($interfaces) ){ if($eth=="lo"){continue;} $ip=new system_nic($eth); $array[$eth]=$ip->IPADDR." (" .$ip->NICNAME .")"; } $p=Paragraphe_switch_img("{DisableArticaProxyStatistics}", "{DisableArticaProxyStatistics_explain}","DisableArticaProxyStatistics",$DisableArticaProxyStatistics,null,600); $p1=Paragraphe_switch_img("{CleanArticaSquidDatabases}", "{CleanArticaSquidDatabases_explain}","CleanArticaSquidDatabases",$CleanArticaSquidDatabases,null,600); $p2=Paragraphe_switch_img("{EnableProxyLogHostnames}", "{EnableProxyLogHostnames_explain}","EnableProxyLogHostnames",$EnableProxyLogHostnames,null,600); if($EnableSquidRemoteMySQL==1){ $TuningParameters=unserialize(base64_decode($sock->GET_INFO("MySQLSyslogParams"))); $error="<div style='font-size:16px' class=text-info>{remote_mysqlsquidserver_text}<br><strong>mysql://{$TuningParameters["mysqlserver"]}:{$TuningParameters["RemotePort"]}</strong></div>"; $p=Paragraphe_switch_disable("{DisableArticaProxyStatistics}", "{DisableArticaProxyStatistics_explain}",null,600). "".Field_hidden("DisableArticaProxyStatistics", 0); } $html=" <div id=$t></div> <div style='width:98%' class=form> $error <table> <tr> <td colspan=3>$p</td> </tr> <tr><td colspan=3><hr></td></tr> <tr> <td colspan=3>$p1</td> </tr> <tr> <td colspan=3 align='right'>". button("{apply}", "SaveStopArticaStats()",16)."</td> </tr> </table> </div> <div style='width:98%' class=form> <table> <tr> <td colspan=3>$p2</td> </tr> <tr> <td class=legend style='font-size:16px'>{mac_resolv_interface}:</td> <td>". Field_array_Hash($array, "MacResolvInterface",$MacResolvInterface,null,null,0,"font-size:16px")."</td> <td width=1%>". help_icon("{mac_resolv_interface_help}")."</td> </tr> <tr> <td align='right' colspan=3>". button("{apply}", "SaveOptions$t()",16)."</td> </tr> </table> </div> <script> var x_SaveStopArticaStats= function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue)}; RefreshTab('artica_stats_tabs'); CacheOff(); ConfigureYourserver(); } function SaveStopArticaStats(){ var XHR = new XHRConnection(); XHR.appendData('DisableArticaProxyStatistics',document.getElementById('DisableArticaProxyStatistics').value); XHR.appendData('CleanArticaSquidDatabases',document.getElementById('CleanArticaSquidDatabases').value); XHR.sendAndLoad('$page', 'POST',x_SaveStopArticaStats); } var xSaveOptions$t= function (obj) { var tempvalue=obj.responseText; if(tempvalue.length>3){alert(tempvalue)}; } function SaveOptions$t(){ var XHR = new XHRConnection(); XHR.appendData('EnableProxyLogHostnames',document.getElementById('EnableProxyLogHostnames').value); XHR.appendData('MacResolvInterface',document.getElementById('MacResolvInterface').value); XHR.sendAndLoad('$page', 'POST',xSaveOptions$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
function popup(){ $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $SquidPerformance=intval($sock->GET_INFO("SquidPerformance")); if($SquidPerformance>1){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{artica_statistics_disabled}")); return; } $q=new mysql_squid_builder(); $q->CheckTables(); $type=$tpl->_ENGINE_parse_body("{type}"); $browsers=$tpl->_ENGINE_parse_body("{browsers}"); $items=$tpl->_ENGINE_parse_body("{items}"); $add=$tpl->_ENGINE_parse_body("{add}"); $delete_group_ask=$tpl->javascript_parse_text("{inputbox delete group}"); $title=$tpl->javascript_parse_text("{browsers}"); $t=time(); $table_width=630; $table_height=450; $buttons="buttons : [ {name: '$new_group', bclass: 'add', onpress : AddGroup}, ], "; $buttons=null; $html=$tpl->_ENGINE_parse_body("")." <table class='table-$t' style='display: none' id='table-$t' style='width:99%'></table> <script> $(document).ready(function(){ $('#table-$t').flexigrid({ url: '$page?list=yes', dataType: 'json', colModel : [ {display: '$browsers', name : 'pattern', width : 904, sortable : true, align: 'left'}, {display: '$add', name : 'pattern', width : 81, sortable : false, align: 'center'}, ], searchitems : [ {display: '$browsers', name : 'pattern'}, ], sortname: 'pattern', sortorder: 'asc', usepager: true, title: '<span style=font-size:18px>$title</span>', useRp: true, rp: 15, showTableToggleBtn: false, width: '99%', height: $table_height, singleSelect: true }); }); </script> "; echo $html; }
function upload_artica_final(){ $fileName=$_GET["fileName"]; $zmd5=$_GET["zmd5"]; $tpl=new templates(); $page=CurrentPageName(); $t=time(); $fileNameEnc=urlencode($fileName); $q=new mysql_squid_builder(); $sock=new sockets(); $content_dir=dirname(__FILE__)."/img/upload/$fileName"; $picture=mysql_escape_string2(@file_get_contents($content_dir)); @unlink($content_dir); if($zmd5==null){ echo FATAL_WARNING_SHOW_128("MD5 is null"); return; } $sql="UPDATE `ufdb_design` SET `picturename`='$fileName',`picture`='$picture',`SquidHTTPTemplateLogoEnable`=1 WHERE zmd5='$zmd5'"; $q->QUERY_SQL($sql); echo $tpl->_ENGINE_parse_body("<div style='font-size:22px'>{saving} $fileName<br>$zmd5</div>"); if(!$q->ok){echo $q->mysql_error_html();return;} echo "<div id='$t'></div> <script> LoadAjaxTiny('$t','$page?uncompress=$fileNameEnc'); </script> "; }
function wizard10(){ $q=new mysql_squid_builder(); $page=CurrentPageName(); $tpl=new templates(); $sock=new sockets(); $t=$_GET["t"]; $tt=time()+rand(0,time()); if(!$q->BD_CONNECT()){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>{statistics_database}<hr>$q->mysql_error".wizard_restart());return; } $q=new mysql_storelogs(); if(!$q->BD_CONNECT()){ echo FATAL_WARNING_SHOW_128("<hr>{error}<hr>{logs_database}<hr>$q->mysql_error".wizard_restart());return; } echo $tpl->_ENGINE_parse_body("<center style='font-size:18px'>{statistics_database}:OK</center> <center style='font-size:18px'>{logs_database}:OK</center>")." <div id='$tt'></div> <script> LoadAjax('$t','$page?wizard11=yes&t=$t'); </script> "; }
function tabs() { $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $sock = new sockets(); $EnableNginx = intval($sock->GET_INFO("EnableNginx")); $EnableNginxMail = intval($sock->GET_INFO("EnableNginxMail")); if ($EnableNginx == 0) { echo FATAL_WARNING_SHOW_128("\n\t\t<center style='margin:30px'>" . button("{enable_reverse_proxy_service}", "Loadjs('{$page}?EnableNginx=yes')", 50) . "</center>"); return; } $array["status"] = "{status}"; $array["websites"] = "{websites}"; $array["destinations"] = '{destinations}'; $array["caches"] = '{caches}'; if ($EnableNginxMail == 1) { $array["mail"] = '{mail}'; } $array["events"] = '{events}'; $array["watchdog"] = "{watchdog}"; $array["backup"] = '{backup_restore}'; $fontsize = 18; while (list($num, $ligne) = each($array)) { if ($num == "status") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.satus.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "watchdog") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.watchdog-events.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "websites") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.www.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "mail") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.mail.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "events") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.events.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "destinations") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.destinations.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "caches") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.caches.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } if ($num == "backup") { $tab[] = $tpl->_ENGINE_parse_body("<li><a href=\"nginx.backup.php\" style='font-size:{$fontsize}px'><span>{$ligne}</span></a></li>\n"); continue; } $tab[] = "<li style='font-size:{$fontsize}px'><a href=\"{$page}?{$num}=yes\"><span >{$ligne}</span></a></li>\n"; } $t = time(); // echo build_artica_tabs($tab, "main_artica_nginx", 1200) . "<script>LeftDesign('reverse-proxy-256-white.png');</script>"; }
function params() { $sql = "SELECT * FROM freeweb WHERE servername='{$_GET["servername"]}'"; $page = CurrentPageName(); $tpl = new templates(); $q = new mysql(); $sock = new sockets(); $FreeWebsEnableModSecurity = $sock->GET_INFO("FreeWebsEnableModSecurity"); $FreeWebsEnableModEvasive = $sock->GET_INFO("FreeWebsEnableModEvasive"); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $free = new freeweb($_GET["servername"]); $Params = $free->Params; $apache_auth_ip_explain = $tpl->javascript_parse_text("{apache_auth_ip_explain}"); $users = new usersMenus(); $APACHE_MOD_AUTHNZ_LDAP = 0; $APACHE_MOD_GEOIP = 0; $PERL_AUTHNTLM = 0; $info = null; if ($users->APACHE_MOD_AUTHNZ_LDAP) { $APACHE_MOD_AUTHNZ_LDAP = 1; } if ($users->APACHE_MOD_GEOIP) { $APACHE_MOD_GEOIP = 1; } if ($users->APP_PYAUTHENNTLM) { $PERL_AUTHNTLM = 1; } $ServerSignature = $sock->GET_INFO("ApacheServerSignature"); if (!is_numeric($ServerSignature)) { $ServerSignature = 1; } if (!is_numeric($FreeWebsEnableModSecurity)) { $FreeWebsEnableModSecurity = 0; } if (!is_numeric($FreeWebsEnableModEvasive)) { $FreeWebsEnableModEvasive = 0; } $ZarafaWebNTLM = 0; $ZarafaWebNTLM = $sock->GET_INFO("ZarafaWebNTLM"); if (!is_numeric($ZarafaWebNTLM)) { $ZarafaWebNTLM = 0; } if ($ligne["groupware"] == "ZARAFA") { $PARAMS = $free->Params["ZARAFAWEB_PARAMS"]; if (!isset($PARAMS["ZarafaWebNTLM"])) { $PARAMS["ZarafaWebNTLM"] = $ZarafaWebNTLM; } if (!is_numeric($PARAMS["ZarafaWebNTLM"])) { $PARAMS["ZarafaWebNTLM"] = $ZarafaWebNTLM; } $ZarafaWebNTLM = $PARAMS["ZarafaWebNTLM"]; } $authentication_banner = $Params["LDAP"]["authentication_banner"]; $EnableLDAPAllSubDirectories = $Params["LDAP"]["EnableLDAPAllSubDirectories"]; if (strlen($authentication_banner) < 3) { $authentication_banner = base64_encode($tpl->javascript_parse_text("{$_GET["servername"]}::{authentication}")); } $ApacheServerSignature = $Params["SECURITY"]["ServerSignature"]; $DisableHtAccess = $Params["SECURITY"]["DisableHtAccess"]; if (!is_numeric($ApacheServerSignature)) { $ApacheServerSignature = $ServerSignature; } if (!is_numeric($EnableLDAPAllSubDirectories)) { $EnableLDAPAllSubDirectories = 0; } $t = time(); $FreeWebPerformances = unserialize(base64_decode($sock->GET_INFO("FreeWebPerformances"))); if (!isset($FreeWebPerformances["KeepAlive"])) { $FreeWebPerformances["KeepAlive"] = 0; } if ($FreeWebPerformances["KeepAlive"] == 0) { $info = $info . FATAL_WARNING_SHOW_128("{KeepAlive_tlm_notset}"); } if ($PERL_AUTHNTLM == 0) { $info = $info . FATAL_WARNING_SHOW_128("{pythonntlm_not_installed}"); } //http://www.mail-appliance.org/index.php?cID=393 $onlineHelp = "<a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://mail-appliance.org/index.php?cID=393','1024','900');\"\n\tstyle='font-size:12px;font-weight:bold;text-decoration:underline'>{online_help}</a>"; $html = "\n\t<div id='{$t}'>\n\t<input type='hidden' id='EnableLDAPAllSubDirectories' value='{$EnableLDAPAllSubDirectories}'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{enable_ldap_authentication}:</td>\n\t\t<td>" . Field_checkbox("enable_ldap_authentication", 1, $Params["LDAP"]["enabled"], "CheckApacheLdap{$t}()") . "</td>\n\t\t<td width=1%><span id='disabled-why' style='font-size:11px;color:red'></span>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{authentication_banner}:</td>\n\t\t<td>" . Field_text("authentication_banner", base64_decode($authentication_banner), "font-size:16px;padding:3px;width:280px") . "</td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{members}:</td>\n\t\t<td><input type='button' OnClick=\"javascript:Loadjs('freeweb.edit.ldap.users.php?servername={$_GET["servername"]}')\" value='{browse}...' style='font-size:13px'></td>\n\t\t<td> </td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{enable_ntlm_authentication}:</td>\n\t\t<td>" . Field_checkbox("enable_ntlm_authentication", 1, $Params["NTLM"]["enabled"], "CheckApacheNTLM{$t}()") . "</td>\n\t\t<td width=1% nowrap>{$onlineHelp}</span>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{members}:</td>\n\t\t<td><input type='button' OnClick=\"javascript:Loadjs('freeweb.edit.ldap.users.php?servername={$_GET["servername"]}')\" value='{browse}...' style='font-size:13px'></td>\n\t\t<td> </td>\n\t</tr>\n\t</table>\t\n\t<div style='text-align:right;width:100%'><hr>" . button("{apply}", "CheckApacheLdap{$t}()", 16) . "</div>\n\t</div>\n\t{$info}\n\t<script>\n\t\tvar x_CheckApacheLdap{$t}=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tRefreshTab('main_config_freewebeditsecu');\t\t\t\t\n\t\t}\t\n\t\n\t\n\t\tfunction CheckApacheForm{$t}(){\n\t\t\tvar ZarafaWebNTLM={$ZarafaWebNTLM};\n\t\t\tvar APACHE_MOD_AUTHNZ_LDAP={$APACHE_MOD_AUTHNZ_LDAP};\n\t\t\tvar PERL_AUTHNTLM={$PERL_AUTHNTLM};\n\t\t\tdocument.getElementById('enable_ldap_authentication').disabled=true;\n\t\t\tdocument.getElementById('authentication_banner').disabled=true;\n\t\t\tdocument.getElementById('EnableLDAPAllSubDirectories').disabled=true;\n\t\t\tdocument.getElementById('enable_ntlm_authentication').disabled=true;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tif(APACHE_MOD_AUTHNZ_LDAP==1){\n\t\t\t\tdocument.getElementById('enable_ldap_authentication').disabled=false;\n\t\t\t\tdocument.getElementById('authentication_banner').disabled=false;\n\t\t\t\tif(document.getElementById('enable_ldap_authentication').checked){\n\t\t\t\t\tdocument.getElementById('EnableLDAPAllSubDirectories').disabled=false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif(PERL_AUTHNTLM==1){\n\t\t\t\tdocument.getElementById('enable_ntlm_authentication').disabled=false;\n\t\t\t}\n\t\t\t\n\t\t\tif(ZarafaWebNTLM==1){\n\t\t\t\t\n\t\t\t\tdocument.getElementById('enable_ntlm_authentication').disabled=true;\n\t\t\t\tdocument.getElementById('enable_ldap_authentication').disabled=true;\n\t\t\t\tdocument.getElementById('enable_ldap_authentication').checked=true;\n\t\t\t\tdocument.getElementById('disabled-why').innerHTML='NTLM enabled';\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\tfunction CheckApacheLdap{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\t\n\t\t\t\n\t\t\tif(document.getElementById('enable_ldap_authentication').checked){\n\t\t\t\tXHR.appendData('enable_ldap_authentication',1);\n\t\t\t\tdocument.getElementById('EnableLDAPAllSubDirectories').disabled=false;\n\t\t\t}else{\n\t\t\t\tXHR.appendData('enable_ldap_authentication',0);\n\t\t\t\tdocument.getElementById('EnableLDAPAllSubDirectories').disabled=true;\n\t\t\t}\n\t\t\t\n\t\t\tif(document.getElementById('enable_ntlm_authentication').checked){\n\t\t\t\tXHR.appendData('enable_ntlm_authentication',1);\n\t\t\t}else{\n\t\t\t\tXHR.appendData('enable_ntlm_authentication',0);\n\t\t\t}\n\t\t\tif(document.getElementById('EnableLDAPAllSubDirectories').checked){XHR.appendData('EnableLDAPAllSubDirectories',1);}else{XHR.appendData('EnableLDAPAllSubDirectories',0);}\t\t\t\t\n\t\t\tXHR.appendData('servername','{$_GET["servername"]}');\n\t\t\tAnimateDiv('{$t}');\n \t\tXHR.sendAndLoad('{$page}', 'POST', x_CheckApacheLdap{$t});\n\t\t}\n\t\t\n\n\tCheckApacheForm{$t}();\n\t</script>"; echo $tpl->_ENGINE_parse_body($html); }
function main(){ $page=CurrentPageName(); $tpl=new templates(); $users=new usersMenus(); $sock=new sockets(); $t=time(); $SquidGuardIPWeb=$sock->GET_INFO("SquidGuardIPWeb"); $SquidGuardApachePort=intval($sock->GET_INFO("SquidGuardApachePort")); if($SquidGuardApachePort==0){$SquidGuardApachePort=9020;} $UseRemoteUfdbguardService=intval($sock->GET_INFO("UseRemoteUfdbguardService")); $UfdbGuardThreads=$sock->GET_INFO("UfdbGuardThreads"); $ufdbclass=new compile_ufdbguard(); $UFDB=unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); $UFDB=$ufdbclass->SetDefaultsConfig($UFDB); $datas=$UFDB; $EnableKerbAuth=$sock->GET_INFO("EnableKerbAuth"); $EnableGoogleSafeSearch=$sock->GET_INFO("EnableGoogleSafeSearch"); $EnableGoogleSafeBrowsing=intval($sock->GET_INFO("EnableGoogleSafeBrowsing")); if(!is_numeric($EnableGoogleSafeSearch)){$EnableGoogleSafeSearch=1;} $SquidUrgency=intval($sock->GET_INFO("SquidUrgency")); $ufdbguardConfig=unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig"))); if(!is_numeric($ufdbguardConfig["DebugAll"])){$ufdbguardConfig["DebugAll"]=0;} if($ufdbguardConfig["DebugAll"]==1){ echo FATAL_WARNING_SHOW_128("<strong>{webfiltering_in_debug_mode}</strong><p> </p>{webfiltering_in_debug_mode_text} <div style='margin:20px;text-align:right'>". button("{disable}","Loadjs('ufdbguard.debug.php')",20)."</div> "); } if($SquidUrgency==1){ echo FATAL_WARNING_SHOW_128("<strong>{proxy_in_emergency_mode}</strong><p> </p>{proxy_in_emergency_mode_explain} <div style='margin:20px;text-align:right'>". button("{urgency_mode}","Loadjs('squid.urgency.php')",20) ."</div> "); } $GoogleSafeBrowsingApiKey=$sock->GET_INFO("GoogleSafeBrowsingApiKey"); $UfdbUseArticaClient=$sock->GET_INFO("UfdbUseArticaClient"); if(!is_numeric($UfdbUseArticaClient)){$UfdbUseArticaClient=1;} $GoogleSafeBrowsingApiKey_color="#04A910"; $GoogleSafeBrowsingApiKey_link=$tpl->_ENGINE_parse_body("{defined}"); if(strlen($GoogleSafeBrowsingApiKey)<10){ $GoogleSafeBrowsingApiKey_color="#A90404"; $GoogleSafeBrowsingApiKey_link=$tpl->_ENGINE_parse_body("{not_set}"); } $EnableGoogleSafeBrowsing_field=Paragraphe_switch_img("{EnableGoogleSafeBrowsing}", "{EnableGoogleSafeBrowsing_explain} <div style='margin-top:10px;text-align:right'> <a href=\"javascript:Loadjs('$page?GoogleSafeBrowsingApiKey-js=yes')\" style='font-size:22px;color:$GoogleSafeBrowsingApiKey_color;text-decoration:underline'>{API_KEY}:$GoogleSafeBrowsingApiKey_link</a> </div> <div style='margin-top:10px;text-align:right'> <a href=\"https://developers.google.com/safe-browsing/key_signup\" style='font-size:18px;text-decoration:underline' target=_new>Google: {free_register}</a> </div> " ,"EnableGoogleSafeBrowsing-$t",$EnableGoogleSafeBrowsing,null,750 ); $EnableGoogleSafeBrowsing_button=button("{apply}","EnableGoogleSafeBrowsing$t()",26); if($UfdbUseArticaClient==0){ $EnableGoogleSafeBrowsing_field=Paragraphe_switch_disable("{EnableGoogleSafeBrowsing}", "{EnableGoogleSafeBrowsing_explain}" ,"EnableGoogleSafeBrowsing-$t",$EnableGoogleSafeBrowsing,null,750 ); $EnableGoogleSafeBrowsing_button=null; } if($UFDB["UseRemoteUfdbguardService"]==1){ $sock->SET_INFO("UseRemoteUfdbguardService", 1); $UseRemoteUfdbguardService=1; } if($UseRemoteUfdbguardService==0){ echo $tpl->_ENGINE_parse_body("<div style='margin-bottom:20px;margin-top:20px;width:98%' class=form>". Paragraphe_switch_img("{EnableGoogleSafeSearch}", "{safesearch_explain} <div style='margin-top:10px;text-align:right'> <a href=\"javascript:Loadjs('squid.google.ssl.php')\" style='font-size:22px;text-decoration:underline'>{disable_google_ssl}</a></div> " ,"EnableGoogleSafeSearch-$t",$EnableGoogleSafeSearch,null,750 )." <div style='text-align:right'>". button("{apply}","EnableGoogleSafeSearch$t()",26)."</div> </div>"); } echo $tpl->_ENGINE_parse_body("<div style='margin-bottom:20px;margin-top:20px;width:98%' class=form> $EnableGoogleSafeBrowsing_field <div style='text-align:right'>$EnableGoogleSafeBrowsing_button</div> </div>"); if($SquidGuardIPWeb==null){ $SquidGuardIPWeb="http://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApachePort."/exec.squidguard.php"; $fulluri="http://".$_SERVER['SERVER_ADDR'].':'.$SquidGuardApachePort."/exec.squidguard.php"; $sock->SET_INFO("SquidGuardIPWeb", $fulluri); }else{ $fulluri=$SquidGuardIPWeb; } if(!$users->CORP_LICENSE){ $MyVersion="{license_error}"; }else{ $q=new mysql_squid_builder(); $MyVersion=trim($sock->getFrameWork("ufdbguard.php?articawebfilter-database-version=yes")); $MyVersion=$q->time_to_date($MyVersion,true); } if($UseRemoteUfdbguardService==0){ $wizard=" <tr><td colspan=3> </td></tr> <tr> <td colspan=3 align='center'>". button("{wizard_rule}", "Loadjs('dansguardian2.wizard.rule.php')",26)." <div style='font-size:14px;margin-top:15px'>{wizard_rule_ufdb_explain}</div> </td> </tr>"; $build_rules="<tr><td colspan=3> </td></tr> <tr> <td colspan=3 align='center'>". button("{compile_rules}", "Loadjs('dansguardian2.compile.php');",26)." <div style='font-size:14px;margin-top:15px'>{wizard_rule_ufdb_compile_explain}</div> </td> </tr>"; } $t=time(); $html=" <div style='width:98%' class=form> <div style='font-size:28px;font-weight:bold'> <table style='width:100%;margin-top:30px'> <tr> <td style='vertical-align:middle;font-size:18px' class=legend>{listen_address}:</td> <td style='vertical-align:middle;font-size:18px'>{$datas["listen_addr"]}:{$datas["listen_port"]}</td> <td> </td> </tr> <tr><td colspan=2> </td></tr> <tr> <td style='vertical-align:middle;font-size:18px' class=legend>{webpage_deny_url}:</td> <td style='vertical-align:middle;font-size:18px'>$fulluri</td> <td>". button("{options}","Loadjs('ufdbguard.urichange.php')",16)."</td> </tr> <tr><td colspan=2> </td></tr> <tr> <td style='vertical-align:middle;font-size:18px' class=legend>{artica_databases}:</td> <td style='vertical-align:middle;font-size:18px'>$MyVersion</td> <td>". button("{options}","LoadAjax('BodyContent','artica.update.php?webfiltering-tabs=yes&from-ufdbguard=yes')",16)."</td> </tr> $wizard $build_rules </table> <script> var xEnableGoogleSafeSearch$t= function (obj) { var res=obj.responseText; Loadjs('dansguardian2.compile.php'); } function EnableGoogleSafeSearch$t(){ var XHR = new XHRConnection(); XHR.appendData('EnableGoogleSafeSearch', document.getElementById('EnableGoogleSafeSearch-$t').value); XHR.sendAndLoad('$page', 'POST',xEnableGoogleSafeSearch$t); } var xEnableGoogleSafeBrowsing$t= function (obj) { var res=obj.responseText; Loadjs('squid.compile.progress.php'); } function EnableGoogleSafeBrowsing$t(){ var XHR = new XHRConnection(); XHR.appendData('EnableGoogleSafeBrowsing', document.getElementById('EnableGoogleSafeBrowsing-$t').value); XHR.sendAndLoad('$page', 'POST',xEnableGoogleSafeBrowsing$t); } </script> "; echo $tpl->_ENGINE_parse_body($html); }
<?php //ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null); include_once 'ressources/class.templates.inc'; include_once 'ressources/class.ldap.inc'; include_once 'ressources/class.users.menus.inc'; include_once 'ressources/class.mysql.inc'; include_once 'ressources/class.ini.inc'; if (isset($_GET["js"])) { js(); exit; } $users = new usersMenus(); if (!$users->AsArticaMetaAdmin) { $tpl = new templates(); echo FATAL_WARNING_SHOW_128("{ERROR_NO_PRIVS}"); die; } tabs(); function tabs() { $uuid = $_GET["uuid"]; $fontsize = 18; $tpl = new templates(); $page = CurrentPageName(); $array["RTT"] = "{realtime}"; $array["WEEK"] = "{this_week}"; $array["websites"] = "{websites}"; while (list($num, $ligne) = each($array)) { if ($num == "RTT") { $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.bandwidth.rtt.week.php?uuid={$uuid}&meta=1\" style='font-size:{$fontsize};font-weight:normal'><span>{$ligne}</span></a></li>\n");
function page(){ $page=CurrentPageName(); $cachefile="/usr/share/artica-postfix/ressources/logs/web/squid_get_cache_infos.db"; $array=unserialize(@file_get_contents($cachefile)); $tpl=new templates(); $ARRAY=array(); if(count($array)>0){ while (list ($cachedir, $ligne) = each ($array) ){ $PARTITION=$ligne["PARTITION"]; $cachename=basename($cachedir)." ({$ligne["index"]})"; $ARRAY[$PARTITION]["SIZE"]=$ligne["DIRPART_INFO"]["TOT"]; $ARRAY[$PARTITION]["MOUNT"]=$ligne["DIRPART_INFO"]["MOUNT"]; $ARRAY[$PARTITION]["FREE"]=$ligne["DIRPART_INFO"]["AIV"]; $ARRAY[$PARTITION]["CACHES"][]=array("NAME"=>$cachename,"SIZE"=>$ligne["FULL_SIZE"]); } while (list ($partition, $ligne) = each ($ARRAY) ){ $partitionid=md5($partition); $partitionenc=urlencode($partition); $js[]=" function Fsix$partitionid(){ AnimateDiv('$partitionid'); Loadjs('$page?graph-size=yes&container=$partitionid&partition=$partitionenc&next=$partitionid-all',true); } setTimeout(\"Fsix$partitionid()\",800); "; $f[]=" <div style='width:98%' class=form> <div id='$partitionid' style='width:520px;height:450px'></div> <p> </p> <div id='$partitionid-all' style='min-height:150px;'></div> </div>"; } } $cacheTime=filemtime($cachefile); $cacheTime_text=date("{l} d",$cacheTime)." {at} ".date("H:i:s",$cacheTime); if(count($ARRAY)==0){ echo $tpl->_ENGINE_parse_body(FATAL_WARNING_SHOW_128("{no_cache_as_been_detected}")); } echo $tpl->_ENGINE_parse_body(" <div style='text-align:right;margin:10px;margin-left:20px;float:right'>".button("{refresh}", "Loadjs('squid.refresh-status.php')",18)."</div> <div style='font-size:22px'>{caches_status}</div> <div style='text-align:right;border-top:1px solid #CCCCCC'><i>{generated_on} $cacheTime_text</i></div>"). CompileTr2($f)."<script>".@implode("\n", $js)."</script>"; }