function items() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_shorewall(); $t = $_GET["t"]; $search = '%'; $table = "fw_providers"; $page = 1; $FORCE_FILTER = null; $total = 0; 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 { $total = $q->COUNT_ROWS($table); } if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; if (is_numeric($rp)) { $limitSql = "LIMIT {$pageStart}, {$rp}"; } $sql = "SELECT * FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql); $no_rule = $tpl->_ENGINE_parse_body("{no_rule}"); $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error . "<br>{$sql}", 1); } if (mysql_num_rows($results) == 0) { json_error_show("no data", 1); } $fontsize = "16"; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $options_text = null; $delete = imgsimple("delete-32.png", null, "Delete{$t}('{$ligne["ID"]}')"); $ip = new system_nic($ligne["INTERFACE"]); $interface = "{$ip->NICNAME} - " . $ligne["INTERFACE"]; $linkInterface = $q->JS_INTERFACE($ligne["INTERFACE"]); $linkprovider = $q->JS_PROVIDER($ligne["ID"]); $options = array(); if ($ligne["track"] == 1) { $options[] = $tpl->_ENGINE_parse_body("{routing_track}"); } if ($ligne["tproxy"] == 1) { $options[] = $tpl->_ENGINE_parse_body("{routing_tproxy}"); } if ($ligne["fallback"] > -1) { $options[] = $tpl->_ENGINE_parse_body("{fallback}"); } if ($ligne["balance"] > -1) { $options[] = $tpl->_ENGINE_parse_body("{balance}"); } if (count($options) > 0) { $options_text = "<br><i style='font-size:12px'>" . @implode(", ", $options) . "</i>"; } $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$linkprovider}{$ligne["NAME"]}</a></span>{$options_text}", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$linkprovider}{$ligne["DUPLICATE"]}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$linkInterface}{$interface}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$linkprovider}{$ligne["GATEWAY"]}</a></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>")); } echo json_encode($data); }