Example #1
0
function reconfigure_progress()
{
    $sock = new sockets();
    $unix = new unix();
    $php = $unix->LOCATE_PHP5_BIN();
    if (!$sock->isFirehol()) {
        build_progress("{building_init_script}", 80);
        build_init();
        build_progress("{building_rules}", 80);
        system("{$php} /usr/share/artica-postfix/exec.squid.transparent.php");
        build_progress("FireWall service:{disabled}", 100);
        return;
    }
    build_progress("{building_rules}", 10);
    $fire = new firehol();
    $fire->build();
    build_progress("{stopping_firewall}", 50);
    shell_exec("/usr/local/sbin/firehol stop");
    build_progress("{starting_firewall}", 70);
    shell_exec("/usr/local/sbin/firehol start");
    build_progress("{building_init_script}", 80);
    build_init();
    build_progress("{done}", 100);
}
Example #2
0
function port_popup()
{
    $ID = intval($_GET["ID"]);
    $page = CurrentPageName();
    $tpl = new templates();
    if ($ID == 0) {
        echo port_popup_main();
        return;
    }
    $sock = new sockets();
    PatchTable();
    $q = new mysql_squid_builder();
    $ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT FTP,WANPROXY,MIKROTIK_PORT,transparent,TProxy,Parent,WCCP FROM proxy_ports WHERE ID={$ID}"));
    $AS_TRANSPARENT = false;
    $WCCP = intval($ligne["WCCP"]);
    $Parent = intval($ligne["Parent"]);
    $FTP = intval($ligne["FTP"]);
    $WANPROXY = intval($ligne["WANPROXY"]);
    $transparent = intval($ligne["transparent"]);
    $MIKROTIK_PORT = intval($ligne["MIKROTIK_PORT"]);
    $TProxy = intval($ligne["TProxy"]);
    if ($WANPROXY == 1) {
        $array["listen-port-popup"] = 'Wan Compressor Proxy';
        $array["options"] = '{options}';
        while (list($num, $ligne) = each($array)) {
            if ($num == "options") {
                $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.ports.wanproxy.php?ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
                continue;
            }
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
        }
        echo build_artica_tabs($html, "main_proxy_listen_ports");
        return;
    }
    if ($FTP == 1) {
        $array["listen-port-popup"] = 'FTP Proxy';
        $array["options"] = '{options}';
        while (list($num, $ligne) = each($array)) {
            if ($num == "options") {
                $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.ports.ftp.php?ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
                continue;
            }
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
        }
        echo build_artica_tabs($html, "main_proxy_listen_ports");
        return;
    }
    if ($Parent == 1) {
        $array["listen-port-popup"] = '{master_proxy}';
        $array["options"] = '{options}';
        $array["childs"] = '{childs_proxy}';
        while (list($num, $ligne) = each($array)) {
            if ($num == "options") {
                $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.ports.parent.php?ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
                continue;
            }
            if ($num == "childs") {
                $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.children.php?popup=yes&ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
                continue;
            }
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
        }
        echo build_artica_tabs($html, "main_proxy_listen_ports");
        return;
    }
    if ($WCCP == 0) {
        if ($transparent == 0) {
            if ($MIKROTIK_PORT == 0) {
                if (!$sock->isFirehol()) {
                    echo port_popup_main();
                    return;
                }
            }
        }
    }
    if ($WCCP == 0) {
        if (intval($ligne["transparent"]) == 1) {
            $AS_TRANSPARENT = true;
        }
        if (intval($ligne["TProxy"]) == 1) {
            $AS_TRANSPARENT = true;
        }
        if (!$AS_TRANSPARENT) {
            echo port_popup_main();
            return;
        }
    }
    if ($WCCP == 1) {
        $array["listen-port-popup"] = '{listen_port}';
        $array["wccp-options"] = '{WCCP_NAME}';
    }
    if ($transparent == 1 or $TProxy == 1) {
        $array["listen-port-popup"] = '{listen_port}';
        $array["include"] = '{whitelisted_destination_networks}';
        $array["exclude"] = "{whitelisted_src_networks}";
        // 1 === Destination
        // 0 === Source
    }
    while (list($num, $ligne) = each($array)) {
        if ($num == "wccp-options") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.wccpl3.php?port-id={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "mikrotik-options") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.mikrotik.php?port-id={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "include") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.ports.ipwbl.php?include=1&port-id={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        if ($num == "exclude") {
            $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"squid.ports.ipwbl.php?include=0&port-id={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
            continue;
        }
        $html[] = $tpl->_ENGINE_parse_body("<li><a href=\"{$page}?{$num}=yes&ID={$ID}\" style='font-size:18px'><span>{$ligne}</span></a></li>\n");
    }
    echo build_artica_tabs($html, "main_proxy_listen_ports");
}