function l7apps_items() { $tpl = new templates(); $MyPage = CurrentPageName(); $q = new mysql_builder(); $q->CheckTables_qos(); $database = "artica_backup"; $q = new mysql(); $t = $_GET["t"]; $search = '%'; $table = "l7filters_items"; $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) { $search = $_POST["query"]; $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "{$database}")); $total = $ligne["TCOUNT"]; } else { $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; } 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 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, $database); $data = array(); $data['page'] = $page; $data['total'] = $total + 1; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error, 1); } if (mysql_num_rows($results) == 0) { json_error_show("????"); return; } if ($searchstring == null) { $data['total'] = $data['total'] + $array[0]; $data['rows'] = $array[1]["rows"]; } $fontsize = 14; $LEVEL[0] = "ok24.png"; $LEVEL[1] = "24-blue.png"; $LEVEL[2] = "warning24.png"; $LEVEL[3] = "24-red.png"; $LEVEL[4] = "ok24-grey.png"; $ENABLEDI[0] = "ok32-grey.png"; $ENABLEDI[1] = "ok32.png"; while ($ligne = mysql_fetch_assoc($results)) { $color = "black"; $lsprime = "javascript:Loadjs('{$MyPage}?enable-js=yes&ID={$ligne["ID"]}')"; $enabled = $ligne["enabled"]; $icon = "ok24.png"; if ($enabled == 0) { $icon = "ok24-grey.png"; $color = "#8a8a8a"; } $nic = new system_nic($ligne["eth"]); if ($nic->QOS == 0) { $icon = "ok24-grey.png"; $color = "#8a8a8a"; } $QOSMAX = intval($ligne["QOSMAX"]); if ($QOSMAX < 10) { $QOSMAX = 100; } $style = "style='font-size:{$fontsize}px;color:{$color};'"; $js = "<a href=\"javascript:blur();\" OnClick=\"{$lsprime};\"\n\t\t\tstyle='font-size:{$fontsize}px;color:{$color};text-decoration:underline'>"; $ligne["name"] = utf8_encode($ligne["name"]); $icon = $LEVEL[$ligne["level"]]; $icon_enabled = $ENABLEDI[$ligne["enabled"]]; $ligne["keyitem"] = strtoupper($ligne["keyitem"]); $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span {$style}>{$ligne["ID"]}</a></span>", "<span {$style}><img src='img/{$icon}'></a></span>", "<span {$style}><span style='font-size:16px'>{$ligne["keyitem"]}</span></a></span>", "<span {$style}>{$ligne["explain"]}</a></span>", "<span {$style}>{$js}<img src='img/{$icon_enabled}'></a></span>")); } echo json_encode($data); }
function qos_containers_save() { 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', ''); $ID = $_POST["ID"]; unset($_POST["ID"]); $_POST["name"] = replace_accents($_POST["name"]); $table = "qos_containers"; while (list($key, $value) = each($_POST)) { $fields[] = "`{$key}`"; $values[] = "'" . mysql_escape_string2($value) . "'"; $edit[] = "`{$key}`='" . mysql_escape_string2($value) . "'"; } $eth = $_POST["eth"]; if ($ID > 0) { $sql = "UPDATE {$table} SET " . @implode(",", $edit) . " WHERE ID='{$ID}'"; } else { $sql = "INSERT IGNORE INTO {$table} (" . @implode(",", $fields) . ") VALUES (" . @implode(",", $values) . ")"; } $q = new mysql_builder(); $q->CheckTables_qos(); $q = new mysql(); $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo $q->mysql_error; return; } $results = $q->QUERY_SQL("SELECT ID FROM qos_containers ORDER by prio AND eth='{$eth}'", "artica_backup"); if (!$q->ok) { echo "Line:" . __LINE__ . ":" . $q->mysql_error; } $c = 1; while ($ligne = mysql_fetch_assoc($results)) { $ID = $ligne["ID"]; $sql = "UPDATE qos_containers SET prio={$c} WHERE ID='{$ID}'"; $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "Line:" . __LINE__ . ":{$sql}\n" . $q->mysql_error; } $c++; } }