Beispiel #1
0
function SETTINGS()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $t = time();
    $ligne["enabled"] = 1;
    $btname = "{add}";
    if ($_GET["ID"] > 0) {
        $sql = "SELECT * FROM webauth_rules WHERE ID={$_GET["ID"]}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $btname = "{apply}";
    }
    $html = "\n<div style='width:98%' class=form>\n<table style='width:100%'>\n\t\t" . Field_text_table("rulename-{$t}", "{rulename}", utf8_encode($ligne["rulename"]), 26, null, 450) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], 26) . Field_spacer_table(50) . Field_button_table_autonome("{$btname}", "Save{$t}", 34) . "</table>\n</div>\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar ID='{$_GET["ID"]}';\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#HOSTPOT_RULES').flexReload();\n\t\tif(ID==0){YahooWin3Hide(); }\n\t}\t\n\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\tXHR.appendData('rulename',document.getElementById('rulename-{$t}').value);\n\t\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n</script>\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function skin_parameters()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $sql = "SELECT ID,groupname FROM webfilter_rules WHERE enabled=1";
    $results = $q->QUERY_SQL($sql);
    $RULES["0"] = "{default}";
    $btname = "{add}";
    $t = time();
    while ($ligne = mysql_fetch_assoc($results)) {
        $RULES[$ligne["ID"]] = "{$ligne["groupname"]}";
    }
    $dans = new dansguardian_rules();
    $cats = $dans->LoadBlackListes();
    $newcat["*"] = "{all}";
    while (list($num, $ligne) = each($cats)) {
        $newcat[$num] = $num;
    }
    $newcat["safebrowsing"] = "Google Safe Browsing";
    $newcat["blacklist"] = "{blacklist}";
    $newcat["restricted_time"] = "{restricted_access}";
    $newcat["generic"] = "{generic}";
    $ligne["enabled"] = 1;
    if ($_GET["zmd5"] != null) {
        $sql = "SELECT * FROM ufdb_design WHERE zmd5='{$_GET["zmd5"]}'";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
        $btname = "{apply}";
    }
    $html = "\n\t<div style='width:98%' class=form>\n\t\t\t<table style='width:100%'>\n\t\t" . Field_list_table("category-{$t}", "{category}", $ligne["category"], 26, $newcat) . Field_list_table("ruleid-{$t}", "{rule}", $ligne["ruleid"], 26, $RULES) . Field_checkbox_table("enabled-{$t}", "{enabled}", $ligne["enabled"], 26) . Field_spacer_table(50) . Field_button_table_autonome("{$btname}", "Save{$t}", 34) . "</table>\n\t</div>\n<script>\n\tvar xSave{$t}= function (obj) {\n\t\tvar zmd5='{$_GET["zmd5"]}';\n\t\tvar res=obj.responseText;\n\t\tif(res.length>3){alert(res);return;}\n\t\t\$('#UFDB_SKIN_RULES').flexReload();\n\t\tif(zmd5.length==0){YahooWin3Hide(); }\n\t}\t\n\n\t\n\tfunction Save{$t}(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('zmd5-params','{$_GET["zmd5"]}');\n\t\tXHR.appendData('category',document.getElementById('category-{$t}').value);\n\t\tXHR.appendData('ruleid',document.getElementById('ruleid-{$t}').value);\n\t\tif(document.getElementById('enabled-{$t}').checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n\t\tXHR.sendAndLoad('{$page}', 'POST',xSave{$t});\t\n\t}\n\n\tfunction check{$t}(){\n\t\tvar zmd5='{$_GET["zmd5"]}';\n\t\tif(zmd5.length>5){\n\t\t\tdocument.getElementById('category-{$t}').disabled=true;\n\t\t\tdocument.getElementById('ruleid-{$t}').disabled=true;\n\t\t\n\t\t}\n\t\n\t}\ncheck{$t}();\t\t\t\t\n</script>\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}