function users_list()
{
    $tpl = new templates();
    $CurPage = CurrentPageName();
    $search = $_POST["query"];
    $t = $_GET["t"];
    $ad = new external_ad_search($_GET["ConnectionEnc"]);
    if (!is_numeric($_GET["OnlyUsers"])) {
        $_GET["OnlyUsers"] = 0;
    }
    $icon = "user-32.png";
    if ($_GET["OnlyGroups"] == 1) {
        $OnlyGroups = 1;
        $icon = "win7groups-32.png";
        $Array = $ad->flexRTGroups($search, $_POST["rp"]);
        if ($ad->error != null) {
            json_error_show($ad->error, 1);
        }
    }
    if ($_GET["OnlyUsers"] == 1) {
        $OnlyGroups = 0;
        $icon = "win7groups-32.png";
        $Array = $ad->flexRTUsers($search, $_POST["rp"]);
        if ($ad->error != null) {
            json_error_show($ad->error, 1);
        }
    }
    if (count($Array) == 0) {
        json_error_show("No item", 1);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($Array);
    $data['rows'] = array();
    $members = $tpl->_ENGINE_parse_body("{members}");
    while (list($dn, $itemname) = each($Array)) {
        $GroupxSourceName = $itemname;
        $GroupxName = $itemname;
        $GroupxName = replace_accents($GroupxName);
        $GroupxName = str_replace("'", "`", $itemname);
        $link = "<span style='font-size:14px;'>";
        $addtitile = null;
        $select = null;
        $dn_enc = base64_encode($dn);
        $itemnameenc = base64_encode($itemname);
        $image = imgsimple($icon, null, "PutDN{$t}('{$dn_enc}')");
        $select = imgsimple("arrow-right-24.png", null, "PutDN{$t}('{$dn_enc}')");
        if ($_GET["CallBack"] != null) {
            $select = imgsimple("arrow-right-24.png", null, "YahooSearchUserHide();{$_GET["CallBack"]}('{$dn_enc}','{$itemnameenc}')");
            $image = imgsimple($icon, null, "YahooSearchUserHide();{$_GET["CallBack"]}('{$dn_enc}','{$itemnameenc}')");
        }
        $md5 = md5($dn);
        $data['rows'][] = array('id' => $md5, 'cell' => array($image, "<span style='font-size:14px;'>{$link}{$GroupxName}</a>", $select));
    }
    echo json_encode($data);
}
Esempio n. 2
0
function popup_search()
{
    $icon = "win7groups-32.png";
    $ad = new external_ad_search();
    if ($_POST["query"] == null) {
        $_POST["query"] = "*";
    }
    if (strpos(" {$_POST["query"]}", "*") == 0) {
        $_POST["query"] = "*{$_POST["query"]}*";
    }
    $_POST["query"] = str_replace("**", "*", $_POST["query"]);
    $_POST["query"] = str_replace("**", "*", $_POST["query"]);
    $Array = $ad->flexRTGroups($_POST["query"], $_POST["rp"]);
    if ($ad->error != null) {
        json_error_show($ad->error, 1);
    }
    if (count($Array) == 0) {
        json_error_show("No item", 1);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($Array);
    $data['rows'] = array();
    while (list($dn, $itemname) = each($Array)) {
        $GroupxSourceName = $itemname;
        $GroupxName = $itemname;
        $GroupxName = replace_accents($GroupxName);
        $GroupxName = str_replace("'", "`", $itemname);
        $addtitile = null;
        $select = null;
        $dn_enc = base64_encode($dn);
        $DN_base64 = base64_encode($dn);
        $itemnameenc = base64_encode($itemname);
        $CountDeUsers = $ad->CountDeUsersByGroupDN($dn);
        $link = null;
        $js = "EditField{$_GET["t"]}('{$DN_base64}','{$GroupxSourceName}');";
        $image = imgsimple($icon, null, $js);
        $select = imgsimple("arrow-right-32.png", null, $js);
        if ($CountDeUsers > 0) {
            $link = "<a href=\"javascript:Loadjs('browse-ad-users-dn.php?DN={$DN_base64}')\"\n\t\t\tstyle='text-decoration:underline'>";
        }
        $md5 = md5($dn);
        $data['rows'][] = array('id' => $md5, 'cell' => array("<center>{$image}</center>", "<span style='font-size:20px;'>{$link}{$GroupxName}</a></span>", "<center style='font-size:20px;'>{$CountDeUsers}</center>", "<center>{$select}</center>"));
    }
    echo json_encode($data);
}