本文整理汇总了PHP中table::db_data_translate方法的典型用法代码示例。如果您正苦于以下问题:PHP table::db_data_translate方法的具体用法?PHP table::db_data_translate怎么用?PHP table::db_data_translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类table
的用法示例。
在下文中一共展示了table::db_data_translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: table
function table_services()
{
global $construct, $db, $lang;
$form_search_services = $this->form_search_services();
$where = $form_search_services->db_data_where();
$table_services = new table(array('TABLE_NAME' => 'table_services', 'FORM_NAME' => 'table_services'));
$table_services->db_data('services.title, nodes.name AS nodes__name, nodes.id AS nodes__id, ip_addresses.ip, nodes_services.url, nodes_services.info, nodes_services.date_in, nodes_services.status, IFNULL(nodes_services.protocol, services.protocol) AS protocol, IFNULL(nodes_services.port, services.port) AS port', 'nodes_services
LEFT JOIN nodes on nodes_services.node_id = nodes.id
LEFT JOIN services on nodes_services.service_id = services.id
LEFT JOIN ip_addresses ON ip_addresses.id = nodes_services.ip_id', $where, '', "nodes_services.date_in DESC");
$table_services->db_data_search($form_search_services);
foreach ((array) $table_services->data as $key => $value) {
if ($key != 0) {
if ($table_services->data[$key]['ip']) {
$table_services->data[$key]['ip'] = long2ip($table_services->data[$key]['ip']);
if ($table_services->data[$key]['protocol'] && $table_services->data[$key]['port']) {
$table_services->data[$key]['ip'] .= ' (' . $lang['db']['nodes_services__protocol-' . $table_services->data[$key]['protocol']] . '/' . $table_services->data[$key]['port'] . ')';
}
}
$table_services->data[$key]['nodes__name'] .= " (#" . $table_services->data[$key]['nodes__id'] . ")";
$table_services->info['LINK']['nodes__name'][$key] = make_ref('/nodes', array("node" => $table_services->data[$key]['nodes__id']));
$table_services->info['LINK']['services__title'][$key] = htmlspecialchars($table_services->data[$key]['url']);
}
}
$table_services->db_data_translate('nodes_services__status');
$table_services->db_data_remove('nodes__id', 'nodes_services__id', 'url', 'protocol', 'port');
return $table_services;
}
示例2: substr
function table_dns()
{
global $construct, $db, $vars;
$form_search_dns = $this->form_search_dns();
if (substr($form_search_dns->data[1]['value'], -strlen("." . $vars['dns']['root_zone'])) == "." . $vars['dns']['root_zone']) {
$form_search_dns->data[1]['value'] = substr($form_search_dns->data[1]['value'], 0, -strlen("." . $vars['dns']['root_zone']));
}
$where = $form_search_dns->db_data_where(array("dns_zones__name" => "starts_with"));
$table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns'));
$table_dns->db_data('dns_zones.id AS dns_zones__id, dns_zones.name AS dns_zones__name, dns_zones.type, dns_zones.date_in, dns_zones.status, nodes.name AS nodes__name, nodes.id AS nodes__id', 'dns_zones
LEFT JOIN nodes ON dns_zones.node_id = nodes.id', $where, "", "dns_zones.status ASC, dns_zones.type ASC, dns_zones.name ASC");
$table_dns->db_data_search($form_search_dns);
for ($i = 1; $i < count($table_dns->data); $i++) {
if (isset($table_dns->data[$i])) {
$table_dns->data[$i]['nodes__name'] .= " (#" . $table_dns->data[$i]['nodes__id'] . ")";
if ($table_dns->data[$i]['type'] == 'forward') {
$table_dns->data[$i]['dns_zones__name'] .= "." . $vars['dns']['root_zone'];
}
$table_dns->info['EDIT'][$i] = make_ref('/nodes', array("node" => $table_dns->data[$i]['nodes__id']));
}
}
$table_dns->info['EDIT_COLUMN'] = 'nodes__name';
$table_dns->db_data_remove('dns_zones__id', 'type', 'nodes__id');
$table_dns->db_data_translate('dns_zones__status');
return $table_dns;
}
示例3: table
function table_services()
{
global $construct, $db, $main, $lang;
$form_search_services_edit = $this->form_search_services_edit();
$where = $form_search_services_edit->db_data_where();
$table_services = new table(array('TABLE_NAME' => 'table_services', 'FORM_NAME' => 'table_services'));
$table_services->db_data('services.title, nodes_services.id, nodes.name, nodes.id AS nodes__id, ip_addresses.ip, nodes_services.date_in, nodes_services.info, nodes_services.status, IFNULL(nodes_services.protocol, services.protocol) AS protocol, IFNULL(nodes_services.port, services.port) AS port', 'nodes_services
LEFT JOIN nodes on nodes_services.node_id = nodes.id
LEFT JOIN services on nodes_services.service_id = services.id
LEFT JOIN ip_addresses ON ip_addresses.id = nodes_services.ip_id', $where, '', "nodes_services.date_in DESC");
$table_services->db_data_search($form_search_services_edit);
foreach ((array) $table_services->data as $key => $value) {
if ($key != 0) {
if ($table_services->data[$key]['ip']) {
$table_services->data[$key]['ip'] = long2ip($table_services->data[$key]['ip']);
if ($table_services->data[$key]['protocol'] && $table_services->data[$key]['port']) {
$table_services->data[$key]['ip'] .= ' (' . $lang['db']['nodes_services__protocol-' . $table_services->data[$key]['protocol']] . '/' . $table_services->data[$key]['port'] . ')';
}
}
$table_services->data[$key]['name'] .= " (#" . $table_services->data[$key]['nodes__id'] . ")";
$table_services->info['EDIT'][$key] = make_ref('/node_editor/services', array("node" => $table_services->data[$key]['nodes__id'], "service" => $table_services->data[$key]['id']));
}
}
$table_services->info['EDIT_COLUMN'] = 'title';
$table_services->db_data_translate('nodes_services__status');
$table_services->db_data_multichoice('nodes_services', 'id');
$table_services->info['MULTICHOICE_LABEL'] = 'delete';
$table_services->db_data_remove('id', 'nodes__id', 'protocol', 'port');
return $table_services;
}
示例4: table
function table_ip_ranges()
{
global $construct, $db;
$form_search_ranges = $this->form_search_ranges();
$where = $form_search_ranges->db_data_where(array('ip' => 'exclude'));
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$s_ip = $form_search_ranges->data[0]['value'];
$where = $where != '' ? "(" . $where . ") AND " : "";
if ($s_ip != '') {
$where .= '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 1)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 1)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 2)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 2)) . ") OR " . '(ip_ranges.ip_start >= ' . ip2long(correct_ip_min($s_ip, TRUE, 3)) . ' AND ip_ranges.ip_start <= ' . ip2long(correct_ip_max($s_ip, TRUE, 3)) . ") AND ";
}
//$where =
// ($s_ip !=''?"ip_ranges.ip_start <= ".ip2long($s_ip)." AND ip_ranges.ip_end >= ".ip2long($s_ip)." AND ":"");
if ($where != '') {
$where = substr($where, 0, -5);
}
#@#
$table_ip_ranges->db_data('"" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.date_in, ip_ranges.status, nodes.name AS nodes__name, nodes.id AS nodes__id, communities.name AS communities__name', 'ip_ranges
LEFT JOIN nodes ON ip_ranges.node_id = nodes.id
LEFT JOIN communities ON nodes.community_id = communities.id', $where != '' ? "(" . $where . ")" : "", "", "ip_ranges.status ASC, ip_ranges.ip_start ASC");
#@#
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
$table_ip_ranges->data[$key]['nodes__name'] .= " (#" . $table_ip_ranges->data[$key]['nodes__id'] . ")";
$table_ip_ranges->info['EDIT'][$key] = makelink(array("page" => "nodes", "node" => $table_ip_ranges->data[$key]['nodes__id']));
}
}
$table_ip_ranges->info['EDIT_COLUMN'] = 'nodes__name';
$table_ip_ranges->db_data_remove('ip_start', 'ip_end', 'nodes__id');
$table_ip_ranges->db_data_translate('ip_ranges__status');
return $table_ip_ranges;
}
示例5: table
function table_services()
{
global $construct, $db, $main;
$table_services = new table(array('TABLE_NAME' => 'table_services', 'FORM_NAME' => 'table_services'));
$table_services->db_data('services.id, services.title, services.protocol, services.port', 'services', '', '', "services.title ASC");
foreach ((array) $table_services->data as $key => $value) {
if ($key != 0) {
$table_services->info['EDIT'][$key] = make_ref('/admin/services', array("service" => $table_services->data[$key]['id']));
}
}
$table_services->info['EDIT_COLUMN'] = 'title';
$table_services->db_data_translate('services__protocol');
$table_services->db_data_multichoice('services', 'id');
$table_services->info['MULTICHOICE_LABEL'] = 'delete';
$table_services->db_data_remove('id');
return $table_services;
}
示例6: table
function table_dns()
{
global $construct, $db, $vars;
$form_search_dns = $this->form_search_dns();
$where = $form_search_dns->db_data_where(array("dns_zones__name" => "starts_with", 'nodes__name' => 'starts_with'));
$table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns'));
$table_dns->db_data('dns_zones.id, dns_zones.name, dns_zones.type, dns_zones.date_in, dns_zones.status, dns_zones.delete_req', 'dns_zones ' . 'LEFT JOIN nodes ON dns_zones.node_id = nodes.id', $where, "", "dns_zones.date_in DESC, dns_zones.status ASC");
$table_dns->db_data_multichoice('dns_zones', 'id');
for ($i = 1; $i < count($table_dns->data); $i++) {
if (isset($table_dns->data[$i])) {
if ($table_dns->data[$i]['type'] == 'forward') {
$table_dns->data[$i]['name'] .= "." . $vars['dns']['root_zone'];
}
$table_dns->info['EDIT'][$i] = makelink(array("page" => "hostmaster", "subpage" => "dnszone", "zone" => $table_dns->data[$i]['id']));
}
}
$table_dns->info['EDIT_COLUMN'] = 'name';
$table_dns->info['MULTICHOICE_LABEL'] = 'delete';
$table_dns->db_data_remove('id', 'type');
$table_dns->db_data_translate('dns_zones__status', 'dns_zones__delete_req');
return $table_dns;
}
示例7: unserialize
function table_nameservers()
{
global $construct, $db, $vars;
if (isset($_POST['dns_nameservers__ip']) && $_POST['dns_nameservers__ip'] != '') {
$_POST['dns_nameservers__ip'] = ip2long($_POST['dns_nameservers__ip']);
}
if (isset($_GET['form_search_nameservers_search']) && $_GET['form_search_nameservers_search'] != '') {
$t = unserialize(stripslashes($_GET['form_search_nameservers_search']));
if (isset($t['dns_nameservers__ip']) && $t['dns_nameservers__ip'] != '') {
$t['dns_nameservers__ip'] = ip2long($t['dns_nameservers__ip']);
}
$_GET['form_search_nameservers_search'] = addslashes(serialize($t));
}
$form_search_nameservers = $this->form_search_nameservers();
$where = $form_search_nameservers->db_data_where(array('nodes__name' => 'starts_with'));
$table_nameservers = new table(array('TABLE_NAME' => 'table_nameservers', 'FORM_NAME' => 'table_nameservers'));
$table_nameservers->db_data('dns_nameservers.id, dns_nameservers.name,communities.name AS communities__name, nodes.name_ns, dns_nameservers.ip, communities.dnstld , dns_nameservers.date_in, dns_nameservers.status, dns_nameservers.delete_req', 'dns_nameservers
LEFT JOIN nodes ON dns_nameservers.node_id = nodes.id
LEFT JOIN communities ON nodes.community_id = communities.id ', $where, "", "dns_nameservers.date_in DESC, dns_nameservers.status ASC");
$table_nameservers->db_data_search($form_search_nameservers);
foreach ((array) $table_nameservers->data as $key => $value) {
if ($key != 0) {
$table_nameservers->data[$key]['ip'] = long2ip($table_nameservers->data[$key]['ip']);
$table_nameservers->data[$key]['name'] = strtolower(($table_nameservers->data[$key]['name'] != '' ? $table_nameservers->data[$key]['name'] . "." : "") . $table_nameservers->data[$key]['name_ns'] . "." . $table_nameservers->data[$key]['dnstld'] . "." . $vars['dns']['ns_zone']);
}
}
$table_nameservers->db_data_multichoice('dns_nameservers', 'id');
for ($i = 1; $i < count($table_nameservers->data); $i++) {
if (isset($table_nameservers->data[$i])) {
$table_nameservers->info['EDIT'][$i] = makelink(array("page" => "hostmaster", "subpage" => "dnsnameserver", "nameserver" => $table_nameservers->data[$i]['id']));
}
}
$table_nameservers->info['EDIT_COLUMN'] = 'name';
$table_nameservers->info['MULTICHOICE_LABEL'] = 'delete';
$table_nameservers->db_data_remove('id', 'name_ns');
$table_nameservers->db_data_translate('dns_nameservers__status', 'dns_nameservers__delete_req');
return $table_nameservers;
}
示例8: table
function table_ip_ranges()
{
global $construct, $db;
$form_search_ranges = $this->form_search_ranges();
$where = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'nodes__name' => 'starts_with'));
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$s_ip = correct_ip($form_search_ranges->data[0]['value']);
$where = ($where != '' ? "(" . $where . ") AND " : "") . ($s_ip != '' ? "ip_ranges.ip_start <= " . ip2long($s_ip) . " AND ip_ranges.ip_end >= " . ip2long($s_ip) . " AND " : "");
if ($where != '') {
$where = substr($where, 0, -5);
}
$table_ip_ranges->db_data('ip_ranges.id, "" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, communities.name AS communities__name,ip_ranges.date_in, ip_ranges.status, ip_ranges.delete_req', 'ip_ranges ' . 'LEFT JOIN nodes ON ip_ranges.node_id = nodes.id ' . 'LEFT JOIN communities ON nodes.community_id = communities.id ', $where, "", "ip_ranges.date_in DESC, ip_ranges.status ASC");
// .($this->is_cadmin()?'':', ip_ranges.delete_req'),
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
}
}
if (!$this->is_cadmin()) {
$table_ip_ranges->db_data_multichoice('ip_ranges', 'id');
}
for ($i = 1; $i < count($table_ip_ranges->data); $i++) {
if (isset($table_ip_ranges->data[$i])) {
$table_ip_ranges->info['EDIT'][$i] = makelink(array("page" => "hostmaster", "subpage" => "range", "iprange" => $table_ip_ranges->data[$i]['id']));
}
}
$table_ip_ranges->info['EDIT_COLUMN'] = 'ip_range';
if (!$this->is_cadmin()) {
$table_ip_ranges->info['MULTICHOICE_LABEL'] = 'delete';
}
$table_ip_ranges->db_data_remove('id', 'ip_start', 'ip_end');
$table_ip_ranges->db_data_translate('ip_ranges__status', 'ip_ranges__delete_req');
return $table_ip_ranges;
}
示例9: table
function table_ip_ranges_v6()
{
global $construct, $db, $lang;
$form_search_ranges_v6 = $this->form_search_ranges_v6();
$table_ip_ranges_v6 = new table(array('TABLE_NAME' => 'table_ip_ranges_v6', 'FORM_NAME' => 'table_ip_ranges_v6'));
$table_ip_ranges_v6->db_data('ipv6_node_repos.v6net AS v6net, ip_ranges_v6.id AS v6net_id, ip_ranges_v6.date_in, ip_ranges_v6.status, ip_ranges_v6.delete_req', 'ip_ranges_v6, ipv6_node_repos ', 'ipv6_node_repos.id = ip_ranges_v6.v6net_id', "ip_ranges_v6.id", "ip_ranges_v6.date_in DESC, ip_ranges_v6.status ASC");
$table_ip_ranges_v6->db_data_search($form_search_ranges_v6);
foreach ((array) $table_ip_ranges_v6->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges_v6->data[$key]['v6net'] = inet_ntop($table_ip_ranges_v6->data[$key]['v6net']);
}
}
$table_ip_ranges_v6->db_data_multichoice('ip_ranges_v6', 'v6net_id');
for ($i = 1; $i < count($table_ip_ranges_v6->data); $i++) {
if (isset($table_ip_ranges_v6->data[$i])) {
$table_ip_ranges_v6->info['EDIT'][$i] = make_ref('/hostmaster/range_v6', array("v6net_id" => $table_ip_ranges_v6->data[$i]['v6net_id']));
}
}
$table_ip_ranges_v6->info['EDIT_COLUMN'] = 'v6net';
$table_ip_ranges_v6->info['MULTICHOICE_LABEL'] = 'delete';
$table_ip_ranges_v6->db_data_remove('v6net_id');
$table_ip_ranges_v6->db_data_translate('ip_ranges_v6__status', 'ip_ranges_v6__delete_req');
return $table_ip_ranges_v6;
}
示例10: table
function table_dns()
{
global $db, $vars;
$table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns'));
$table_dns->db_data('dns_zones.id, dns_zones.name, dns_zones.date_in, dns_zones.status, dns_zones.delete_req, dns_zones.type', 'dns_zones ' . 'LEFT JOIN dns_zones AS t_dns_zones ON t_dns_zones.node_id = dns_zones.node_id', 't_dns_zones.id = ' . get('zone'), "", "dns_zones.type ASC, dns_zones.date_in ASC");
for ($i = 1; $i < count($table_dns->data); $i++) {
if (isset($table_dns->data[$i])) {
if ($table_dns->data[$i]['type'] == 'forward') {
$table_dns->data[$i]['name'] .= "." . $vars['dns']['root_zone'];
}
$table_dns->info['EDIT'][$i] = makelink(array("page" => "hostmaster", "subpage" => "dnszone", "zone" => $table_dns->data[$i]['id'], "node" => intval(get('node'))));
}
}
$table_dns->info['EDIT_COLUMN'] = 'name';
$table_dns->db_data_remove('id', 'delete_req', 'type');
$table_dns->db_data_translate('dns_zones__status');
return $table_dns;
}
示例11: table
function table_ip_ranges()
{
global $db;
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$table_ip_ranges->db_data('"" AS ip_range, ip_ranges.ip_start, ip_ranges.ip_end, ip_ranges.date_in, ip_ranges.status', 'ip_ranges ' . 'LEFT JOIN ip_ranges AS t_ip_ranges ON t_ip_ranges.node_id = ip_ranges.node_id', "t_ip_ranges.id = '" . get('iprange') . "'", "", "ip_ranges.date_in ASC");
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
}
}
$table_ip_ranges->db_data_remove('ip_start', 'ip_end');
$table_ip_ranges->db_data_translate('ip_ranges__status');
return $table_ip_ranges;
}
示例12: table
function table_services()
{
global $construct, $db, $main;
$table_services = new table(array('TABLE_NAME' => 'table_services', 'FORM_NAME' => 'table_services'));
$table_services->db_data('services.title, nodes_services.id, nodes.id AS nodes__id, ip_addresses.ip, nodes_services.url, nodes_services.info, nodes_services.status, nodes_services.date_in', 'nodes_services
LEFT JOIN nodes on nodes_services.node_id = nodes.id
LEFT JOIN services on nodes_services.service_id = services.id
LEFT JOIN ip_addresses ON ip_addresses.id = nodes_services.ip_id', "nodes_services.node_id = '" . get('node') . "'", '', "nodes_services.date_in ASC");
foreach ((array) $table_services->data as $key => $value) {
if ($key != 0) {
if ($table_services->data[$key]['ip']) {
$table_services->data[$key]['ip'] = long2ip($table_services->data[$key]['ip']);
}
$table_services->info['EDIT'][$key] = makelink(array("page" => "mynodes", "subpage" => "services", "node" => intval(get('node')), "service" => $table_services->data[$key]['id']));
}
}
$table_services->info['EDIT_COLUMN'] = 'title';
$table_services->db_data_translate('nodes_services__status');
$table_services->db_data_multichoice('nodes_services', 'id');
$table_services->info['MULTICHOICE_LABEL'] = 'delete';
$table_services->db_data_remove('id', 'nodes__id');
return $table_services;
}
示例13: table
function table_ip_ranges_v6()
{
global $construct, $db, $lang;
$form_search_ranges_v6 = $this->form_search_ranges_v6();
$table_ip_ranges_v6 = new table(array('TABLE_NAME' => 'table_ip_ranges_v6', 'FORM_NAME' => 'table_ip_ranges_v6'));
$table_ip_ranges_v6->db_data('ipv6_node_repos.v6net AS v6net, ip_ranges_v6.id AS v6net_id, ip_ranges_v6.date_in, ip_ranges_v6.status, ip_ranges_v6.delete_req', 'ip_ranges_v6, ipv6_node_repos ', 'ipv6_node_repos.id = ip_ranges_v6.v6net_id', "ip_ranges_v6.id", "ip_ranges_v6.date_in DESC, ip_ranges_v6.status ASC");
$table_ip_ranges_v6->db_data_search($form_search_ranges_v6);
foreach ((array) $table_ip_ranges_v6->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges_v6->data[$key]['v6net'] = inet_ntop($table_ip_ranges_v6->data[$key]['v6net']);
}
}
$table_ip_ranges_v6->db_data_remove('v6net_id');
$table_ip_ranges_v6->db_data_translate('ip_ranges_v6__status', 'ip_ranges_v6__delete_req');
return $table_ip_ranges_v6;
}
示例14: table
function table_ip_ranges()
{
global $construct, $db, $lang;
$form_search_ranges = $this->form_search_ranges();
$where = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'nodes__name' => 'starts_with', "total_active_p2p" => 'exclude', "total_active_aps" => 'exclude'));
$table_ip_ranges = new table(array('TABLE_NAME' => 'table_ip_ranges', 'FORM_NAME' => 'table_ip_ranges'));
$where = $where != '' ? "(" . $where . ") AND " : "";
if ($form_search_ranges->data[0]['value'] != '') {
$where .= "(";
$s_ranges = ip_to_ranges($form_search_ranges->data[0]['value']);
foreach ($s_ranges as $s_range) {
$where .= "(ip_ranges.ip_start BETWEEN " . ip2long($s_range['min']) . " AND " . ip2long($s_range['max']) . ") OR ";
}
$where = substr($where, 0, -4) . ") AND ";
}
if ($where != '') {
$where = substr($where, 0, -5);
}
$having = $form_search_ranges->db_data_where(array('ip' => 'exclude', 'ip_ranges__status' => 'exclude', 'ip_ranges__delete_req' => 'exclude', 'nodes__id' => 'exclude', 'nodes__name' => 'exclude'));
$table_ip_ranges->db_data('ip_ranges.id,
"" AS ip_range,
ip_ranges.ip_start,
ip_ranges.ip_end,
ip_ranges.date_in,
ip_ranges.status,
ip_ranges.delete_req,
COUNT(DISTINCT p2p.id) AS total_active_p2p,
COUNT(DISTINCT aps.id) AS total_active_aps,
"" AS total_active_peers', 'ip_ranges ' . 'LEFT JOIN nodes ON ip_ranges.node_id = nodes.id
LEFT JOIN links ON ip_ranges.node_id = links.node_id AND links.status = "active"
LEFT JOIN links AS p2p ON links.type = "p2p"
AND links.peer_node_id = p2p.node_id
AND p2p.type = "p2p"
AND p2p.peer_node_id = links.node_id
AND p2p.status = "active"
LEFT JOIN links as aps ON links.type = "ap"
AND links.id = aps.id', $where, "ip_ranges.id" . ($having != '' ? ' HAVING (' . $having . ')' : ""), "ip_ranges.date_in DESC, ip_ranges.status ASC");
$table_ip_ranges->db_data_search($form_search_ranges);
foreach ((array) $table_ip_ranges->data as $key => $value) {
if ($key != 0) {
$table_ip_ranges->data[$key]['ip_start'] = long2ip($table_ip_ranges->data[$key]['ip_start']);
$table_ip_ranges->data[$key]['ip_end'] = long2ip($table_ip_ranges->data[$key]['ip_end']);
$table_ip_ranges->data[$key]['ip_range'] = $table_ip_ranges->data[$key]['ip_start'] . " - " . $table_ip_ranges->data[$key]['ip_end'];
}
}
$table_ip_ranges->db_data_multichoice('ip_ranges', 'id');
for ($i = 1; $i < count($table_ip_ranges->data); $i++) {
if (isset($table_ip_ranges->data[$i])) {
$table_ip_ranges->data[$i]['total_active_peers'] = ($table_ip_ranges->data[$i]['total_active_p2p'] > 0 ? $table_ip_ranges->data[$i]['total_active_p2p'] . " " . $lang['backbones_abbr'] : "") . ($table_ip_ranges->data[$i]['total_active_aps'] > 0 ? " + " . $table_ip_ranges->data[$i]['total_active_aps'] . " " . $lang['aps_abbr'] : "");
$table_ip_ranges->info['EDIT'][$i] = make_ref('/hostmaster/range', array("iprange" => $table_ip_ranges->data[$i]['id']));
}
}
$table_ip_ranges->info['EDIT_COLUMN'] = 'ip_range';
$table_ip_ranges->info['MULTICHOICE_LABEL'] = 'delete';
$table_ip_ranges->db_data_remove('id', 'ip_start', 'ip_end', 'total_active_p2p', 'total_active_aps');
$table_ip_ranges->db_data_translate('ip_ranges__status', 'ip_ranges__delete_req');
return $table_ip_ranges;
}
示例15: table
function table_dns()
{
global $db, $vars;
$table_dns = new table(array('TABLE_NAME' => 'table_dns', 'FORM_NAME' => 'table_dns'));
$table_dns->db_data('dns_zones.id, dns_zones.name, dns_zones.date_in, dns_zones.status, dns_zones.type', 'dns_zones ' . 'INNER JOIN dns_zones_nameservers ON dns_zones_nameservers.zone_id = dns_zones.id', 'dns_zones_nameservers.nameserver_id = ' . get('nameserver'), "", "dns_zones.type ASC, dns_zones.date_in ASC");
for ($i = 1; $i < count($table_dns->data); $i++) {
if (isset($table_dns->data[$i])) {
if ($table_dns->data[$i]['type'] == 'forward') {
$table_dns->data[$i]['name'] .= "." . $vars['dns']['root_zone'];
}
$table_dns->info['EDIT'][$i] = make_ref('/hostmaster/dnszone', array("zone" => $table_dns->data[$i]['id']));
}
}
$table_dns->info['EDIT_COLUMN'] = 'name';
$table_dns->db_data_remove('id', 'type');
$table_dns->db_data_translate('dns_zones__status');
return $table_dns;
}