コード例 #1
0
function ApplyConfigDansGuardian($noecho = 0)
{
    $user = new usersMenus();
    if (!isset($_GET["hostname"])) {
        $hostname = $user->hostname;
    } else {
        $hostname = $_GET["hostname"];
    }
    $prod = "dansguardian_main_settings";
    $tpl = new templates();
    if ($user->DANSGUARDIAN_INSTALLED == false) {
        echo $tpl->_ENGINE_parse_body(NotInstalled($prod));
        exit;
    }
    include_once 'ressources/class.dansguardian.inc';
    $dans = new dansguardian($hostname);
    $dans->SaveSettings();
    if (is_array($dans->Master_rules_index)) {
        while (list($num, $line) = each($dans->Master_rules_index)) {
            $rules = new dansguardian_rules($hostname, $num);
            $rules->SaveConfigFiles();
        }
    }
    $sock = new sockets();
    $sock->getfile('dansguardian_saveconf:' . $hostname);
    if ($noecho == 0) {
        echo $tpl->_ENGINE_parse_body(Success($prod));
    }
}
コード例 #2
0
function main_rules_weightedphraselist_category_addwords()
{
    $category = $_GET["weighted-phrase-list-add-category-rule"];
    $words = $_GET["words"];
    $score = $_GET["score"];
    $dansguardian = new dansguardian();
    $dansguardian->DefinedCategoryWeightedPhraseListAddRule($category, $words, $score);
}
コード例 #3
0
function BuildRules()
{
    $dans = new dansguardian();
    $sql = "SELECT RuleID,RuleName,RuleText FROM dansguardian_rules WHERE RuleID>1 ORDER BY RuleID";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($ligne["RuleID"] == 1) {
            continue;
        }
        $count = $count + 1;
        $GLOBALS["DANSGUARDIAN_RULES_INDEX"][$ligne["RuleID"]] = $count;
        $dansguardian = new dansguardian_rules(null, $ligne["RuleID"]);
        $ligne["RuleText"] = $dansguardian->BuildMainRule();
        events(__FUNCTION__ . ":: ----------------------------------------------------------------------------------------");
        events(__FUNCTION__ . ":: Writing /etc/dansguardian/dansguardianf{$count}.conf ID:{$ligne["RuleID"]} Name:{$ligne["RuleName"]} " . strlen($ligne["RuleText"]) . " bytes");
        events(__FUNCTION__ . ":: ----------------------------------------------------------------------------------------");
        @file_put_contents("/etc/dansguardian/dansguardianf{$count}.conf", $ligne["RuleText"]);
        CheckFilesDatabases($ligne["RuleText"], $ligne["RuleID"]);
        ChangeRuleName($count, $ligne["RuleName"]);
        if ($dans->ContentScannerMustEnabled()) {
            events(__FUNCTION__ . ":: clamav is enabled checkit");
            WriteConfigFile("/etc/dansguardian/dansguardianf{$count}.conf", "contentscanner", "'/etc/dansguardian/contentscanners/clamdscan.conf'");
        } else {
            events(__FUNCTION__ . ":: clamav is disbaled delete it");
            DeleteConfigFile("/etc/dansguardian/dansguardianf{$count}.conf", "contentscanner");
        }
    }
    if (!is_file("/etc/dansguardian/dansguardianf1.conf")) {
        copy("/etc/dansguardian/dansguardian.conf /etc/dansguardian/dansguardianf1.conf");
    }
}
コード例 #4
0
ファイル: squid.simple.php プロジェクト: brucewu16899/1.6.x
function main_network_edit_port_dans(){
	$users=new usersMenus();
	if($_GET["hostname"]==null){$hostname=$users->hostname;}else{$hostname=$_GET["hostname"];}	
	
	$squid=new squid($_GET["hostname"]);
	$squid->http_port_array[0]=$_GET["squid_http_port"];
	$squid->SaveToLdap();	
	writelogs("->class.dansguardian.inc -> dansguardian listen port={$_GET["dans_http_port"]}",__FUNCTION__,__FILE__);
	$dans=new dansguardian($_GET["hostname"]);
	$dans->Master_array["filterip"]=$_GET["dans_http_port_ip"];
	$dans->Master_array["filterport"]=$_GET["dans_http_port"];
	$dans->SaveSettings();
	}
コード例 #5
0
function main_rules_weightedphraselist_list($rule_main, $noecho = 0)
{
    $dans = new dansguardian_rules($_GET["hostname"], $rule_main);
    $dansguardian = new dansguardian();
    $users_rules = $dansguardian->DefinedCategoryWeightedPhraseListLoad();
    //weightedphraselist
    $categ = "<table style='width:99%'>";
    $sql = "SELECT * FROM dansguardian_files WHERE filename='weightedphraselist' AND RuleID='{$rule_main}'";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $val = $ligne["pattern"];
        $val = trim($val);
        $num = $ligne["ID"];
        $edit_icon = null;
        $delete_icon = imgtootltip("ed_delete.gif", "{delete}", "dansguardian_delcategoryWeight('{$hostname}','{$rule_main}','{$num}')");
        $category_name = $dans->array_weighted_phrases_lists[$val];
        if ($users_rules[$val] == $val) {
            $edit_icon = imgtootltip("icon_edit.gif", "{apply}", "dansguardian_edit_user_categoryWeight('{$val}')");
            if (strlen($val) > 11) {
                $category_name = texttooltip("{your_category}:&nbsp;" . substr($val, 0, 8) . "...", $val, "dansguardian_edit_user_categoryWeight('{$val}')");
            } else {
                $category_name = texttooltip("{your_category}:&nbsp;{$val}", $val, "dansguardian_edit_user_categoryWeight('{$val}')");
            }
        }
        $categ = $categ . "<tr>\n\t\t\t\t<td width=1% valign='top'><img src='img/red-pushpin-24.png'></td>\t\t\t\t\n\t \t   \t\t<td valign='top'><span style='font-size:13px;font-weight:bold'>{$category_name}</span></td>\n\t \t   \t\t<td width=1%>{$edit_icon}</td>\n\t\t\t\t<td valign='top'>{$delete_icon}</td>\n\t\t\t\t</tr>";
    }
    $categ = "<div style='height:500px'>{$categ}</table></div>";
    $tpl = new templates();
    if ($noecho == 1) {
        return $tpl->_ENGINE_parse_body("{$categ}");
    }
    echo $tpl->_ENGINE_parse_body("{$categ}");
}
コード例 #6
0
ファイル: squid.popups.php プロジェクト: brucewu16899/artica
function plugins_save()
{
    $squid = new squidbee();
    $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;
            }
        }
    }
    $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"];
    }
    writelogs("Save kavProxy {$_GET["enable_kavproxy"]}", __FUNCTION__, __FILE__);
    writelogs("Save c-icap {$_GET["enable_c_icap"]}", __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_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_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;
    }
    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}");
    }
    if ($squid->enable_cicap == 1) {
        echo $tpl->javascript_parse_text("{CICAP_WILLBEENABLED}");
    }
}
コード例 #7
0
ファイル: squid.popups.php プロジェクト: BillTheBest/1.6.x
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");
}
コード例 #8
0
function _main_rules_categories_list($rule_main, $noecho = 0)
{
    $dansguardian = new dansguardian();
    $array_categories_user = $dansguardian->DefinedCategoryBlackListLoad();
    $dans = new dansguardian_rules($_GET["hostname"], $rule_main);
    //bannedsitelist
    $q = new mysql();
    $sql = "SELECT * FROM dansguardian_personal_categories WHERE category_type='enabled' AND RuleID={$rule_main}";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    $categ = "\n\t<table style='width:99%'>";
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $num = $ligne["ID"];
        $val = $ligne["category"];
        if (trim($val) == null) {
            continue;
        }
        $delete_icon = imgtootltip("ed_delete.gif", "{delete}", "dansguardian_delPersonalcategory('{$ligne["ID"]}')");
        $edit_icon = imgtootltip("icon_edit.gif", "{apply}", "dansguardian_edit_personal_category('{$ligne["category"]}')");
        $style = CellRollOver("dansguardian_edit_personal_category('{$ligne["category"]}')");
        $categ = $categ . "<tr>\n\t\t\t<td width=1% valign='top'><img src='img/red-pushpin-24.png'></td>\t\t\t\t\n\t\t\t\t<td valign='top' {$style}><span style='font-size:13px;font-weight:bold'>{$val}:{$dans->array_blacksites[$val]}</span></td>\n\t\t\t\t<td valign='top'>{$delete_button}</td>\n\t\t\t\t<td width=1%>{$edit_icon}</td>\n\t\t\t\t<td width=1%>{$delete_icon}</td>\n\t\t\t</tr>\n\t\t\t\t";
    }
    $categ = "<div style='height:500px'>{$categ}</div>";
    $tpl = new templates();
    if ($noecho == 1) {
        return $tpl->_ENGINE_parse_body("{$categ}");
    }
    echo $tpl->_ENGINE_parse_body("{$categ}");
}
コード例 #9
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;
            }
        }
    }
    $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"])) {
        writelogs("Save enable_ufdbguardd {$_GET["enable_ufdbguardd"]}", __FUNCTION__, __FILE__);
        if ($_GET["enable_ufdbguardd"] == 1) {
            $_GET["enable_squidguard"] = 0;
            $sock->getFrameWork("cmd.php?reload-squidguard=yes");
        }
        $squid->enable_UfdbGuard = $_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_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;
    }
    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");
}