function save_settings_post()
{
    $sock = new sockets();
    if (isset($_POST["CicapEnabled"])) {
        $sock->SET_INFO("EnableClamavInCiCap", $_POST["CicapEnabled"]);
        $sock->SET_INFO("CicapEnabled", $_POST["CicapEnabled"]);
        writelogs("EnableClamavInCiCap -> `{$_POST["EnableClamavInCiCap"]}`", __FUNCTION__, __FILE__, __LINE__);
        $sock->getFrameWork("cmd.php?squid-reconfigure=yes");
        $sock->getFrameWork("services.php?restart-artica-status=yes");
    }
    $ci = new cicap();
    while (list($num, $line) = each($_POST)) {
        if (preg_match('#^srv_clamav_(.+)#', $num, $re)) {
            $num = "srv_clamav.{$re[1]}";
        }
        writelogs("Save {$num} => {$line}", __FUNCTION__, __FILE__, __LINE__);
        $ci->main_array["CONF"][$num] = $line;
    }
    $tpl = new templates();
    $ci->Save();
    NotifyServers();
}
Esempio n. 2
0
function save_settings()
{
    $sock = new sockets();
    if (isset($_GET["EnableClamavInCiCap"])) {
        $ci = new cicap();
        if ($ci->EnableClamavInCiCap != $_GET["EnableClamavInCiCap"]) {
            $sock->SET_INFO("EnableClamavInCiCap", $_GET["EnableClamavInCiCap"]);
            $reconfigure_squid = true;
            $sock->getFrameWork("cmd.php?squid-reconfigure=yes");
        }
    }
    if (isset($_GET["EnableSquidGuardInCiCAP"])) {
        if ($sock->GET_INFO("EnableSquidGuardInCiCAP") != $_GET["EnableSquidGuardInCiCAP"]) {
            $sock->SET_INFO("EnableSquidGuardInCiCAP", $_GET["EnableSquidGuardInCiCAP"]);
            $reconfigure_squid = true;
        }
    }
    if (isset($_GET["CICAPListenAddress"])) {
        if ($sock->GET_INFO("CICAPListenAddress") != $_GET["CICAPListenAddress"]) {
            $sock->SET_INFO("CICAPListenAddress", $_GET["CICAPListenAddress"]);
            writelogs("CICAPListenAddress -> `{$_GET["CICAPListenAddress"]}`", __FUNCTION__, __FILE__, __LINE__);
            $reconfigure_squid = true;
        }
    }
    if ($reconfigure_squid) {
        $sock->getFrameWork("cmd.php?squid-reconfigure=yes");
    }
    $ci = new cicap();
    while (list($num, $line) = each($_GET)) {
        if (preg_match('#^srv_clamav_(.+)#', $num, $re)) {
            $num = "srv_clamav.{$re[1]}";
        }
        writelogs("Save {$num} => {$line}", __FUNCTION__, __FILE__, __LINE__);
        $ci->main_array["CONF"][$num] = $line;
    }
    $tpl = new templates();
    $ci->Save();
    $sock->getFrameWork("cmd.php?clamd-restart=yes");
    NotifyServers();
}
Esempio n. 3
0
function plugins_save()
{
    $squid = new squidbee();
    $sock = new sockets();
    $tpl = new templates();
    $multiple = false;
    $users = new usersMenus();
    if (preg_match('#^([0-9]+)\\.([0-9]+)#', $users->SQUID_VERSION, $re)) {
        if ($re[1] >= 3) {
            if ($re[2] >= 1) {
                $multiple = true;
            }
        }
    }
    $EnableWebProxyStatsAppliance = $sock->GET_INFO("EnableWebProxyStatsAppliance");
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    if (!is_numeric($EnableWebProxyStatsAppliance)) {
        $EnableWebProxyStatsAppliance = 0;
    }
    if (!is_numeric($EnableRemoteStatisticsAppliance)) {
        $EnableRemoteStatisticsAppliance = 0;
    }
    if ($users->WEBSTATS_APPLIANCE) {
        $EnableWebProxyStatsAppliance = 1;
    }
    $tpl = new templates();
    if (isset($_GET["enable_kavproxy"])) {
        if (!$multiple) {
            if ($_GET["enable_c_icap"] == 1) {
                echo $tpl->javascript_parse_text("{DISABLE_KAV_ENABLE_CICAP}");
                $_GET["enable_kavproxy"] = 0;
            }
        }
        $squid->enable_kavproxy = $_GET["enable_kavproxy"];
    }
    if (isset($_GET["enable_dansguardian"])) {
        if ($_GET["enable_dansguardian"] == 1) {
            if ($_GET["enable_ufdbguardd"] == 1) {
                echo $tpl->javascript_parse_text("{disable_ufdbguardd_dansguardian_enabled}\n");
            }
            $_GET["enable_ufdbguardd"] = 0;
        }
    }
    writelogs("Save kavProxy {$_GET["enable_kavproxy"]}", __FUNCTION__, __FILE__);
    writelogs("Save c-icap {$_GET["enable_c_icap"]}", __FUNCTION__, __FILE__);
    writelogs("Save ufdbguard {$_GET["enable_ufdbguardd"]}", __FUNCTION__, __FILE__);
    writelogs("Save adzapper {$_GET["enable_adzapper"]}", __FUNCTION__, __FILE__);
    if (isset($_GET["enable_c_icap"])) {
        writelogs("Save c-icap {$_GET["enable_c_icap"]}", __FUNCTION__, __FILE__);
        $squid->enable_cicap = $_GET["enable_c_icap"];
    }
    //---------------------------------------------------------------------------------------------------------------------------------------
    if (isset($_GET["enable_ufdbguardd"])) {
        if ($EnableWebProxyStatsAppliance == 1) {
            $datas = unserialize(base64_decode($sock->GET_INFO("ufdbguardConfig")));
        }
        if ($_GET["enable_ufdbguardd"] == 0) {
            $datas["UseRemoteUfdbguardService"] = 0;
        }
        if ($_GET["enable_ufdbguardd"] == 1) {
            $_GET["enable_squidguard"] = 0;
            $datas["UseRemoteUfdbguardService"] = 1;
            $sock->getFrameWork("cmd.php?reload-squidguard=yes");
        }
        if ($EnableWebProxyStatsAppliance == 1) {
            $datas["remote_port"] = $datas["listen_port"];
            if (!is_numeric($datas["remote_port"])) {
                $datas["remote_port"] = 3977;
            }
            while (list($key, $line) = each($_POST)) {
                writelogs("SAVE {$key} = {$line}", __FUNCTION__, __FILE__, __LINE__);
                $datas[$key] = $line;
            }
            $sock->SaveConfigFile(base64_encode(serialize($datas)), "ufdbguardConfig");
            $sock->getFrameWork("squid.php?notify-remote-proxy=yes");
        }
        $sock->SET_INFO("EnableUfdbGuard", $_GET["enable_ufdbguardd"]);
    }
    //---------------------------------------------------------------------------------------------------------------------------------------
    if (isset($_GET["enable_adzapper"])) {
        writelogs("Save enable_adzapper {$_GET["enable_adzapper"]}", __FUNCTION__, __FILE__);
        $squid->enable_adzapper = $_GET["enable_adzapper"];
    }
    if (isset($_GET["enable_squidguard"])) {
        writelogs("Save enable_squidguard {$_GET["enable_squidguard"]}", __FUNCTION__, __FILE__);
        $squid->enable_squidguard = $_GET["enable_squidguard"];
        if ($_GET["enable_squidguard"] == 1) {
            $_GET["enable_dansguardian"] = 0;
        }
    }
    if (isset($_GET["enable_squidclamav"])) {
        writelogs("Save enable_squidclamav {$_GET["enable_squidclamav"]}", __FUNCTION__, __FILE__);
        $squid->enable_squidclamav = $_GET["enable_squidclamav"];
        if ($_GET["enable_squidclamav"] == 1) {
            $squid->enable_cicap = 0;
        }
    }
    if (isset($_GET["enable_metascanner"])) {
        writelogs("Save enable_metascanner {$_GET["enable_metascanner"]}", __FUNCTION__, __FILE__);
        $squid->enable_metascanner = $_GET["enable_metascanner"];
        if ($_GET["enable_metascanner"] == 1) {
            $squid->enable_cicap = 1;
        }
    }
    if (isset($_GET["enable_ecapav"])) {
        writelogs("Save enable_ecapav {$_GET["enable_ecapav"]}", __FUNCTION__, __FILE__);
        $squid->enable_ecapav = $_GET["enable_ecapav"];
    }
    if (isset($_GET["enable_dansguardian"])) {
        writelogs("Save dansguardian {$_GET["enable_dansguardian"]}", __FUNCTION__, __FILE__);
        $squid->enable_dansguardian = $_GET["enable_dansguardian"];
        include_once dirname(__FILE__) . '/ressources/class.dansguardian.inc';
        $dans = new dansguardian();
        $dans->SaveSettings();
    }
    if (!$squid->SaveToLdap()) {
        if (trim($squid->ldap_error) != null) {
            echo $squid->ldap_error;
        }
        return;
        NotifyServers();
    }
    writelogs("Save kavProxy:Final {$squid->enable_kavproxy}", __FUNCTION__, __FILE__);
    writelogs("Save c-icap:Final {$squid->enable_cicap}", __FUNCTION__, __FILE__);
    if ($squid->enable_kavproxy == 1) {
        echo $tpl->javascript_parse_text("{KAVPROXY_WILLBEENABLED}");
        $sock->getFrameWork("squid.php?kav4proxy-configure=yes");
    }
    if ($squid->enable_cicap == 1) {
        echo $tpl->javascript_parse_text("{CICAP_WILLBEENABLED}");
    }
    $sock = new sockets();
    $sock->getFrameWork("cmd.php?restart-artica-status=yes");
}