$debug = 0;
$max_execution_time = 5;
$commandpath = "/tmp/surftool";
$delay = 2;
if (isset($argv[1])) {
    if ($argv[1] >= 0 and $argv[1] < 600) {
        $delay = $argv[1];
    }
}
//check
set_time_limit($max_execution_time);
if (ini_get('max_execution_time') != $max_execution_time) {
    echo "Warning max_execution_time is " . ini_get('max_execution_time') . "s should be " . $max_execution_time . "s\n";
}
include "surftool_class.inc";
$sgcommands = new commandReader($commandpath);
//Are there any changes?
if ($sgcommands->changes) {
    //read squidGuard.conf
    $sgconf = new surftoolSquidGuardConf($config);
    //activate domain changes
    $sgconf->setDomains("onplus", $sgcommands->domainsOnplusAdd, $sgcommands->domainsOnplusRemove);
    $sgconf->setDomains("only", $sgcommands->domainsOnlyAdd, $sgcommands->domainsOnlyRemove);
    $sgconf->write_squidGuardDomains();
    //activate acl mode changes
    $sgconf->setAclMode($sgcommands->aclChangeMode);
    $sgconf->write_squidGuardConf();
    //Reload Squid Configuration
    $sgconf->squidReload();
    $sgcommands->deleteCommandFiles();
}
Пример #2
0
            $i++;
            echo create_room_button($acl["acl-name"], $acl[mode]);
            if ($i % $spalten == 0) {
                echo "\n    </tr>\n    <tr>\n";
            }
        }
        $rest = $spalten - $i % $spalten;
        if ($rest > 0) {
            echo "  <td colspan={$rest}>&nbsp;<td>\n</tr>\n";
        }
        echo "</table>\n";
    } else {
        echo "keine<br>";
    }
}
$sgconf = new surftoolSquidGuardConf($config);
$changes = false;
//preecho($_POST);
//Check Post-Data
if (isset($_POST["group"]) and isset($_POST["mode"])) {
    $group = $_POST["group"];
    $mode = $_POST["mode"];
    if (isset($sgconf->squidGuardConf["acl"]["{$group}"])) {
        if ($mode == "on" and $sgconf->squidGuardConf["acl"]["{$group}"]["mode"] == "on") {
            $mode = "off";
        }
        write_acl_command($group, $mode);
        echo "Switch {$group} to {$mode}<br>\n";
        $changes = true;
    } else {
        echo "Error unknown group:'{$group}'<br>\n";