예제 #1
0
function EditGroup_popup()
{
    $ID = $_GET["ID"];
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    if ($ID > 0) {
        if (!isset($_GET["tab"])) {
            EditGroup_tabs();
            return;
        }
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_sqgroups WHERE ID='{$ID}'"));
    $buttonname = "{apply}";
    if ($ID < 1) {
        $buttonname = "{add}";
    }
    $t = time();
    $GroupType["src"] = "{addr}";
    $GroupType["arp"] = "{ComputerMacAddress}";
    $GroupType["dstdomain"] = "{dstdomain}";
    $GroupType["proxy_auth"] = "{members}";
    $html = "\n\t<div id='{$t}'>\n\t<table style='width:99%' class=form>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap width=99%>{groupname}:</td>\n\t\t<td>" . Field_text("GroupName", utf8_encode($ligne["GroupName"]), "font-size:14px;width:240px") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px' nowrap>{group_type}:</td>\n\t\t<td>" . Field_array_Hash($GroupType, "GroupType", $ligne["GroupType"], "style:font-size:14px") . "</td>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t<td colspan=2 align='right'><hr>" . button($buttonname, "SaveAclGroupMode()", 16) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_SaveAclGroupMode= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tYahooWinTHide();\n\t\tif(document.getElementById('formulaire-choix-groupe-proxy')){RefreshFormulaireChoixGroupeProxy();}\n\t\tif(document.getElementById('flexRT-refresh-1')){ \$('#'+document.getElementById('flexRT-refresh-1').value).flexReload();}\n\t\tRefreshSquidGroupTable();\n\t}\n\t\n\tfunction SaveAclGroupMode(){\n\t\t      var XHR = new XHRConnection();\n\t\t      XHR.appendData('GroupName', document.getElementById('GroupName').value);\n\t\t      XHR.appendData('GroupType', document.getElementById('GroupType').value);\n\t\t      XHR.appendData('ID', '{$ID}');\t      \n\t\t      AnimateDiv('{$t}');\n\t\t      XHR.sendAndLoad('{$page}', 'POST',x_SaveAclGroupMode);  \t\t\n\t\t}\t\n\t\t\n\tfunction CheckGrouform{$t}(){\n\t\tvar id={$ID};\n\t\tif(id>0){document.getElementById('GroupType').disabled=true;}\n\t}\nCheckGrouform{$t}();\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
예제 #2
0
function EditGroup_popup()
{
    $ID = $_GET["ID"];
    $ASWPAD = false;
    $AsTransParent = false;
    if (isset($_GET["wpad"])) {
        $wpad = "&wpad=yes";
        $ASWPAD = true;
    }
    if ($_GET["TransParentMode"]) {
        $wpad = "&wpad=yes&TransParentMode=1";
        $ASWPAD = true;
        $AsTransParent = true;
    }
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    if ($ID > 0) {
        if (!isset($_GET["tab"])) {
            EditGroup_tabs();
            return;
        }
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT * FROM webfilters_sqgroups WHERE ID='{$ID}'"));
    $buttonname = "{apply}";
    $acltpl_md5 = trim($ligne["acltpl"]);
    $acltpl = "{default}";
    $sock = new sockets();
    $jstpl = "blur();";
    $browse = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.templates.php?choose-acl={$ID}');\" \n\tstyle='font-weight:normal;text-decoration:underline;font-size:14px'>";
    if ($ID < 1) {
        $buttonname = "{add}";
        $browse = null;
        $acltpl = null;
    }
    if ($acltpl_md5 != null) {
        if ($acltpl_md5 == "ARTICA_SLASH_SCREEN") {
            $jstpl = "javascript:Loadjs('squid.webauth.php');";
            $acltpl = "<a href=\"javascript:blur();\" OnClick=\"{$jstpl}\" \n\t\t\t\tstyle='font-size:14px;text-decoration:underline'>HotSpot</a>";
        } else {
            $md5 = $acltpl_md5;
            $sql = "SELECT template_name,template_link FROM squidtpls WHERE `zmd5`='{$acltpl_md5}'";
            $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
            $templatename = $ligne2["template_name"];
            $acltpl = addslashes($ligne2["template_name"]);
            $jstpl = "Loadjs('squid.templates.php?Zoom-js={$md5}&subject=" . base64_encode($acltpl) . "');";
            $acltpl = "<a href=\"javascript:blur();\" OnClick=\"{$jstpl}\" style='font-size:14px;text-decoration:underline'>{$templatename}</a>";
            if ($ligne2["template_link"] == 1) {
                $acltpl = "<span style='font-size:14px;'>{$templatename}</span>";
            }
        }
    }
    $t = time();
    $tt = time();
    $GroupType = $q->acl_GroupType;
    $sql = "SELECT ID,objectname  FROM `quota_objects` ORDER BY objectname";
    $results = $q->QUERY_SQL($sql);
    while ($ligne3 = mysql_fetch_assoc($results)) {
        $GroupType["time_quota:{$ligne3["ID"]}"] = "{time_quota}:{$ligne3["objectname"]}";
    }
    $sql = "SELECT ID,objectname  FROM `sessions_objects` ORDER BY objectname";
    $results = $q->QUERY_SQL($sql);
    while ($ligne3 = mysql_fetch_assoc($results)) {
        $GroupType["time_session:LOGIN:{$ligne3["ID"]}"] = "{session_tracking}:LOGIN:{$ligne3["objectname"]}";
        $GroupType["time_session:LOGOUT:{$ligne3["ID"]}"] = "{session_tracking}:LOGOUT:{$ligne3["objectname"]}";
        $GroupType["time_session:ACTIVE:{$ligne3["ID"]}"] = "{session_tracking}:ACTIVE:{$ligne3["objectname"]}";
    }
    if ($ASWPAD) {
        $GroupType = $q->acl_GroupType_WPAD;
    }
    if ($AsTransParent) {
        $GroupType = $q->acl_GroupType_iptables;
    }
    $GroupeTypeField = Field_array_Hash($GroupType, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
    if ($GLOBALS["VERBOSE"]) {
        echo "FilterType={$_GET["FilterType"]}<br>\n";
    }
    if ($_GET["FilterType"] != null) {
        switch ($_GET["FilterType"]) {
            case "src":
                $GroupeTypeField = "<input type='hidden' name='GroupType-{$tt}' id='GroupType-{$tt}' value='src'>\n\t\t\t\t{$GroupType["src"]}";
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "MAC":
                $GroupeTypeField = "<input type='hidden' name='GroupType-{$tt}' id='GroupType-{$tt}' value='arp'>\n\t\t\t\t{$GroupType["arp"]}";
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "FW-IN":
                $GroupType = array();
                $GroupeTypeField = Field_array_Hash($q->acl_GroupType_Firewall_in, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "FW-OUT":
                $GroupType = array();
                $GroupeTypeField = Field_array_Hash($q->acl_GroupType_Firewall_out, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "FW-PORT":
                $GroupType = array();
                $GroupeTypeField = Field_array_Hash($q->acl_GroupType_Firewall_port, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "uid":
                $GroupType = array();
                $GroupType["ext_user"] = $q->acl_GroupType["ext_user"];
                $GroupType["proxy_auth_ads"] = $q->acl_GroupType["proxy_auth_ads"];
                $GroupType["proxy_auth"] = $q->acl_GroupType["proxy_auth"];
                $GroupeTypeField = Field_array_Hash($GroupType, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
                break;
            case "ADMBR":
                $GroupType = array();
                $GroupType["proxy_auth_ads"] = $q->acl_GroupType["proxy_auth_ads"];
                $GroupType["proxy_auth"] = $q->acl_GroupType["proxy_auth"];
                $GroupeTypeField = Field_array_Hash($GroupType, "GroupType-{$tt}", $ligne["GroupType"], "TypeAddButton{$tt}()", null, 0, "font-size:16px");
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "EXT_USER":
                $GroupeTypeField = "<input type='hidden' name='GroupType-{$tt}' id='GroupType-{$tt}' value='ext_user'>\n\t\t\t\t{$GroupType["ext_user"]}";
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "dstdomain":
                $GroupeTypeField = "<input type='hidden' name='GroupType-{$tt}' id='GroupType-{$tt}' value='dstdomain'>\n\t\t\t\t{$GroupType["dstdomain"]}";
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "srcdomain":
                $GroupeTypeField = "<input type='hidden' name='GroupType-{$tt}' id='GroupType-{$tt}' value='srcdomain'>\n\t\t\t\t{$GroupType["srcdomain"]}";
                $ScriptAdd = "TypeAddButton{$tt}()";
                break;
            case "max_user_ip":
                $ScriptAdd2 = "LoadAjax('{$tt}-authenticate_ip_ttl_form','{$page}?authenticate_ip_ttl_form=yes')";
                break;
            default:
                $GroupeTypeField = null;
                break;
        }
    }
    if ($ligne["GroupType"] == "max_user_ip") {
        $ScriptAdd2 = "LoadAjax('{$tt}-authenticate_ip_ttl_form','{$page}?authenticate_ip_ttl_form=yes')";
    }
    $template_section = "\t<tr>\n\t\t<td class=legend style='font-size:14px' valign='top'>{template}:</td>\n\t\t<td>\n\t\t\t<table style='width:99%'>\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top'><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top'><strong style='font-size:12px'><span id='acltplTxt'>{$acltpl}</span></a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td width=1% valign='top'><img src='img/arrow-right-16.png'></td>\n\t\t\t\t<td valign='top'><span style='font-size:14px'>{$browse}<span id='acltplTxt'>{change_template}</span></a></td>\n\t\t\t</tr>\t\t\t\n\t\t</table>\n\t\t</td>\n\t</tr>";
    if ($ligne["GroupType"] == "hotspot_auth") {
        $template_section = "\n\t\t<tr>\n\t\t\t<td colspan=2 align='right'><a href=\"javascript:blur();\"\n\t\t\tOnClick=\"javascript:Loadjs('squid.webauth.php?YahooWin=6');\"\n\t\t\tstyle='font-size:16px;text-decoration:underline'>{hotspot_parameters}</a></td>\n\t\t</tr>\t\t\n\t";
    }
    if ($ligne["GroupType"] == "dynamic_acls") {
        $ScriptAdd2 = "LoadAjax('{$tt}-infos2','{$page}?dynamic-acls-params=yes&gpid={$ID}&table-acls-t={$_GET["table-acls-t"]}&table-org={$_GET["table-org"]}');";
    }
    $html = "\n\t<div id='{$t}'></div>\n\t<div style='width:98%' class=form>\n\t\n\t<table style='width:99%'>\n\t<tbody>\n\t<tr>\n\t\t<td class=legend style='font-size:16px' nowrap width=99%>{groupname}:</td>\n\t\t<td>" . Field_text("GroupName-{$tt}", utf8_encode($ligne["GroupName"]), "font-size:16px;width:340px", null, null, null, false, "SaveAclGroupModeCheck(event)") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px' nowrap>{group_type}:</td>\n\t\t<td style='font-size:16px;font-weight:bold'>{$GroupeTypeField}</td>\n\t</tr>\n\t<tr>\n\t<td colspan=2 align='right'><span id='group-add-f-{$t}'></span></td>\n\t</tr>\t\n\t{$template_section}\t\n\t\n\t<tr>\n\t<td colspan=2 align='right'><hr>" . button($buttonname, "SaveAclGroupMode()", 20) . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<div id='{$tt}-infos'></div>\n\t<div id='{$tt}-authenticate_ip_ttl_form'></div>\n\t<div id='{$tt}-infos2'></div>\n\t\n\t\n\t<script>\n\tvar x_SaveAclGroupMode= function (obj) {\n\t\tvar res=obj.responseText;\n\t\tvar ID={$ID};\n\t\tdocument.getElementById('{$t}').innerHTML='';\n\t\tif(res.length>3){alert(res);return;}\n\t\tif(ID==0){YahooWinTHide();}\n\t\tif(ID==-1){YahooWinTHide();}\n\t\tif(document.getElementById('formulaire-choix-groupe-proxy')){RefreshFormulaireChoixGroupeProxy();}\n\t\tvar tableaclt='{$_GET["table-acls-t"]}';\n\t\tvar tableorg='{$_GET["table-org"]}';\n\t\tif(tableaclt.length>3){ \$('#table-items-'+tableaclt).flexReload();}\n\t\tif(tableorg.length>3){ \$('#'+tableorg).flexReload();}\n\t\tifFnExistsCallIt('RefreshSquidGroupTable');\n\t\tRefreshAllAclsTables();\n\t\tExecuteByClassName('SearchFunction');\n\t}\n\t\n\tfunction SaveAclGroupModeCheck(e){\n\t\tif(checkEnter(e)){SaveAclGroupMode();}\n\t}\n\t\n\tfunction TypeAddButton{$tt}(){\n\t\tvar mGroupName='GroupName-{$tt}';\n\t\tvar GroupType=document.getElementById('GroupType-{$tt}').value;\n\t\tdocument.getElementById('GroupName-{$tt}').disabled=false;\n\t\t\n\t\tif(GroupType=='proxy_auth_ads'){\n\t\t\tdocument.getElementById('GroupName-{$tt}').disabled=true;\n\t\t}\n\t\t\n\t\tif(GroupType=='proxy_auth_statad'){\n\t\t\tdocument.getElementById('GroupName-{$tt}').disabled=true;\n\t\t}\n\t\t\n\t\tif(GroupType=='proxy_auth_ldap'){\n\t\t\tdocument.getElementById('GroupName-{$tt}').disabled=true;\n\t\t}\t\t\n\t\t\n\t\tLoadAjaxTiny('group-add-f-{$t}','{$page}?GroupType-button=yes&GroupName='+mGroupName+'&t={$t}&GroupType='+GroupType+'&tt={$tt}');\n\t}\n\t\n\t\n\t\n\tfunction SaveAclGroupMode(){\n\t\t      var XHR = new XHRConnection();\n\t\t      if(!document.getElementById('GroupName-{$tt}')){\n\t\t      \talert('Group name: GroupName-{$tt}; no such id');\n\t\t      \treturn;\n\t\t      }\n\t\t      if(!document.getElementById('GroupType-{$tt}')){\n\t\t      \talert('Group name: GroupType-{$tt}; no such id');\n\t\t      \treturn;\n\t\t      }\t\t      \n\t\t      \n\t\t      XHR.appendData('GroupName', document.getElementById('GroupName-{$tt}').value);\n\t\t      XHR.appendData('GroupType', document.getElementById('GroupType-{$tt}').value);\n\t\t      XHR.appendData('ACLType', '{$_GET["ACLType"]}');\n\t\t\t  XHR.appendData('ID', '{$ID}');\n\t\t      XHR.appendData('link-acl', '{$_GET["link-acl"]}');\n\t\t      XHR.appendData('TransParentMode', '{$_GET["TransParentMode"]}');\n\t\t      \n\t\t      \n\t\t      AnimateDiv('{$t}');\n\t\t      XHR.sendAndLoad('{$page}', 'POST',x_SaveAclGroupMode);  \t\t\n\t\t}\t\n\t\t\n\tfunction CheckGrouform{$t}(){\n\t\tvar id={$ID};\n\t\tvar GroupType=document.getElementById('GroupType-{$tt}').value;\n\t\tif(GroupType=='proxy_auth_ads'){document.getElementById('GroupName-{$tt}').disabled=true;}\n\t\tif(GroupType=='proxy_auth_statad'){document.getElementById('GroupName-{$tt}').disabled=true;}\n\t\tif(GroupType=='proxy_auth_ldap'){document.getElementById('GroupName-{$tt}').disabled=true;}\n\t\tif(id>0){document.getElementById('GroupType-{$tt}').disabled=true;return;}\n\t}\n\t\n{$ScriptAdd2};\t\nCheckGrouform{$t}();\n{$ScriptAdd};\n\nLoadAjax('{$tt}-infos','{$page}?dynamic-acls-infos=yes&ID={$ID}');\n\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}