本文整理汇总了PHP中squidbee类的典型用法代码示例。如果您正苦于以下问题:PHP squidbee类的具体用法?PHP squidbee怎么用?PHP squidbee使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了squidbee类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sizelimit_save
function sizelimit_save()
{
$squid = new squidbee();
$squid->global_conf_array["request_header_max_size"] = $_GET["request_header_max_size"];
$squid->global_conf_array["request_body_max_size"] = $_GET["request_body_max_size"];
$squid->global_conf_array["reply_body_max_size"] = $_GET["reply_body_max_size"];
$squid->SaveToLdap();
}
示例2: Save
function Save()
{
$squid = new squidbee();
$sock = new sockets();
$sock->SET_INFO("SquidMemoryPoolsLimit", $_POST["SquidMemoryPoolsLimit"]);
$sock->SET_INFO("SquidMemoryPoolsLimit", $_POST["SquidMemoryPoolsLimit"]);
if (is_numeric($_POST["cache_mem"])) {
$squid->global_conf_array["cache_mem"] = trim($_POST["cache_mem"]) . " MB";
}
$squid->SaveToLdap(true);
}
示例3: max_filedesc
function max_filedesc()
{
$squid = new squidbee();
if ($_POST["max_filedesc"] < 1024) {
$_POST["max_filedesc"] = 1024;
}
$squid->max_filedesc = $_POST["max_filedesc"];
$squid->SaveToLdap();
$sock = new sockets();
$key = base64_encode("fs.file-max");
$sock->getFrameWork("cmd.php?sysctl-setvalue={$_POST["fs_filemax"]}&key={$key}");
}
示例4: save
function save()
{
$sock = new sockets();
if ($_POST["SquidBinIpaddr"] == null) {
$_POST["SquidBinIpaddr"] = "0.0.0.0";
}
$sock->SET_INFO("SquidBinIpaddr", $_POST["SquidBinIpaddr"]);
if (isset($_POST["tcp_outgoing_address"])) {
$squid = new squidbee();
$squid->global_conf_array["tcp_outgoing_address"] = $_POST["tcp_outgoing_address"];
$squid->SaveToLdap(true);
}
}
示例5: save
function save()
{
$sock = new sockets();
$sock->SET_INFO("CacheReplacementPolicy", $_POST["CacheReplacementPolicy"]);
$sock->SET_INFO("SquidDebugCacheProc", $_POST["SquidDebugCacheProc"]);
$sock->SET_INFO("ForceWindowsUpdateCaching", $_POST["ForceWindowsUpdateCaching"]);
$sock->SET_INFO("ProxyDedicateMicrosoftRules", $_POST["ProxyDedicateMicrosoftRules"]);
$squid = new squidbee();
$squid->global_conf_array["maximum_object_size"] = $_POST["maximum_object_size"] . " MB";
$squid->SaveToLdap(true);
$tpl = new templates();
echo $tpl->javascript_parse_text("{must_restart_proxy_settings}");
}
示例6: xfiledesc
function xfiledesc()
{
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pidTime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
$unix = new unix();
$pid = @file_get_contents($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
squid_admin_mysql(0, "Cannot change file descriptors (PID {$pid} already executed)", null, __FILE__, __LINE__);
die;
}
@file_put_contents($pidfile, getmypid());
$TimePid = $unix->file_time_min($pidTime);
if ($TimePid < 5) {
squid_admin_mysql(0, "Cannot change file descriptors ( require 5mn, current {$TimePid}mn)", null, __FILE__, __LINE__);
die;
}
@unlink($pidTime);
@file_put_contents($pidTime, time());
$squid = new squidbee();
$sock = new sockets();
$sysctl = $unix->find_program("sysctl");
$t = time();
if (!is_numeric($squid->max_filedesc)) {
$squid->max_filedesc = 8192;
}
exec("{$sysctl} -n fs.file-max", $results);
$file_max = intval(trim(@implode("", $results)));
$file_max_org = $file_max;
$max_filedesc = intval($squid->max_filedesc);
if ($max_filedesc == 0) {
$max_filedesc = 8192;
}
$new_max_filedesc = $max_filedesc + 1000;
echo "Current System: {$file_max}, Proxy {$max_filedesc}\n";
if ($new_max_filedesc > $file_max - 100) {
$file_max = $file_max + 1000;
shell_exec("{$sysctl} -w fs.file-max={$file_max}");
$unix->sysctl("fs.file-max", $file_max);
}
$squid->max_filedesc = $new_max_filedesc;
$squid->SaveToLdap(true);
$php = $unix->LOCATE_PHP5_BIN();
shell_exec("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
squid_admin_mysql(0, "Restarting Proxy service to increase file descriptors from {$max_filedesc}/{$file_max_org} to {$new_max_filedesc}/{$file_max}", null, __FILE__, __LINE__);
shell_exec("/etc/init.d/squid restart --force");
}
示例7: squid_transparent_exe
function squid_transparent_exe()
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
$pid = $unix->get_pid_from_file($pidfile);
if ($unix->process_exists($pid, basename(__FILE__))) {
return;
}
@file_put_contents($pidfile, getmypid());
$sock = new sockets();
$squid = new squidbee();
$WizardProxyTransparent = unserialize($sock->GET_INFO("WizardProxyTransparent"));
$WizardProxyTransparent = unserialize($sock->GET_INFO("WizardProxyTransparent"));
$connected_port = intval($WizardProxyTransparent["connected_port"]);
$transparent_port = intval($WizardProxyTransparent["transparent_port"]);
$transparent_ssl_port = intval($WizardProxyTransparent["transparent_ssl_port"]);
$EnableSSLBump = intval($WizardProxyTransparent["EnableSSLBump"]);
if ($connected_port == 0) {
build_progress("Fatal connected port unconfigured", 110);
return;
}
if ($transparent_port == 0) {
build_progress("Fatal Transparent port unconfigured", 110);
return;
}
echo "Connected port........: {$connected_port}\n";
echo "Transparent port......: {$transparent_port}\n";
echo "Transparent SSL.......: {$EnableSSLBump}/{$transparent_ssl_port}\n";
sleep(3);
build_progress("{reconfigure}", 20);
$squid = new squidbee();
$squid->listen_port = $transparent_port;
$squid->second_listen_port = $connected_port;
$squid->hasProxyTransparent = 1;
if ($EnableSSLBump == 1) {
echo "EnableSquidSSLCRTD ----> 1\n";
$sock->SET_INFO("EnableSquidSSLCRTD", 1);
$squid->SSL_BUMP = 1;
$squid->ssl_port = $transparent_ssl_port;
}
build_progress("{saving_parameters}", 20);
sleep(3);
$squid->SaveToLdap(true);
echo "hasProxyTransparent -------> 1\n";
$sock->SET_INFO("hasProxyTransparent", 1);
echo "SquidTransparentMixed -----> 1\n";
$sock->SET_INFO("SquidTransparentMixed", 1);
build_progress("{building_settings}", 30);
$php = $unix->LOCATE_PHP5_BIN();
system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
build_progress("{restarting_service}", 50);
system("{$php} /usr/share/artica-postfix/exec.squid.watchdog.php --restart --force");
build_progress("{apply_firewall_rules}", 90);
system("{$php} /usr/share/artica-postfix/exec.squid.transparent.php --force");
build_progress("{done}", 100);
}
示例8: tests_port
function tests_port($port_id)
{
$unix = new unix();
$squid = new squidbee();
$q = new mysql_squid_builder();
$ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT * FROM proxy_ports WHERE ID={$port_id}"));
$ssl_bump_line = $squid->ssl_bump_line($ligne["sslcertificate"]);
$randport = rand(63500, 65535);
build_progress("{testing_ssl_certificate} ID:{$port_id} {$ligne["sslcertificate"]}", 15);
$t = time();
$pid_filename = "/var/run/squid/{$t}.pid";
$cache_log = "/var/log/squid/cache.{$t}.log";
$f[] = "coredump_dir\t/var/squid/cache";
$f[] = "cache_log\t/var/log/squid/cache.log";
$f[] = "pid_filename\t/var/run/squid/squid.pid";
$f[] = "cache_effective_user squid";
$f[] = "http_port 127.0.0.1:{$randport} {$ssl_bump_line}";
echo " ***********************************************************************\n";
echo "Using HTTPS port {$ssl_bump_line} Certificate {$ligne["sslcertificate"]}\n";
echo " ***********************************************************************\n";
$f[] = "";
$tmpfile = $unix->FILE_TEMP();
$squidbin = $unix->LOCATE_SQUID_BIN();
build_progress("{testing_ssl_certificate} {$ligne["sslcertificate"]}", 20);
echo "Conf : {$tmpfile}\n";
echo "Binary: {$squidbin}\n";
@file_put_contents($tmpfile, @implode("\n", $f));
exec("{$squidbin} -f {$tmpfile} -k check 2>&1", $results);
@unlink($tmpfile);
while (list($num, $line) = each($results)) {
echo "Check : {$line}\n";
if (preg_match("#FATAL: No valid signing SSL#", $line)) {
build_progress("{testing_ssl_certificate_failed} {$ligne["sslcertificate"]}", 110);
$sql = "UPDATE proxy_ports SET sslcertificate='' WHERE ID='{$port_id}'";
$q->QUERY_SQL($sql);
return;
}
}
build_progress("{testing_ssl_certificate} {success}", 100);
// FATAL: No valid signing SSL certificate
}
示例9: ApplyConfig
function ApplyConfig()
{
$unix = new unix();
$squid = new squidbee();
writelogs("->BuildBlockedSites", __FUNCTION__, __FILE__, __LINE__);
$squid->BuildBlockedSites();
if (!is_file("/etc/squid3/squid-block.acl")) {
@file_put_contents("/etc/squid3/squid-block.acl", "");
}
$SQUID_CONFIG_PATH = $unix->SQUID_CONFIG_PATH();
if (!is_file($SQUID_CONFIG_PATH)) {
writelogs("Unable to stat squid configuration file \"{$SQUID_CONFIG_PATH}\"", __FUNCTION__, __FILE__, __LINE__);
return;
}
echo "Starting......: Squid building main configuration done\n";
$squid = new squidbee();
$conf = $squid->BuildSquidConf();
@file_put_contents("/etc/artica-postfix/settings/Daemons/GlobalSquidConf", $conf);
@file_put_contents($SQUID_CONFIG_PATH, $conf);
certificate_generate();
}
示例10: save
function save()
{
$squid = new squidbee();
$sock = new sockets();
$sock->SET_INFO("DisableTCPEn", $_POST["DisableTCPEn"]);
$sock->SET_INFO("DisableTCPWindowScaling", $_POST["DisableTCPWindowScaling"]);
$sock->SET_INFO("SquidUploadTimeouts", $_POST["SquidUploadTimeouts"]);
unset($_POST["SquidUploadTimeouts"]);
unset($_POST["DisableTCPEn"]);
unset($_POST["DisableTCPWindowScaling"]);
while (list($index, $line) = each($_POST)) {
$squid->{$index} = $line;
}
$squid->SaveToLdap(true);
}
示例11: page
function page()
{
$users = new usersMenus();
$page = CurrentPageName();
$tpl = new templates();
$date = $tpl->_ENGINE_parse_body("{zDate}");
$description = $tpl->_ENGINE_parse_body("{description}");
$context = $tpl->_ENGINE_parse_body("{context}");
$events = $tpl->_ENGINE_parse_body("{events}");
$empty = $tpl->_ENGINE_parse_body("{empty}");
$empty_events_text_ask = $tpl->javascript_parse_text("{empty_events_text_ask}");
$bt_klms_reset_pwd = null;
$joomlaservername = $tpl->_ENGINE_parse_body("{joomlaservername}");
$memory = $tpl->_ENGINE_parse_body("{memory}");
$requests = $tpl->_ENGINE_parse_body("{requests}");
$member = $tpl->_ENGINE_parse_body("{member}");
$new_server = $tpl->_ENGINE_parse_body("{new_server}");
$add_default_www = $tpl->_ENGINE_parse_body("{add_default_www}");
$delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}");
$delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}");
$WebDavPerUser = $tpl->_ENGINE_parse_body("{WebDavPerUser}");
$rebuild_items = $tpl->_ENGINE_parse_body("{rebuild_items}");
$size = $tpl->_ENGINE_parse_body("{size}");
$help = $tpl->_ENGINE_parse_body("{help}");
$restore = $tpl->_ENGINE_parse_body("{restore}");
$status = $tpl->javascript_parse_text("{status}");
$reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}");
$choose_your_zarafa_webserver_type = $tpl->_ENGINE_parse_body("{choose_your_zarafa_webserver_type}");
$freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}");
$enable = $tpl->javascript_parse_text("{enable}");
$bt_default_www = "{name: '{$add_default_www}', bclass: 'add', onpress : FreeWebAddDefaultVirtualHost},";
$bt_webdav = "{name: '{$WebDavPerUser}', bclass: 'add', onpress : FreeWebWebDavPerUsers},";
$bt_rebuild = "{name: '{$rebuild_items}', bclass: 'Reconf', onpress : RebuildFreeweb},";
$bt_help = "{name: '{$help}', bclass: 'Help', onpress : HelpSection},";
$bt_restore = "{name: '{$restore}', bclass: 'Restore', onpress : RestoreSite},";
$bt_stats = "{name: '{$status}', bclass: 'Network', onpress : ApacheAllstatus},";
$MAIN_TITLE = null;
$tablewidth = 874;
$servername_size = 366;
$bt_function_add = "AddNewFreeWebServer";
if ($_GET["force-groupware"] != null) {
include_once dirname(__FILE__) . "/ressources/class.apache.inc";
$default_www = null;
$bt_webdav = null;
$ach = new vhosts();
$MAIN_TITLE = "<span style=font-size:18px>" . $tpl->_ENGINE_parse_body("{" . $ach->TEXT_ARRAY[$_GET["force-groupware"]]["TITLE"] . "}") . "</span>";
if ($_GET["force-groupware"] == "KLMS") {
$bt_klms_reset_pwd = "{name: '{$reset_admin_password}', bclass: 'Restore', onpress : klmsresetwebpassword},";
}
}
if ($_GET["tabzarafa"] == "yes") {
$tablewidth = 690;
$servername_size = 64;
$bt_webdav = null;
$bt_default_www = null;
$bt_function_add = "AddNewFreeWebServerZarafa";
$bt_restore = null;
}
if ($_GET["minimal-tools"] == "yes") {
$bt_default_www = null;
$bt_restore = null;
$bt_webdav = null;
$bt_help = null;
}
if (!$users->APACHE_MOD_STATUS) {
$bt_stats = null;
}
$users = new usersMenus();
if ($users->SQUID_INSTALLED) {
$sock = new sockets();
$SquidActHasReverse = $sock->GET_INFO("SquidActHasReverse");
if (!is_numeric($SquidActHasReverse)) {
$SquidActHasReverse = 0;
}
$squid = new squidbee();
if ($squid->isNGnx()) {
$SquidActHasReverse = 1;
}
if ($SquidActHasReverse == 1) {
$explainSquidActHasReverse = $tpl->_ENGINE_parse_body("<div class=explain style='font-size:14px'>{explain_freewebs_reverse}</div>");
}
}
$t = time();
$buttons = "\n\tbuttons : [\n\t{name: '<b>{$new_server}</b>', bclass: 'add', onpress : {$bt_function_add}},{$bt_default_www}{$bt_webdav}{$bt_rebuild}{$bt_restore}{$bt_klms_reset_pwd}{$bt_help}{$bt_stats}\n\t\n\t\t],";
$html = "\n\t{$explainSquidActHasReverse}\n\t<input type='hidden' id='freewebs-table-id' value='freewebs-table-{$t}'>\n\t<table class='freewebs-table-{$t}' style='display: none' id='freewebs-table-{$t}' style='width:100%;margin:-10px'></table>\n<script>\nFreeWebIDMEM='';\n\n\$('#freewebs-table-{$t}').flexigrid({\n\turl: '{$page}?servers-list=yes&t={$t}&force-groupware={$_GET["force-groupware"]}&ForceInstanceZarafaID={$_GET["ForceInstanceZarafaID"]}&t={$t}&tabzarafa={$_GET["tabzarafa"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t\t{display: ' ', name : 'icon', width : 31, sortable : false, align: 'center'},\n\t\t{display: '{$joomlaservername}', name : 'servername', width :{$servername_size}, sortable : true, align: 'left'},\n\t\t{display: 'compile', name : 'compile', width :80, sortable : false, align: 'center'},\n\t\t{display: '{$enable}', name : 'enabled', width :80, sortable : true, align: 'center'},\n\t\t{display: '{$size}', name : 'DirectorySize', width :80, sortable : true, align: 'center'},\n\t\t{display: '{$memory}', name : 'memory', width :80, sortable : false, align: 'center'},\n\t\t{display: '{$requests}', name : 'requests', width : 72, sortable : false, align: 'center'},\n\t\t{display: 'SSL', name : 'useSSL', width : 31, sortable : true, align: 'center'},\n\t\t{display: 'RESOLV', name : 'resolved_ipaddr', width : 31, sortable : true, align: 'center'},\n\t\t{display: 'DNS', name : 'dns', width : 31, sortable : false, align: 'center'},\n\t\t{display: '{$member}', name : 'member', width : 31, sortable : false, align: 'center'},\n\t\t{display: ' ', name : 'none1', width : 80, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$joomlaservername}', name : 'servername'},\n\t\t],\n\tsortname: 'servername',\n\tsortorder: 'desc',\n\tusepager: true,\n\ttitle: '{$MAIN_TITLE}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: 550,\n\tsingleSelect: true\n\t\n\t}); \n\n\n\tfunction HelpSection(){\n\t\tLoadHelp('freewebs_explain','',false);\n\t}\n\n\tfunction AddNewFreeWebServer(){\n\t\t Loadjs('freeweb.edit.php?hostname=&force-groupware={$_GET["force-groupware"]}&t={$t}')\n\t}\n\t\n\tfunction AddNewFreeWebServerZarafa(){\n\t\tYahooWin('650','{$page}?freeweb-zarafa-choose=yes&t={$t}','{$choose_your_zarafa_webserver_type}');\n\t}\n\t\n\t\n\tfunction ApacheAllstatus(){\n\t\tLoadjs('freeweb.status.php');\n\t}\n\t\n\t\n\tfunction FreeWebWebDavPerUsers(){\n\t\tLoadjs('freeweb.webdavusr.php?t={$t}')\n\t}\n\t\n\tfunction RestoreSite(){\n\t\tLoadjs('freeweb.restoresite.php?t={$t}')\n\t}\n\t\n\tfunction FreeWebsRefreshWebServersList(){\n\t\t\$('#freewebs-table-{$t}').flexReload();\n\t}\n\t\n\t\n\tvar x_EmptyEvents= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\t\$('#freewebs-table-{$t}').flexReload();\n\t\t//\$('#grid_list').flexOptions({url: 'newurl/'}); \n\t\t// \$('#fgAllPatients').flexOptions({ query: 'blah=qweqweqwe' }).flexReload();\n\t\t\n\t}\t\n\t\n\tvar x_FreeWebsRebuildvHostsTable= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\talert('{$freeweb_compile_background}');\n\t\t\$('#freewebs-table-{$t}').flexReload();\n\t\t//\$('#grid_list').flexOptions({url: 'newurl/'}); \n\t\t// \$('#fgAllPatients').flexOptions({ query: 'blah=qweqweqwe' }).flexReload();\n\t\t}\n\n\t\n\tvar x_klmsresetwebpassword{$t}= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>3){alert(results);return;}\n\t\t\$('#freewebs-table-{$t}').flexReload();\n\t}\t\n\t\n\tvar x_FreeWebDelete=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>10){alert(results);return;}\t\n\t\t\t\$('#row'+FreeWebIDMEM).remove();\n\t\t\tif(document.getElementById('container-www-tabs')){\tRefreshTab('container-www-tabs');}\n\t\t}\t\n\t\t\n\t\tfunction FreeWebDelete(server,dns,md){\n\t\t\tFreeWebIDMEM=md;\n\t\t\tif(confirm('{$delete_freeweb_text}')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tif(dns==1){if(confirm('{$delete_freeweb_dnstext}')){XHR.appendData('delete-dns',1);}else{XHR.appendData('delete-dns',0);}}\n\t\t\t\tXHR.appendData('delete-servername',server);\n \t\t\tXHR.sendAndLoad('freeweb.php', 'GET',x_FreeWebDelete);\n\t\t\t}\n\t\t}\n\n\tvar x_FreeWebRefresh=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>10){alert(results);return;}\t\n\t\t\t\$('#freewebs-table-{$t}').flexReload();\n\t\t}\t\t\n\t\t\n\t\tfunction FreeWebAddDefaultVirtualHost(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('AddDefaultOne','yes');\n \t\tXHR.sendAndLoad('freeweb.php', 'POST',x_FreeWebRefresh);\t\t\n\t\t}\n\t\t\n\t\tfunction FreeWeCheckVirtualHost(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('CheckAVailable','yes');\n \t\tXHR.sendAndLoad('freeweb.php', 'POST',x_FreeWebDelete);\t\t\t\n\t\t}\n\t\t\n\t\tvar x_RebuildFreeweb{$t}=function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\t\t\t\n\t\t\t\$('#freewebs-table-{$t}').flexReload();\n\t\t}\t\t\t\n\t\t\n\t\tfunction RebuildFreeweb(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('rebuild-items','yes');\n \t\tXHR.sendAndLoad('freeweb.php', 'GET',x_RebuildFreeweb{$t});\n\t\t\n\t\t}\n\n\t\tfunction klmsresetwebpassword(){\n\t\t if(confirm('{$reset_admin_password} ?')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('klms-reset-password','yes');\n \t\t\tXHR.sendAndLoad('klms.php', 'POST',x_klmsresetwebpassword{$t});\n \t\t}\t\t\n\t\t}\n\t\t\n\tfunction FreeWebsRebuildvHostsTable(servername){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('FreeWebsRebuildvHosts',servername);\n\t\tXHR.sendAndLoad('freeweb.edit.php', 'POST',x_FreeWebsRebuildvHostsTable);\n\t}\n\n\n\t\t\n\t\n</script>";
echo $html;
}
示例12: visible_hostname_save
function visible_hostname_save()
{
$page = CurrentPageName();
$tpl = new templates();
$squid = new squidbee();
$hostid = $_POST["hostid"];
$nodeid = $_POST["nodeid"];
$visible_hostname = $_POST["visible_hostname"];
$squid->nodes_names[$hostid] = $visible_hostname;
$squid->SaveToLdap(true);
$q = new blackboxes($hostid);
$q->reconfigure_squid();
}
示例13: sargToFile
function sargToFile($filePath)
{
if (!is_file($filePath)) {
progress("Fatal {$filePath} no such file", 10);
return;
}
$unix = new unix();
$sarg_bin = $unix->find_program("sarg");
$linesNumber = $unix->COUNT_LINES_OF_FILE($filePath);
$basename = basename($filePath);
progress("Open {$filePath} {$linesNumber} lines", 10);
$sock = new sockets();
$SargOutputDir = $sock->GET_INFO("SargOutputDir");
if ($SargOutputDir == null) {
$SargOutputDir = "/var/www/html/squid-reports";
}
$nice = EXEC_NICE();
$usersauth = false;
$t = time();
$squid = new squidbee();
if ($squid->is_auth()) {
$usersauth = true;
}
if ($usersauth) {
events("User authentification enabled");
$u = " -i ";
} else {
events("User authentification disabled");
}
$t = time();
$cmd = "{$nice}{$sarg_bin} {$u}-f /etc/squid3/sarg.conf -l \"{$filePath}\" -o \"{$SargOutputDir}\" -x -z 2>&1";
progress("Open {$cmd}", 10);
exec($cmd, $results);
while (list($index, $line) = each($results)) {
if (preg_match("#SARG: OPTION:#", $line)) {
continue;
}
events($line);
}
if ($basename == "sarg.log") {
continue;
}
$took = $unix->distanceOfTimeInWords($t, time(), true);
sarg_admin_events("{$basename} generated took: {$took}\n" . @implode("\n", $results), __FUNCTION__, __FILE__, __LINE__, "sarg");
build_index_page();
}
示例14: proxy_behavior_save
function proxy_behavior_save()
{
$squid = new squidbee();
$sock = new sockets();
$exclusive_reverse_proxy = $_POST["exclusive_reverse_proxy"];
$exclusive_internet_proxy = $_POST["exclusive_internet_proxy"];
$mixed_mode = $_POST["mixed_mode"];
if ($exclusive_reverse_proxy == 1) {
$sock->SET_INFO("SquidActHasReverse", 1);
$sock->SET_INFO("SquidActHasReverseOnly", 1);
$sock->SET_INFO("SquidOldHTTPPort", $squid->listen_port);
$sock->SET_INFO("SquidOldHTTPPort2", $squid->second_listen_port);
$sock->SET_INFO("SquidOldSSLPort", $squid->ssl_port);
$squid->listen_port = 80;
$squid->second_listen_port = 0;
$squid->ICP_PORT = 0;
$squid->HTCP_PORT = 0;
$squid->ssl_port = 443;
if (!$squid->SaveToLdap()) {
echo $squid->ldap_error;
return;
}
return;
}
if ($exclusive_internet_proxy == 1) {
$SquidOldHTTPPort = $sock->GET_INFO("SquidOldHTTPPort");
$SquidOldSSLPort = $sock->GET_INFO("SquidOldSSLPort");
$SquidOldHTTPPort2 = $sock->GET_INFO("SquidOldHTTPPort2");
$sock->SET_INFO("SquidActHasReverse", 0);
$sock->SET_INFO("SquidActHasReverseOnly", 0);
if (is_numeric($SquidOldHTTPPort)) {
if ($SquidOldHTTPPort > 0) {
$squid->listen_port = $SquidOldHTTPPort;
}
}
if (is_numeric($SquidOldHTTPPort2)) {
if ($SquidOldHTTPPort2 > 0) {
$squid->second_listen_port = $SquidOldHTTPPort2;
}
}
if (is_numeric($SquidOldSSLPort)) {
if ($SquidOldSSLPort > 0) {
$squid->ssl_port = $SquidOldSSLPort;
}
}
if (!$squid->SaveToLdap()) {
echo $squid->ldap_error;
return;
}
return;
}
if ($mixed_mode == 1) {
$sock->SET_INFO("SquidActHasReverse", 1);
if ($squid->listen_port != 80) {
$sock->SET_INFO("SquidOldHTTPPort", $squid->listen_port);
$sock->SET_INFO("SquidOldHTTPPort2", $squid->second_listen_port);
$squid->second_listen_port = $squid->listen_port;
$squid->listen_port = 80;
}
if ($squid->ssl_port != 443) {
$sock->SET_INFO("SquidOldSSLPort", $squid->listen_port);
$squid->listen_port = 443;
}
if (!$squid->SaveToLdap()) {
echo $squid->ldap_error;
return;
}
}
$sock = new sockets();
$sock->getFrameWork("cmd.php?restart-apache-src=yes");
}
示例15: delete_cache
function delete_cache()
{
$cachedir = base64_decode($_POST["delete-cache"]);
$squid = new squidbee();
unset($squid->cache_list[$cachedir]);
$sock = new sockets();
$squid->SaveToLdap(true);
$squid->SaveToServer(true);
$sock->getFrameWork("squid.php?remove-cache={$_POST["delete-cache"]}");
}