function popup()
{
    $users = new usersMenus();
    $ad = new external_ad_search();
    $DNDUMP = $ad->DNDUMP($_GET["DN"]);
    $tpl = new templates();
    if (isset($DNDUMP["description"][0])) {
        $description = $DNDUMP["description"][0];
    }
    $title = $DNDUMP["samaccountname"][0];
    if (isset($DNDUMP["givenname"][0])) {
        $title = "{$DNDUMP["givenname"][0]} {$DNDUMP["sn"][0]}";
    }
    $MAIN_SQUIDRULES = array();
    $MAIN_WEBRULES = array();
    for ($i = 0; $i < $DNDUMP["memberof"]["count"]; $i++) {
        $DN = $DNDUMP["memberof"][$i];
        $XGRP = $ad->DNinfos($DN);
        $GroupName = $XGRP[0]["samaccountname"][0];
        if ($users->SQUID_INSTALLED) {
            $acl = new squid_acls();
            $RULES = $acl->GetRulesFromADGroup($GroupName);
            if ($GLOBALS["VERBOSE"]) {
                echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n";
            }
            if (is_array($RULES)) {
                while (list($key, $ligne) = each($RULES)) {
                    $MAIN_SQUIDRULES[$key] = $ligne;
                }
                if ($GLOBALS["VERBOSE"]) {
                    echo "<span style='color:red;font-size:22px'>{$GroupName}:: \$MAIN_SQUIDRULES:" . count($MAIN_SQUIDRULES) . " RULES</span><br>\n";
                }
            }
            $sock = new sockets();
            if ($sock->EnableUfdbGuard() == 1) {
                $MAIN_WEBRULES[0] = "{default}";
                $RULES = $acl->GetWebfilteringRulesFromADGroup($GroupName);
                if ($GLOBALS["VERBOSE"]) {
                    echo "<span style='color:red;font-size:22px'>{$GroupName}:: " . count($RULES) . " RULES</span><br>\n";
                }
                if (is_array($RULES)) {
                    while (list($key, $ligne) = each($RULES)) {
                        $MAIN_WEBRULES[$key] = $ligne;
                    }
                    if ($GLOBALS["VERBOSE"]) {
                        echo "<span style='color:red;font-size:22px'>{$GroupName}:: \$MAIN_WEBRULES:" . count($MAIN_WEBRULES) . " RULES</span><br>\n";
                    }
                }
            }
        }
        $jsGRP = "Loadjs('domains.edit.group.php?js=yes&group-id=" . urlencode($DN) . "',true)";
        $XTRG[] = "<tr>\n\t\t\t\t\t<td style='width:16px'><img src='img/wingroup.png'></td>\n\t\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" style='text-decoration:underline'>{$GroupName}</a></td>\n\t\t\t\t</tr>";
    }
    if (count($MAIN_SQUIDRULES) > 0) {
        $rules_title = "{rules}";
        if (count($MAIN_SQUIDRULES) < 2) {
            $rules_title = "{rule}";
        }
        while (list($aclid, $aclname) = each($MAIN_SQUIDRULES)) {
            $jsGRP = "Loadjs('squid.acls-rules.php?Addacl-js=yes&ID={$aclid}');";
            $XTRGB[] = "<tr>\n\t\t\t<td style='width:16px'><img src='img/scripts-16.png'></td>\n\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\" \n\t\t\t\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t\t\t</tr>";
        }
        $proxay_acls = "</tr>\n\t\t<tr style='height:70px'>\n\t\t<td valign=middle style='font-size:26px' class=legend>" . count($MAIN_SQUIDRULES) . " {$rules_title} (Proxy):</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td></td>\n\t\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t\t</tr>";
    }
    if (count($MAIN_WEBRULES) > 0) {
        $XTRGB = array();
        while (list($aclid, $aclname) = each($MAIN_WEBRULES)) {
            $jsGRP = "YahooWin3('1100','dansguardian2.edit.php?ID={$aclid}&t=0','{$aclid} {$aclname}');";
            $XTRGB[] = "<tr>\n\t\t\t<td style='width:16px'><img src='img/scripts-16.png'></td>\n\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" OnClick=\"javascript:{$jsGRP}\"\n\t\t\tstyle='text-decoration:underline'>{$aclname}</a></td>\n\t\t\t</tr>";
        }
        $rules_title = "{rules}";
        if (count($MAIN_WEBRULES) < 2) {
            $rules_title = "{rule}";
        }
        $webfilter_acls = "</tr>\n\t\t<tr style='height:70px'>\n\t\t<td valign=middle style='font-size:26px' class=legend>" . count($MAIN_WEBRULES) . " {$rules_title} ({webfiltering}):</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td></td>\n\t\t<td><table style='width:100%'>" . @implode("", $XTRGB) . "</table></td>\n\t\t</tr>";
    }
    $picture_link = "img/impersonate-photo.png";
    $html = "\n\t\t\t\n\t<div style='width:98%' class=form>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='width:190px;vertical-align:top'>\n\t\t<center style='margin-top:15px'>\n\t\t<img style='border-radius: 50% 50% 50% 50%;\n    \t\tbox-shadow: 0 0 5px silver;height: 180px;margin: 0 32px;width: 180px;' src='{$picture_link}'></a>\n    <center style='font-size: 24px;line-height: 1.2;word-wrap: break-word;margin-top:30px;margin-bottom:30px'>{$title}</center>\n\n    \n    </center>\t\n\t</td>\n\t\t<td style='width:80%;vertical-aglin:top'>\n\t\t\t<table style='width:100%'>\n\t\t\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend><div>{Contact_Information}:</div><i style='font-size:16px'>{$description}</i></td>\n\t\t\t</tr>\n\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{member}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["givenname"][0]} {$DNDUMP["sn"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{name}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["name"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{account}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["samaccountname"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{email}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["mail"][0]}</strong></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{telephoneNumber}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["telephonenumber"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle style='font-size:18px' class=legend>{mobile}:</td>\n\t\t\t\t<td valign=middle style='font-size:18px'><strong>{$DNDUMP["mobile"][0]}</strong></td>\n\t\t\t</tr>\t\t\t\n\t\t\t\t<tr style='height:70px'>\n\t\t\t\t<td valign=middle style='font-size:26px' class=legend>{$DNDUMP["memberof"]["count"]} {groups}:</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td></td>\n\t\t\t\t<td><table style='width:100%'>" . @implode("", $XTRG) . "</table></td>\n\t\t\t</tr>\n\t\t\t{$proxay_acls}\n\t\t\t{$webfilter_acls}\n\t\t\t</table>\n\t\t</td>\n\t</tr>\n\t</table>\n\t<p>&nbsp;</p>\n\t</div>\n\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #2
0
function Interface_SearchUsers($DN)
{
    $page = CurrentPageName();
    $tpl = new templates();
    $tt = time();
    $type = $tpl->javascript_parse_text("{type}");
    $from = $tpl->_ENGINE_parse_body("{from}");
    $to = $tpl->javascript_parse_text("{to}");
    $rule = $tpl->javascript_parse_text("{rule}");
    $delete = $tpl->javascript_parse_text("{delete} {zone} ?");
    $rewrite_rules_fdb_explain = $tpl->javascript_parse_text("{rewrite_rules_fdb_explain}");
    $new_group = $tpl->javascript_parse_text("{new_group}");
    $groupname = $tpl->javascript_parse_text("{members}");
    $privilegesandparameters = $tpl->javascript_parse_text("{privilegesandparameters}");
    $rule = $tpl->javascript_parse_text("{rule}");
    $apply = $tpl->javascript_parse_text("{apply}");
    $action = $tpl->javascript_parse_text("{action}");
    $items = $tpl->javascript_parse_text("{items}");
    $select_this_group = $tpl->javascript_parse_text("{select_this_group}");
    $item_add = $tpl->javascript_parse_text("{item_added}");
    $ad = new external_ad_search();
    $hash = $ad->DNinfos($DN);
    $DN_enc = urlencode($DN);
    $tt = md5($DN);
    $DN_ENC = urlencode($DN);
    if (!isset($_GET["CallBack2"])) {
        $_GET["CallBack2"] = null;
    }
    $description = $hash[0]["description"][0];
    $name = $hash[0]["samaccountname"][0];
    $title = "{$name}<br><span style=font-size:10px;font-style:italic>{$description}</span>";
    $field_user = $_GET["field-user"];
    $fieldtype = $_GET["field-type"];
    $FicheGroup = "Loadjs('domains.edit.group.php?ou=ABC&js=yes&group-id={$DN_enc}&field-type={$_GET["field-type"]}',true)";
    if ($_GET["CallBack2"] != null) {
        $CallBack2 = "{$_GET["CallBack2"]}(base64,Name);";
    }
    $OPENBT = false;
    $DN_enc = urlencode($DN);
    $DN_base64 = base64_encode($DN);
    if ($_GET["field-user"] != null) {
        $OPENBT = true;
        $select = "{name: '{$select_this_group}', bclass: 'Down', onpress : Select{$tt}},";
    }
    $buttons = "\n\tbuttons : [\n\t{name: '{$privilegesandparameters}', bclass: 'Group', onpress : Parameters{$tt}},{$select}\n\t],";
    $html = "\n\t<table class='flexRT{$tt}' style='display: none' id='flexRT{$tt}' style='width:100%'></table>\n\t<script>\n\tfunction Start{$tt}(){\n\t\$('#flexRT{$tt}').flexigrid({\n\turl: '{$page}?users-items=yes&tt={$tt}&DN={$DN_ENC}&field-user={$_GET["field-user"]}',\n\tdataType: 'json',\n\tcolModel : [\n\t{display: '{$groupname}', name : 'groupname', width :382, sortable : false, align: 'left'},\n\t{display: '&nbsp;', name : 'link', width : 31, sortable : false, align: 'center'},\n\t{display: '&nbsp;', name : 'delete', width : 31, sortable : false, align: 'center'},\n\t],\n\t{$buttons}\n\tsearchitems : [\n\t{display: '{$groupname}', name : 'groupname'},\n\t],\n\tsortname: 'groupname',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '{$title}',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '500',\n\theight: 450,\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200]\n\n});\n}\n\nfunction Parameters{$tt}(){\n\t{$FicheGroup}\n}\n\nfunction EditField{$tt}(base64,Name){\n\tvar fieldtype='{$fieldtype}';\n\tvar ADID='{$_GET["ADID"]}';\n\tif(document.getElementById('{$field_user}')){\n\t\tif(fieldtype==2){\n\t\t\tdocument.getElementById('{$field_user}').value='AD:'+ADID+':'+base64;\n\t\t\talert('{$item_add} mode:'+fieldtype+' - '+'`'+Name+'`');\n\t\t\t{$CallBack2}\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif(fieldtype==3){\n\t\t\tdocument.getElementById('{$field_user}').value=Name;\n\t\t\talert('{$item_add} `'+Name+' - '+'`'+Name+'`');\n\t\t\t{$CallBack2}\n\t\t\treturn;\n\t\t}\t\t\n\t\t\n\t\tdocument.getElementById('{$field_user}').value=base64;\n\t\talert('{$item_add} mode:'+fieldtype+' - '+'`'+Name+'`');\n\t\t{$CallBack2}\n\t\t\n\t}\n}\n\nfunction Select{$tt}(){\n\tEditField{$tt}('{$DN_base64}','{$name}');\n}\n\n\nStart{$tt}();\n</script>\n\t\t";
    echo $html;
}