function group_edit_save() { $ID = $_POST["ID"]; $tpl = new templates(); unset($_POST["ID"]); if ($_POST["groupname"] == null) { if ($_POST["localldap"] == 2) { $dndata = $_POST["gpid"]; if (preg_match("#AD:(.*?):(.+)#", $_POST["gpid"], $re)) { $dnEnc = $re[2]; $LDAPID = $re[1]; } $_POST["gpid"] = 0; $_POST["dn"] = $dndata; $ACtiveDir = new ActiveDirectory($LDAPID); $array = $ACtiveDir->ObjectProperty(base64_decode($dnEnc)); $_POST["groupname"] = $array["cn"]; } if ($_POST["localldap"] == 0) { if ($_POST["groupname"] == null) { $gp = new groups($_POST["gpid"]); if ($gp->groupName == null) { echo $tpl->javascript_parse_text("{unable_to_resolve}:Group ID:{$_POST["gpid"]}"); return; } $_POST["groupname"] = $gp->groupName; } } if ($_POST["groupname"] == null) { echo $tpl->javascript_parse_text("{unable_to_resolve}:" . base64_decode($dnEnc)); return; } } if ($_POST["localldap"] == 0) { if (preg_match("#ExtLdap:(.+)#", $_POST["gpid"], $re)) { echo "match\n"; $_POST["dn"] = $_POST["gpid"]; $_POST["gpid"] = 0; } } $q = new mysql_squid_builder(); while (list($num, $ligne) = each($_POST)) { $fieldsAddA[] = "`{$num}`"; $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'"; $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'"; } $sql_edit = "UPDATE webfilter_group SET " . @implode(",", $fieldsEDIT) . " WHERE ID={$ID}"; $sql_add = "INSERT IGNORE INTO webfilter_group (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")"; if ($ID < 0) { $s = $sql_add; } else { $s = $sql_edit; } writelogs($s, __FUNCTION__, __FILE__, __LINE__); $q->QUERY_SQL($s); if (!$q->ok) { echo $q->mysql_error . "\n{$s}\n"; return; } }
function step5() { $allsystems = 0; $final = "<script>\n\t\t\tYahooWin5Hide();\n\t\t\tLoadjs('dansguardian2.compile.php');\n\t\t\tCacheOff();\n\t\t\tLoadAjaxRound('main-ufdb-frontend','ufdbguard.status.php');\n\t\t\t\t\n\t\t</script>"; $tpl = new templates(); $sock = new sockets(); $WizardUFDB = unserialize(base64_decode($sock->GET_INFO("WizardUFDB"))); if ($WizardUFDB["SOURCE_TYPE"] == "ALL") { $allsystems = 1; } $ARRAY[0] = "{block_sexual_websites}"; $ARRAY[1] = "{block_susp_websites}"; $ARRAY[2] = "{block_multi_websites}"; $wizard_Name = strtolower('Wizard - rule ' . $tpl->javascript_parse_text($ARRAY[$WizardUFDB["CATZ"]])); $wizard_Name_tests = addslashes(utf8_encode($wizard_Name)); $q = new mysql_squid_builder(); $sql = "SELECT ID FROM webfilter_rules WHERE `groupname`='{$wizard_Name_tests}'"; $results = $q->QUERY_SQL($sql); $mysql_num_rows = intval(mysql_num_rows($results)); if ($mysql_num_rows > 0) { $wizard_Name = "{$wizard_Name} - " . intval($mysql_num_rows + 1); } $RULES["AllSystems"] = $allsystems; $RULES["ExternalWebPage"] = null; $RULES["UseExternalWebPage"] = 0; $RULES["UseSecurity"] = 0; $RULES["bypass"] = 0; $RULES["enabled"] = 1; $RULES["endofrule"] = 'any'; $RULES["freeweb"] = ''; $RULES["groupmode"] = 1; $RULES["groupname"] = $wizard_Name; $RULES["zOrder"] = 0; $fieldsAddA = array(); $fieldsAddB = array(); while (list($num, $ligne) = each($RULES)) { $fieldsAddA[] = "`{$num}`"; $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'"; $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'"; $DEFAULTARRAY[$num] = $ligne; } $sql_add = "INSERT IGNORE INTO webfilter_rules (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")"; $q->QUERY_SQL($sql_add); if (!$q->ok) { echo $q->mysql_error_html(); return; } $ruleid = $q->last_id; if ($ruleid == 0) { echo "<p class=text-error>Fatal last ID = 0</p>"; return; } $array["malware"] = true; $array["warez"] = true; $array["hacking"] = true; $array["phishing"] = true; $array["spyware"] = true; $array["weapons"] = true; $array["violence"] = true; $array["suspicious"] = true; $array["paytosurf"] = true; $array["sect"] = true; $array["proxy"] = true; $array["gamble"] = true; $array["redirector"] = true; if ($WizardUFDB["CATZ"] == 0) { $array["p**n"] = true; $array["agressive"] = true; $array["dynamic"] = true; $array["alcohol"] = true; $array["astrology"] = true; $array["dangerous_material"] = true; $array["drugs"] = true; $array["hacking"] = true; $array["tattooing"] = true; $array["terrorism"] = true; $array["dating"] = true; $array["mixed_adult"] = true; $array["sex/lingerie"] = true; $array["publicite"] = true; $array["tracker"] = true; $array["marketingware"] = true; $array["mailing"] = true; $array["downloads"] = true; $array["gamble"] = true; } if ($WizardUFDB["CATZ"] == 1) { $array["p**n"] = true; $array["dating"] = true; $array["mixed_adult"] = true; $array["sex/lingerie"] = true; } if ($WizardUFDB["CATZ"] == 2) { $array["publicite"] = true; $array["tracker"] = true; $array["marketingware"] = true; $array["mailing"] = true; } if ($WizardUFDB["CATZ"] == 3) { $array["audio-video"] = true; $array["youtube"] = true; $array["webtv"] = true; $array["music"] = true; $array["movies"] = true; $array["games"] = true; $array["gamble"] = true; $array["socialnet"] = true; $array["webradio"] = true; $array["chat"] = true; $array["webphone"] = true; $array["downloads"] = true; } if (count($array) < 2) { echo "<p class=text-error>No category set</p>\n"; return; } while (list($key, $val) = each($array)) { $q = new mysql_squid_builder(); $q->QUERY_SQL("DELETE FROM webfilter_blks WHERE category='{$key}' AND modeblk=0 AND webfilter_id='{$ruleid}'"); $q->QUERY_SQL("INSERT IGNORE INTO webfilter_blks (webfilter_id,category,modeblk) VALUES ('{$ruleid}','{$key}','0')"); if (!$q->ok) { echo $q->mysql_error_html(); return; } } $q->QUERY_SQL("DELETE FROM webfilter_blks WHERE category='liste_bu' AND modeblk=1 AND webfilter_id='{$ruleid}'"); $q->QUERY_SQL("INSERT IGNORE INTO webfilter_blks (webfilter_id,category,modeblk) VALUES ('{$ruleid}','liste_bu','1')"); if ($allsystems == 1) { echo $final; return; } $GPS["description"] = "Wizard new group for<br>{$wizard_Name}"; $GPS["enabled"] = 1; $GPS["gpid"] = null; $GPS["groupname"] = mysql_escape_string2("Group: {$WizardUFDB["TYPE_VALUE"]}"); if ($WizardUFDB["SOURCE_TYPE"] == "IPADDR") { $GPS["localldap"] = 1; } if ($WizardUFDB["SOURCE_TYPE"] == "AD") { $dndata = $WizardUFDB["TYPE_VALUE"]; if (preg_match("#AD:(.*?):(.+)#", $WizardUFDB["TYPE_VALUE"], $re)) { $dnEnc = $re[2]; $LDAPID = $re[1]; } $GPS["localldap"] = 2; $GPS["gpid"] = 0; $GPS["dn"] = $dndata; $ACtiveDir = new ActiveDirectory($LDAPID); $array = $ACtiveDir->ObjectProperty(base64_decode($dnEnc)); $GPS["groupname"] = $array["cn"]; } $fieldsAddA = array(); $fieldsAddB = array(); $q = new mysql_squid_builder(); while (list($num, $ligne) = each($GPS)) { $fieldsAddA[] = "`{$num}`"; $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'"; $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'"; } $sql_add = "INSERT IGNORE INTO webfilter_group (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")"; $q = new mysql_squid_builder(); $q->QUERY_SQL($sql_add); if (!$q->ok) { echo $q->mysql_error_html(); return; } $gpid = $q->last_id; if ($gpid == 0) { echo "<p class=text-error>Fatal:" . __LINE__ . " last ID = 0</p>"; return; } $md5 = md5("{$ruleid}{$gpid}"); $q->QUERY_SQL("INSERT INTO webfilter_assoc_groups (zMD5,webfilter_id,group_id) VALUES('{$md5}',{$ruleid},{$gpid})"); if (!$q->ok) { echo $q->mysql_error_html(); return; } $PAT["enabled"] = 1; $PAT["groupid"] = $gpid; if ($WizardUFDB["SOURCE_TYPE"] != "IPADDR") { echo $final; return; } $PAT["membertype"] = 1; if (preg_match("#(.+?)\\/(.+)#", $WizardUFDB["TYPE_VALUE"])) { $PAT["membertype"] = 2; } $PAT["pattern"] = $WizardUFDB["TYPE_VALUE"]; $fieldsAddA = array(); $fieldsAddB = array(); $q = new mysql_squid_builder(); while (list($num, $ligne) = each($GPS)) { $fieldsAddA[] = "`{$num}`"; $fieldsAddB[] = "'" . addslashes(utf8_encode($ligne)) . "'"; $fieldsEDIT[] = "`{$num}`='" . addslashes(utf8_encode($ligne)) . "'"; } $sql_add = "INSERT IGNORE INTO webfilter_members (" . @implode(",", $fieldsAddA) . ") VALUES (" . @implode(",", $fieldsAddB) . ")"; $q->QUERY_SQL($sql_add); if (!$q->ok) { echo $q->mysql_error_html(); return; } echo $final; }
function items_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(); $ID = $_GET["ID"]; $FORCE_FILTER = null; $search = '%'; $table = "webfilters_sqitems"; $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']; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE gpid={$ID} {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE gpid={$ID} {$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 gpid={$ID} {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; writelogs($sql, __FUNCTION__, __FILE__, __LINE__); $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("no data"); } while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $disable = Field_checkbox("itemid_{$ligne['ID']}", 1, $ligne["enabled"], "EnableDisableItem('{$ligne['ID']}')"); $macname = $q->MAC_TO_NAME($ligne['pattern']); $ligne['pattern'] = utf8_encode($ligne['pattern']); $delete = imgtootltip("delete-24.png", "{delete} {$ligne['pattern']}", "DeleteGroupItem('{$ligne['ID']}')"); $additional_text = null; if ($macname) { $additional_text = "<div style='font-size:10px'>{$macname}</div>"; } if (preg_match("#AD:(.*?):(.+)#", $ligne["pattern"], $re)) { $dnEnc = $re[2]; $LDAPID = $re[1]; $ad = new ActiveDirectory($LDAPID); $tty = $ad->ObjectProperty(base64_decode($dnEnc)); $entries = $ad->search_users_from_group(base64_decode($dnEnc), 0); $ligne['pattern'] = "Active Directory: " . $tty["cn"] . " - " . count($entries) . " items"; } $data['rows'][] = array('id' => "item{$ligne['ID']}", 'cell' => array("<span style='font-size:13px;font-weight:bold'>{$ligne['pattern']}</span>{$additional_text}", "<div style='padding-top:5px'>{$disable}</div>", $delete)); } echo json_encode($data); }
function groups_list() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $tpl = new templates(); $dump_group_text = $tpl->_ENGINE_parse_body("{dump_group}"); $page = 1; $t = $_GET["t"]; $table = "(SELECT webfilter_assoc_groups.ID,webfilter_assoc_groups.webfilter_id,\n\twebfilter_group.groupname,\n\twebfilter_group.description,\n\twebfilter_group.gpid,\n\twebfilter_group.localldap,\n\twebfilter_group.ID as webfilter_group_ID,\n\twebfilter_group.dn as webfilter_group_dn,\n\twebfilter_group.enabled\n\tFROM webfilter_group,webfilter_assoc_groups \n\tWHERE webfilter_assoc_groups.webfilter_id={$_GET["rule-id"]}\n\tAND webfilter_assoc_groups.group_id=webfilter_group.ID\n\tORDER BY webfilter_group.groupname) as t"; if ($_GET["QuotaID"] > 0) { if (!$q->TABLE_EXISTS("webfilter_assoc_quota_groups")) { $q->CheckTables(null, true); } $table = "(SELECT webfilter_assoc_quota_groups.ID,webfilter_assoc_quota_groups.webfilter_id,\n\t\twebfilter_group.groupname,\n\t\twebfilter_group.description,\n\t\twebfilter_group.gpid,\n\t\twebfilter_group.localldap,\n\t\twebfilter_group.ID as webfilter_group_ID,\n\t\twebfilter_group.dn as webfilter_group_dn,\n\t\twebfilter_group.enabled\n\t\tFROM webfilter_group,webfilter_assoc_quota_groups\n\t\tWHERE webfilter_assoc_quota_groups.webfilter_id={$_GET["QuotaID"]}\n\t\tAND webfilter_assoc_quota_groups.group_id=webfilter_group.ID\n\t\tORDER BY webfilter_group.groupname) as t"; } $searchstring = string_to_flexquery(); if ($searchstring != null) { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { json_error_show($q->mysql_error, 1); } $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM {$table}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { json_error_show($q->mysql_error, 1); } $total = $ligne["TCOUNT"]; } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } $localldap[0] = "{ldap_group}"; $localldap[1] = "{virtual_group}"; $localldap[2] = "{active_directory_group}"; $localldap[3] = "{remote_ladp_group}"; $isDynamic = isDynamic($_GET["rule-id"]); if (isset($_POST['page'])) { $page = $_POST['page']; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (!is_numeric($rp)) { $rp = 50; } $limitSql = "LIMIT {$pageStart}, {$rp}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error, 1); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if ($GLOBALS["VERBOSE"]) { echo "<strong>" . __LINE__ . " </strong><br>\n"; } if (mysql_num_rows($results) == 0) { json_error_show("no data", 1); } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $textExplainGroup = null; $KEY_ID_GROUP = $ligne["webfilter_group_ID"]; $delete = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:UnlinkFilterGroup('{$ligne["ID"]}')\"><img src='img/delete-32.png' style='border:0px'></a>"; $color = "black"; $CountDeMembers = "??"; $Textdynamic = null; if ($GLOBALS["VERBOSE"]) { echo "<strong>" . __LINE__ . " localldap:{$ligne["localldap"]}</strong><br>\n"; } if ($ligne["localldap"] == 0) { $gp = new groups($ligne["gpid"]); $groupadd_text = "(" . $gp->groupName . ")"; $CountDeMembers = count($gp->members); } if ($ligne["localldap"] == 1) { $sql = "SELECT COUNT(ID) as tcount FROM webfilter_members WHERE `groupid`='{$KEY_ID_GROUP}'"; $COUNLIGNE = mysql_fetch_array($q->QUERY_SQL($sql)); $CountDeMembers = $COUNLIGNE["tcount"]; if ($isDynamic) { $color = "#9A9A9A"; $Textdynamic = $tpl->_ENGINE_parse_body("<div style='font-weight:bold;color:#E40F0F'>{ufdb_no_dynamic_group}</div>"); } } if ($GLOBALS["VERBOSE"]) { print_r($ligne); } if ($ligne["enabled"] == 0) { $color = "#9A9A9A"; } if ($ligne["localldap"] == 2) { if (preg_match("#AD:(.*?):(.+)#", $ligne["webfilter_group_dn"], $re)) { $dnEnc = $re[2]; $LDAPID = $re[1]; $ad = new ActiveDirectory($LDAPID); if ($ad->UseDynamicGroupsAcls == 1) { if (preg_match("#^CN=(.+?),.*#i", base64_decode($dnEnc), $re)) { $groupname = _ActiveDirectoryToName($re[1]); $CountDeMembers = '-'; $Debug = " <a href=\"javascript:Loadjs('dansguardian2.explodeadgroup.php?rule-id={$_GET["rule-id"]}&groupid={$KEY_ID_GROUP}');\"\n\t\t\t\t\t\tstyle=\"text-decoration:underline\">{$dump_group_text}</a>"; } } else { $tty = $ad->ObjectProperty(base64_decode($dnEnc)); $CountDeMembers = $tty["MEMBERS"]; } $description = htmlentities($tty["description"]); $description = str_replace("'", "`", $description); if (trim($ligne["description"]) == null) { $ligne["description"] = $description; } } } if ($ligne["localldap"] == 0) { if (preg_match("#^ExtLdap:(.+)#", $ligne["webfilter_group_dn"], $re)) { $CountDeMembers = '-'; $groupadd_text = " {$re[1]}"; } } if ($ligne["localldap"] == 3) { if (preg_match("#ExtLDAP:(.+?):(.+)#", $ligne["groupname"], $re)) { $ligne["groupname"] = $re[1]; } $DN = base64_decode($re[2]); $ldap_ext = new ldap_extern(); $CountDeMembers = $ldap_ext->CountDeUsersByGroupDN($DN); } $imgGP = "win7groups-32.png"; if ($ligne["localldap"] < 2) { $imgGP = "group-32.png"; } if ($Textdynamic != null) { $imgGP = "warning-panneau-32.png"; } $TextGroupType = $tpl->_ENGINE_parse_body($localldap[$ligne["localldap"]]); $jsSelect = "Loadjs('dansguardian2.edit.group.php?ID-js={$KEY_ID_GROUP}&t={$t}&YahooWin=4');"; $data['rows'][] = array('id' => "group{$ligne["ID"]}", 'cell' => array("<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:{$jsSelect}\" \n\t\t\t\tstyle='font-size:22px;text-decoration:underline;color:{$color}'>{$ligne['groupname']}</span></a>\n\t\t\t\t<span style='font-size:22px'>{$groupadd_text}{$Textdynamic}</span><br>\n\t\t\t\t<span style='font-size:18px'>{$textExplainGroup}<i>«{$ligne["description"]} <i>{$TextGroupType}</i>»</i>{$Debug}</span>", "<span style='font-size:22px;color:{$color}'>{$CountDeMembers}</span>", "<center>{$delete}</center>")); } echo json_encode($data); }
function groups_list() { $search = $_POST["query"]; $search = "*{$search}*"; $search = str_replace("**", "*", $search); $search = str_replace("**", "*", $search); $search = str_replace("*", "%", $search); $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_squid_builder(); $tpl = new templates(); $dump_group_text = $tpl->_ENGINE_parse_body("{dump_group}"); $page = 1; $t = $_GET["t"]; $sqlCount = "SELECT COUNT(*) as tcount,webfilter_assoc_groups.ID,webfilter_assoc_groups.webfilter_id,\n\twebfilter_group.groupname,\n\twebfilter_group.description,\n\twebfilter_group.gpid,\n\twebfilter_group.localldap,\n\twebfilter_group.ID as webfilter_group_ID,\n\twebfilter_group.dn as webfilter_group_dn,\n\twebfilter_group.enabled \n\tFROM webfilter_group,webfilter_assoc_groups WHERE ((webfilter_group.groupname LIKE '{$search}' AND webfilter_assoc_groups.webfilter_id={$_GET["rule-id"]}) \n\tOR (webfilter_group.description LIKE '{$search}' AND webfilter_assoc_groups.webfilter_id={$_GET["rule-id"]}))\n\tAND webfilter_assoc_groups.group_id=webfilter_group.ID"; $COUNLIGNE = mysql_fetch_array($q->QUERY_SQL($sqlCount, "artica_backup")); if (!$q->ok) { writelogs($q->mysql_error, __FUNCTION__, __FILE__, __LINE__); } if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } $localldap[0] = "{ldap_group}"; $localldap[1] = "{virtual_group}"; $localldap[2] = "{active_directory_group}"; $isDynamic = isDynamic($_GET["rule-id"]); if (isset($_POST['page'])) { $page = $_POST['page']; } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (!is_numeric($rp)) { $rp = 50; } $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT webfilter_assoc_groups.ID,webfilter_assoc_groups.webfilter_id,\n\twebfilter_group.groupname,\n\twebfilter_group.description,\n\twebfilter_group.gpid,\n\twebfilter_group.localldap,\n\twebfilter_group.ID as webfilter_group_ID,\n\twebfilter_group.dn as webfilter_group_dn,\n\twebfilter_group.enabled \n\tFROM webfilter_group,webfilter_assoc_groups WHERE ((webfilter_group.groupname LIKE '{$search}' AND webfilter_assoc_groups.webfilter_id={$_GET["rule-id"]}) \n\tOR (webfilter_group.description LIKE '{$search}' AND webfilter_assoc_groups.webfilter_id={$_GET["rule-id"]}))\n\tAND webfilter_assoc_groups.group_id=webfilter_group.ID\t\n\tORDER BY webfilter_group.groupname {$_POST["sortorder"]} {$limitSql}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { echo "<H2>{$q->mysql_error}</H2><code style='font-size:11px'>{$sql}</code>"; } writelogs("search:{$search} webfilter_id={$_GET["rule-id"]} countline:{$COUNLIGNE["tcount"]}", __FUNCTION__, __FILE__, __LINE__); $data = array(); $data['page'] = $page; $data['total'] = $COUNLIGNE["tcount"]; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("no data"); } while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) { $textExplainGroup = null; $KEY_ID_GROUP = $ligne["webfilter_group_ID"]; $delete = "<a href=\"javascript:blur();\" OnClick=\"javascript:UnlinkFilterGroup('{$ligne["ID"]}')\"><img src='img/delete-24.png' style='border:0px'></a>"; $color = "black"; $CountDeMembers = "??"; $Textdynamic = null; if ($ligne["localldap"] == 0) { $gp = new groups($ligne["gpid"]); $groupadd_text = "(" . $gp->groupName . ")"; $CountDeMembers = count($gp->members); } if ($ligne["localldap"] == 1) { $sql = "SELECT COUNT(ID) as tcount FROM webfilter_members WHERE `groupid`='{$KEY_ID_GROUP}'"; $COUNLIGNE = mysql_fetch_array($q->QUERY_SQL($sql)); $CountDeMembers = $COUNLIGNE["tcount"]; if ($isDynamic) { $color = "#9A9A9A"; $Textdynamic = $tpl->_ENGINE_parse_body("<div style='font-weight:bold;color:#E40F0F'>{ufdb_no_dynamic_group}</div>"); } } if ($GLOBALS["VERBOSE"]) { print_r($ligne); } if ($ligne["enabled"] == 0) { $color = "#9A9A9A"; } if ($ligne["localldap"] == 2) { if (preg_match("#AD:(.*?):(.+)#", $ligne["webfilter_group_dn"], $re)) { $dnEnc = $re[2]; $LDAPID = $re[1]; $ad = new ActiveDirectory($LDAPID); if ($ad->UseDynamicGroupsAcls == 1) { if (preg_match("#^CN=(.+?),.*#i", base64_decode($dnEnc), $re)) { $groupname = _ActiveDirectoryToName($re[1]); $CountDeMembers = '-'; $Debug = " <a href=\"javascript:Loadjs('dansguardian2.explodeadgroup.php?rule-id={$_GET["rule-id"]}');\"\n\t\t\t\t\tstyle=\"text-decoration:underline\">{$dump_group_text}</a>"; } } else { $tty = $ad->ObjectProperty(base64_decode($dnEnc)); $CountDeMembers = $tty["MEMBERS"]; } $description = htmlentities($tty["description"]); $description = str_replace("'", "`", $description); if (trim($ligne["description"]) == null) { $ligne["description"] = $description; } } } if ($ligne["localldap"] == 0) { if (preg_match("#^ExtLdap:(.+)#", $ligne["webfilter_group_dn"], $re)) { $CountDeMembers = '-'; $groupadd_text = " {$re[1]}"; } } $imgGP = "win7groups-32.png"; if ($ligne["localldap"] < 2) { $imgGP = "group-32.png"; } if ($Textdynamic != null) { $imgGP = "warning-panneau-32.png"; } $TextGroupType = $tpl->_ENGINE_parse_body($localldap[$ligne["localldap"]]); $jsSelect = "YahooWin4('712','dansguardian2.edit.group.php?ID={$KEY_ID_GROUP}&t={$t}&YahooWin=4','{$KEY_ID_GROUP}::{$ligne['groupname']}');"; $data['rows'][] = array('id' => "group{$ligne["ID"]}", 'cell' => array("<img src='img/{$imgGP}'>", "<a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:{$jsSelect}\" \n\t\t\t\tstyle='font-size:16px;text-decoration:underline;color:{$color}'>{$ligne['groupname']}</span></a>{$groupadd_text}{$Textdynamic}<div style='font-size:10px'>{$textExplainGroup}<i>«{$ligne["description"]} <i>{$TextGroupType}</i>»</i>{$Debug}", "<span style='font-size:16px;color:{$color}'>{$CountDeMembers}</span>", $delete)); } echo json_encode($data); }