function quota_destination_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"]; $acl = new squid_acls(); $t0 = $_GET["t"]; $search = '%'; $table = "(SELECT webfilters_quotas_grp.gpid,webfilters_quotas_grp.zmd5, webfilters_quotas_grp.ID as LINKID, webfilters_sqgroups.* FROM webfilters_quotas_grp, webfilters_sqgroups WHERE webfilters_quotas_grp.gpid=webfilters_sqgroups.ID AND webfilters_quotas_grp.ruleid={$ID}) as t"; $page = 1; if (!$q->TABLE_EXISTS("webfilters_quotas_grp")) { $q->CheckTables(null, true); } if ($q->COUNT_ROWS("webfilters_quotas_grp") == 0) { json_error_show("No datas"); } 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 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} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if (!$q->ok) { json_error_show($q->mysql_error . "\n{$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No item"); } $rules = $tpl->_ENGINE_parse_body("{rules}"); $acl = new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $ID = $ligne["ID"]; $md5 = $ligne["zmd5"]; $arrayF = $acl->FlexArray($ligne['gpid']); $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks{$t0}('{$md5}')"); $data['rows'][] = array('id' => "{$md5}", 'cell' => array($arrayF["ROW"], "<span style='font-size:14px;font-weight:bold'>{$arrayF["ITEMS"]}</span>", $delete)); } echo json_encode($data); }
function rules_whitelisted_search(){ //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(); $acl=new squid_acls(); $ID=$_GET["ID"]; $t0=$_GET["t"]; $t=$_GET["tt"]; $linked_table="wpad_white_link"; $search='%'; $table="(SELECT $linked_table.gpid, $linked_table.negation, $linked_table.zmd5 as mkey, webfilters_sqgroups.* FROM $linked_table,webfilters_sqgroups WHERE $linked_table.gpid=webfilters_sqgroups.ID AND $linked_table.aclid=$ID) as t"; $page=1; if($q->COUNT_ROWS($linked_table)==0){json_error_show("No datas");} 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 1 $searchstring"; $ligne=mysql_fetch_array($q->QUERY_SQL($sql)); $total = $ligne["TCOUNT"]; }else{ $sql="SELECT COUNT(*) as TCOUNT FROM $table"; $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 $ORDER $limitSql"; $results = $q->QUERY_SQL($sql); if(!$q->ok){json_error_show($q->mysql_error."\n$sql");} $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if(mysql_num_rows($results)==0){json_error_show($q->mysql_error);} $rules=$tpl->_ENGINE_parse_body("{rules}"); $acl=new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $val=0; $mkey=$ligne["mkey"]; $arrayF=$acl->FlexArray($ligne['ID']); $delete=imgsimple("delete-24.png",null,"DeleteObjectLinks$t('$mkey')"); $negation=Field_checkbox("negation-$mkey", 1,$ligne["negation"],"ChangeNegation$t('$mkey')"); $data['rows'][] = array( 'id' => "$mkey", 'cell' => array($arrayF["ROW"], $negation,"<span style='font-size:14px;font-weight:bold'>{$arrayF["ITEMS"]}</span>", $delete) ); } echo json_encode($data); }
function groups($ID) { $q = new mysql_squid_builder(); if ($q->COUNT_ROWS("transparent_networks_groups") == 0) { return array(null, null); } $sql = "SELECT transparent_networks_groups.gpid,\n\ttransparent_networks_groups.zmd5 as mkey,\n\twebfilters_sqgroups.* FROM transparent_networks_groups,webfilters_sqgroups\n\tWHERE transparent_networks_groups.gpid=webfilters_sqgroups.ID \n\tAND transparent_networks_groups.ruleid={$ID}\n\tAND webfilters_sqgroups.enabled=1\n\tAND transparent_networks_groups.enabled=1\n\t"; $results = $q->QUERY_SQL($sql); $acl = new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $arrayF = $acl->FlexArray($ligne['ID']); $GroupType = $ligne["GroupType"]; if ($GroupType == "dst") { $f1[] = $arrayF["ROW"]; continue; } if ($GroupType == "port") { $f1[] = $arrayF["ROW"]; continue; } $f[] = $arrayF["ROW"]; } return array(@implode($f, "\n"), @implode($f1, "\n")); }
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["aclid"]; $t0 = $_GET["t"]; $rp = 50; $search = '%'; $table = "(SELECT meta_webfilters_sqacllinks.gpid,\n\t\tmeta_webfilters_sqacllinks.ID as tid,\n\t\tmeta_webfilters_sqacllinks.negation,\n\t\tmeta_webfilters_sqacllinks.zorder,\n\t\twebfilters_sqgroups.* FROM meta_webfilters_sqacllinks,webfilters_sqgroups\n\t\tWHERE meta_webfilters_sqacllinks.gpid=webfilters_sqgroups.ID AND meta_webfilters_sqacllinks.aclid={$ID}\n\t\tORDER BY meta_webfilters_sqacllinks.zorder\n\t\t) as t"; $page = 1; if ($q->COUNT_ROWS("meta_webfilters_sqacllinks") == 0) { json_error_show("No datas meta_webfilters_sqacllinks Empty"); } 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 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql)); if (!$q->ok) { json_error_show($q->mysql_error . "\n{$sql}"); } $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 . "\n{$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} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); if ($GLOBALS["VERBOSE"]) { echo "{$sql}<br>\n"; } if (!$q->ok) { json_error_show($q->mysql_error . "\n{$sql}"); } $acl = new squid_acls_groups(); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); $CountofRows = mysql_num_rows($results); if ($GLOBALS["VERBOSE"]) { echo "CountofRows = {$CountofRows}<br>\n"; } if ($CountofRows == 0) { json_error_show("No data"); } $rules = $tpl->_ENGINE_parse_body("{rules}"); while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $mkey = $ligne["tid"]; $arrayF = $acl->FlexArray($ligne['ID']); $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks('{$mkey}')"); $negation = Field_checkbox("negation-{$mkey}", 1, $ligne["negation"], "ChangeMetaNegation('{$mkey}')"); $up = imgsimple("arrow-up-16.png", "", "AclGroupUpDown('{$mkey}',0)"); $down = imgsimple("arrow-down-18.png", "", "AclGroupUpDown('{$mkey}',1)"); if ($ligne["torder"] == 1) { $up = null; } if ($ligne["torder"] == 0) { $up = null; } $data['rows'][] = array('id' => "{$mkey}", 'cell' => array($ligne["torder"], $arrayF["ROW"], "<center>{$negation}</center>", "<span style='font-size:14px;font-weight:bold'>{$arrayF["ITEMS"]}</span>", $up, $down, $delete)); } echo json_encode($data); }
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(); $ID = $_GET["aclid"]; $aclid = $_GET["aclid"]; $acl = new squid_acls(); $t0 = $_GET["t"]; $database = "artica_backup"; $search = '%'; $table = "ext_time_quota_acl_link"; $FORCE_FILTER = null; $page = 1; if ($q->COUNT_ROWS($table, $database) == 0) { json_error_show("No datas"); } $table = "(SELECT * FROM ext_time_quota_acl_link WHERE ruleid={$aclid}) as t"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } 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 * FROM {$table} WHERE 1 {$FORCE_FILTER} {$ORDER} {$limitSql}"; if ($GLOBALS["VERBOSE"]) { echo $sql . "<br>\n"; } $results = $q->QUERY_SQL($sql, $database); $total = mysql_num_rows($results); if (!$q->ok) { json_error_show($q->mysql_error . "\n{$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show("No item"); } $rules = $tpl->_ENGINE_parse_body("{rules}"); $q2 = new mysql_squid_builder(); $acl = new squid_acls_groups(); if ($_POST["qtype"] == "GroupName") { if ($_POST["query"] != null) { $searchGroupName = string_to_flexregex(); } } while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $mkey = $ligne["zmd5"]; $color = "black"; if ($ligne["enabled"] == 0) { $color = "#8a8a8a"; } $arrayF = $acl->FlexArray($ligne["groupid"], $ligne["enabled"]); $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks{$t0}('{$mkey}')"); $enable = Field_checkbox("enable-{$mkey}", 1, $ligne["enabled"], "ChangeEnabled{$t0}('{$mkey}')"); $data['rows'][] = array('id' => "{$mkey}", 'cell' => array($arrayF["ROW"], "<span style='font-size:14px;font-weight:bold;color:{$color}'>{$arrayF["ITEMS"]}</span>", $enable, $delete)); } echo json_encode($data); }
function GetGroupsList($ID) { $q = new mysql(); $tpl = new templates(); $sql = "SELECT groupid FROM ext_time_quota_acl_link WHERE ruleid='{$ID}' AND enabled=1"; $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { return $q->mysql_error; } $acl = new squid_acls_groups(); $f = array(); while ($ligne = mysql_fetch_assoc($results)) { $arrayF = $acl->FlexArray($ligne["groupid"], 1, 10); $f[] = "<div style='font-size:9px;margin-left:15px'>{$arrayF["ROW"]} ({$arrayF["ITEMS"]} " . $tpl->_ENGINE_parse_body('{items}') . ")</div>"; } return @implode("\n", $f); }
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["aclid"]; $acl = new squid_acls(); $t0 = $_GET["t"]; $FORCE_FILTER = null; $search = '%'; $table = "(SELECT firewallfilter_sqacllinks.gpid,firewallfilter_sqacllinks.negation,\n\tfirewallfilter_sqacllinks.zOrder,firewallfilter_sqacllinks.zmd5 as mkey,\n\twebfilters_sqgroups.* FROM firewallfilter_sqacllinks,webfilters_sqgroups \n\tWHERE firewallfilter_sqacllinks.gpid=webfilters_sqgroups.ID \n\tAND firewallfilter_sqacllinks.aclid={$ID}\n\tAND firewallfilter_sqacllinks.direction='{$_GET["direction"]}'\n\tORDER BY firewallfilter_sqacllinks.zOrder\n\t) as t"; $page = 1; if ($q->COUNT_ROWS("firewallfilter_sqacllinks") == 0) { json_error_show("No datas"); } 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 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}"; if ($OnlyEnabled) { $limitSql = null; } $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 . "\n{$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (mysql_num_rows($results) == 0) { json_error_show($q->mysql_error); } $rules = $tpl->_ENGINE_parse_body("{rules}"); $acl = new squid_acls_groups(); while ($ligne = mysql_fetch_assoc($results)) { $val = 0; $mkey = $ligne["mkey"]; $arrayF = $acl->FlexArray($ligne['ID'], 1, 18); $delete = imgsimple("delete-32.png", null, "DeleteObjectLinks('{$mkey}')"); $negation = Field_checkbox("negation-{$mkey}", 1, $ligne["negation"], "ChangeNegation('{$mkey}')"); $up = imgsimple("arrow-up-32.png", "", "AclGroupUpDown('{$mkey}',0)"); $down = imgsimple("arrow-down-32.png", "", "AclGroupUpDown('{$mkey}',1)"); if ($ligne["zOrder"] == 1) { $up = null; } if ($ligne["zOrder"] == 0) { $up = null; } $data['rows'][] = array('id' => "{$mkey}", 'cell' => array("<center style='font-size:18px;font-weight:bold'>{$ligne["zOrder"]}</center>", $arrayF["ROW"], $negation, "<span style='font-size:18px;font-weight:bold'>{$arrayF["ITEMS"]}</span>", "<center>{$up}</center>", "<center>{$down}</center>", "<center>{$delete}</center>")); } echo json_encode($data); }