function group_list() { //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string',''); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $RULEID = $_GET["RULEID"]; $FORCE_FILTER = null; $search = '%'; $table = "webfilters_sqgroups"; $page = 1; if ($q->COUNT_ROWS($table) == 0) { json_error_show("No data"); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } if ($_POST["query"] != null) { $_POST["query"] = str_replace("*", "%", $_POST["query"]); $search = $_POST["query"]; $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')"; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error); } if (mysql_num_rows($results) == 0) { json_error_show("no data"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $GroupType = $q->acl_GroupType; $GroupType["src"] = "{addr}"; $GroupType["arp"] = "{ComputerMacAddress}"; $GroupType["dstdomain"] = "{dstdomain}"; $GroupType["proxy_auth"] = "{members}"; $GroupType["port"] = "{remote_ports}"; $GroupType["maxconn"] = "{max_connections}"; $font_size = "15px"; $delet_img = "delete-24.png"; if (isset($_GET["as-big"])) { $font_size = "26px;"; $delet_img = "delete-42.png"; } while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $ligne2['tcount'] = 0; $disable = Field_checkbox("groupid_{$ligne['ID']}", 1, $ligne["enabled"], "EnableDisableGroup('{$ligne['ID']}')"); $ligne['GroupName'] = utf8_encode($ligne['GroupName']); $GroupTypeText = $tpl->_ENGINE_parse_body($GroupType[$ligne["GroupType"]]); $delete = imgsimple($delet_img, null, "DeleteSquidAclGroup('{$ligne['ID']}')"); if ($ligne["GroupType"] == "proxy_auth_ads") { $p = new external_ad_search(); $ligne2['tcount'] = $p->CountDeUsersByGroupName($ligne['GroupName']); } if ($ligne["GroupType"] == "proxy_auth_statad") { $p = new external_ad_search(); $ligne2['tcount'] = $p->CountDeUsersByGroupName($ligne['GroupName']); } if ($ligne["GroupType"] == "proxy_auth_ldap") { $p = new ldap_extern(); preg_match("#^ExtLDAP:(.+?):(.+)#", $ligne['GroupName'], $re); $ligne['GroupName'] = $re[1]; $DN = base64_decode($re[2]); $ligne2['tcount'] = $p->CountDeUsersByGroupDN($DN); } if ($ligne2['tcount'] == 0) { $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(ID) as tcount FROM webfilters_sqitems WHERE gpid='{$ligne['ID']}'")); } if ($ligne["GroupType"] == "all") { $ligne2['tcount'] = "*"; } $CountOfRules = 0; $ligne3 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(webfilters_sqacls.ID) as tcount FROM webfilters_sqacllinks,webfilters_sqacls WHERE webfilters_sqacllinks.gpid='{$ligne['ID']}' AND webfilters_sqacllinks.aclid=webfilters_sqacls.ID")); $CountOfRules = $ligne3["tcount"]; if ($CountOfRules > 0) { $CountOfRules = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.acls.groups.rules.php?ID={$ligne['ID']}');\" style='font-size:{$font_size};text-decoration:underline'>{$CountOfRules}</a>"; } $data['rows'][] = array('id' => "group{$ligne['ID']}", 'cell' => array("<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?AddGroup-js=yes&ID={$ligne['ID']}');\" \n\t\tstyle='font-size:{$font_size};text-decoration:underline'>{$ligne['GroupName']}</span>", "<span style='font-size:{$font_size};'>{$GroupTypeText}</span>", "<center style='font-size:{$font_size};'>{$ligne2['tcount']}</center>", "<center style='font-size:{$font_size};'>{$CountOfRules}</center>", "<center>{$disable}</center>", "<center>{$delete}</center>")); } echo json_encode($data); }