예제 #1
1
 function form_subnet()
 {
     global $db, $vars, $lang;
     $form_subnet = new form(array('FORM_NAME' => 'form_subnet'));
     $form_subnet->db_data('subnets.ip_start, subnets.ip_end, subnets.type, subnets.link_id, subnets.client_node_id');
     $links = $db->get('links.id AS value, links.type, links.ssid, nodes.name, links.peer_node_id, "" AS output', "links\n\t\t\t\t\t\t\tLEFT JOIN nodes ON links.peer_node_id = nodes.id", "(links.type = 'ap' OR links.type = 'p2p') AND node_id = " . intval(get('node')), "", "links.type ASC, links.date_in ASC");
     foreach ((array) $links as $key => $value) {
         $links[$key]['output'] .= $lang['db']['links__type-' . $value['type']] . ' - ';
         if ($value['type'] == 'ap') {
             $links[$key]['output'] .= $links[$key]['ssid'];
         }
         if ($value['type'] == 'p2p') {
             $links[$key]['output'] .= $links[$key]['name'] . ' (#' . $links[$key]['peer_node_id'] . ')';
         }
     }
     $form_subnet->db_data_enum('subnets.link_id', $links);
     $clients = $db->get('cl_n.id AS value, ap_l.ssid, cl_n.name, cl_n.id, "" AS output', "links AS cl_l " . "LEFT JOIN links AS ap_l ON cl_l.peer_ap_id = ap_l.id\n\t\t\t\t\t\t\tLEFT JOIN nodes AS ap_n ON ap_l.node_id = ap_n.id " . "LEFT JOIN nodes AS cl_n ON cl_l.node_id = cl_n.id", "cl_l.type = 'client' AND ap_l.type = 'ap' AND ap_l.node_id = " . intval(get('node')), "", "ap_l.date_in ASC, cl_l.date_in ASC");
     foreach ((array) $clients as $key => $value) {
         $clients[$key]['output'] = '[' . $lang['db']['links__type-ap'] . ' ' . $clients[$key]['ssid'] . '] - ' . $clients[$key]['name'] . ' (#' . $clients[$key]['id'] . ')';
     }
     $form_subnet->db_data_enum('subnets.client_node_id', $clients);
     $form_subnet->db_data_values("subnets", "id", get('subnet'));
     if (get('subnet') != 'add') {
         $form_subnet->data[0]['value'] = long2ip($form_subnet->data[0]['value']);
         $form_subnet->data[1]['value'] = long2ip($form_subnet->data[1]['value']);
     }
     return $form_subnet;
 }
예제 #2
0
 function form_search_links_ap()
 {
     global $db;
     $form_search_links_ap = new form(array('FORM_NAME' => 'form_search_links_ap'));
     $form_search_links_ap->db_data('links.ssid, nodes.id, nodes.name, areas.id, regions.id');
     $form_search_links_ap->db_data_enum('areas.id', $db->get("id AS value, name AS output", "areas"));
     $form_search_links_ap->db_data_enum('regions.id', $db->get("id AS value, name AS output", "regions"));
     $form_search_links_ap->db_data_search();
     return $form_search_links_ap;
 }
예제 #3
0
 function form_search_nameservers()
 {
     global $db;
     $form_search_nameservers = new form(array('FORM_NAME' => 'form_search_nameservers'));
     $form_search_nameservers->db_data('nodes.id, nodes.name, areas.id, regions.id');
     $form_search_nameservers->db_data_enum('areas.id', $db->get("id AS value, name AS output", "areas"));
     $form_search_nameservers->db_data_enum('regions.id', $db->get("id AS value, name AS output", "regions"));
     $form_search_nameservers->db_data_search();
     return $form_search_nameservers;
 }
예제 #4
0
 function form_search_nodes()
 {
     global $db;
     $form_search_nodes = new form(array('FORM_NAME' => 'form_search_nodes'));
     $form_search_nodes->db_data('nodes.id, nodes.name, areas.id, regions.id, communities.name');
     $form_search_nodes->db_data_enum('areas.id', $db->get("id AS value, name AS output", "areas"));
     $form_search_nodes->db_data_enum('regions.id', $db->get("id AS value, name AS output", "regions"));
     $form_search_nodes->db_data_enum('communities.name', $db->get("name AS value, fullname AS output", "communities"));
     #@#
     $form_search_nodes->db_data_search();
     return $form_search_nodes;
 }
예제 #5
0
 function form_search_nodes()
 {
     global $db, $lang;
     $form_search_nodes = new form(array('FORM_NAME' => 'form_search_nodes'));
     $form_search_nodes->db_data('nodes.id, nodes.name, areas.id, regions.id');
     $form_search_nodes->db_data_enum('areas.id', $db->get("id AS value, name AS output", "areas"));
     $form_search_nodes->db_data_enum('regions.id', $db->get("id AS value, name AS output", "regions"));
     array_push($form_search_nodes->data, array('Compare' => 'numeric', 'Field' => 'total_active_peers', 'fullField' => 'total_active_peers'));
     array_push($form_search_nodes->data, array('Compare' => 'numeric', 'Field' => 'total_active_clients', 'fullField' => 'total_active_clients'));
     array_push($form_search_nodes->data, array('Field' => 'has_ap', 'fullField' => 'has_ap', 'Type' => 'enum', 'Type_Enums' => array(array('value' => 'Y', 'output' => $lang['yes']), array('value' => 'N', 'output' => $lang['no']))));
     $form_search_nodes->db_data_search();
     return $form_search_nodes;
 }
예제 #6
0
 function form_search_services_edit()
 {
     global $db;
     $form_search_services_edit = new form(array('FORM_NAME' => 'form_search_services_edit'));
     $form_search_services_edit->db_data('nodes_services.service_id, nodes.id, nodes.name');
     $form_search_services_edit->db_data_enum('nodes_services.service_id', $db->get("id AS value, title AS output", "services", "", "", "title ASC"));
     $form_search_services_edit->db_data_search();
     return $form_search_services_edit;
 }
예제 #7
0
 function form_services()
 {
     global $db, $vars;
     $form_services = new form(array('FORM_NAME' => 'form_services'));
     $form_services->db_data('nodes_services.service_id, nodes_services.id, nodes_services.node_id, nodes.id AS nodes__id, nodes_services.ip_id, nodes_services.url, nodes_services.info, nodes_services.status, nodes_services.protocol, nodes_services.port', 'nodes_services', '', '', "");
     $form_services->db_data_enum('nodes_services.service_id', $db->get("id AS value, title AS output", "services", "", "", "title ASC"));
     $ips = $db->get("ip_addresses.id AS value, ip_addresses.hostname AS hostname, ip_addresses.ip AS ip", "ip_addresses " . "INNER JOIN subnets ON subnets.node_id = ip_addresses.node_id AND ip_addresses.ip <= subnets.ip_end AND ip_addresses.ip >= subnets.ip_start", "ip_addresses.node_id = " . intval(get('node')) . " AND subnets.type = 'local'", "subnets.ip_start ASC, ip_addresses.ip ASC");
     foreach ((array) $ips as $key => $value) {
         $ips[$key]['output'] = $ips[$key]['hostname'] . " [" . long2ip($ips[$key]['ip']) . "]";
     }
     $form_services->db_data_enum('nodes_services.ip_id', $ips);
     $form_services->db_data_values("nodes_services", "id", get('service'));
     if (get('service') != 'add') {
         $form_services->db_data_pickup('nodes_services.node_id', "nodes", $db->get("nodes_services.node_id AS value, CONCAT(nodes.name, ' (#', nodes.id, ')') AS output", "nodes_services, nodes", "nodes_services.node_id = nodes.id AND nodes_services.id = " . get("service")));
     } else {
         $form_services->db_data_pickup('nodes_services.node_id', "nodes", $db->get("nodes.id AS value, CONCAT(nodes.name, ' (#', nodes.id, ')') AS output", "nodes", "nodes.id = " . get("node")));
     }
     $form_services->db_data_remove('nodes_services__id');
     return $form_services;
 }
예제 #8
0
 function form_search_ranges()
 {
     global $construct, $db;
     $form_search_ranges = new form(array('FORM_NAME' => 'form_search_ranges'));
     $form_search_ranges->data = array("0" => array("Field" => "ip", "fullField" => "ip"));
     $form_search_ranges->db_data('ip_ranges.status, ip_ranges.delete_req, nodes.id, nodes.name, communities.name');
     #@#
     $form_search_ranges->db_data_enum('communities.name', $db->get("name AS value, fullname AS output", "communities"));
     #@#
     $form_search_ranges->db_data_search();
     return $form_search_ranges;
 }
 function form_search_nameservers()
 {
     global $db;
     $form_search_nameservers = new form(array('FORM_NAME' => 'form_search_nameservers'));
     $form_search_nameservers->data = array("0" => array("Field" => "ip", "fullField" => "dns_nameservers__ip"));
     $form_search_nameservers->db_data('dns_nameservers.status, dns_nameservers.delete_req, nodes.id, nodes.name, communities.name');
     #@#
     $form_search_nameservers->db_data_enum('communities.name', $db->get("name AS value, fullname AS output", "communities"));
     #@#
     $form_search_nameservers->db_data_search();
     return $form_search_nameservers;
 }
예제 #10
0
 function form_area()
 {
     global $db, $vars;
     $form_area = new form(array('FORM_NAME' => 'form_area'));
     $form_area->db_data('areas.id, areas.region_id, areas.name, areas.ip_start, areas.ip_end, areas.info');
     $form_area->db_data_enum('areas.region_id', $db->get("id AS value, name AS output", "regions"));
     $form_area->db_data_values("areas", "id", get('area'));
     if (get('area') != 'add') {
         $form_area->data[3]['value'] = long2ip($form_area->data[3]['value']);
         $form_area->data[4]['value'] = long2ip($form_area->data[4]['value']);
     }
     $form_area->db_data_remove('areas__id');
     return $form_area;
 }
예제 #11
0
 function form_zone()
 {
     global $construct, $db, $vars;
     $form_zone = new form(array('FORM_NAME' => 'form_zone'));
     $form_zone->db_data((get('zone') == 'add' ? 'dns_zones.name, dns_zones.info, ' : '') . 'dns_zones_nameservers.nameserver_id');
     if (get('zone') == 'add') {
         if (get('type') == 'reverse') {
             $ipr = $db->get("ip_start, ip_end", "ip_ranges", "node_id = " . intval(get('node')));
             foreach ((array) $ipr as $key => $value) {
                 $ipr[$key]['ip_start'] = long2ip($value['ip_start']);
                 $ipr[$key]['ip_end'] = long2ip($value['ip_end']);
                 $ipr[$key]['value'] = reverse_zone_from_ip($ipr[$key]['ip_start']);
                 $ipr[$key]['output'] = $ipr[$key]['value'] . " [" . $ipr[$key]['ip_start'] . ' - ' . $ipr[$key]['ip_end'] . "]";
             }
             $form_zone->db_data_enum('dns_zones.name', $ipr);
         } else {
             $form_zone->data[0]['value'] = $db->get('name_ns', 'nodes', "id = " . intval(get('node')));
             $form_zone->data[0]['value'] = $form_zone->data[0]['value'][0]['name_ns'];
             $form_zone->data[0]['value'] .= "." . $vars['dns']['root_zone'];
         }
     }
     $form_zone->db_data_pickup("dns_zones_nameservers.nameserver_id", "dns_nameservers", $db->get('dns_nameservers.id AS value, ' . 'CONCAT(dns_nameservers.name, ".", nodes.name_ns, ".", "' . $vars['dns']['ns_zone'] . '") AS output', "dns_zones_nameservers, dns_nameservers, nodes", "dns_nameservers.node_id = nodes.id AND dns_nameservers.id = dns_zones_nameservers.nameserver_id AND dns_zones_nameservers.zone_id = '" . get('zone') . "'", "", "dns_zones_nameservers.id ASC"), TRUE);
     return $form_zone;
 }
예제 #12
0
파일: node_editor.php 프로젝트: skyfyl/wind
 function form_node()
 {
     global $db, $main;
     $form_node = new form(array('FORM_NAME' => 'form_node'));
     $form_node->db_data('nodes.name, nodes.area_id, nodes.latitude, nodes.longitude, nodes.elevation, nodes.status, nodes.due_date, nodes.info' . ($this->has_owner_access() || get('node') == 'add' ? ', users_nodes.user_id, users_nodes.user_id' : ''));
     if ($this->has_owner_access() || get('node') == 'add') {
         $form_node->data[8]['Field'] = 'user_id_owner';
         $form_node->data[8]['fullField'] = 'user_id_owner';
         if (get('node') == 'add') {
             $temp = $db->get("users.id AS value, users.username AS output", "users", "users.id = '" . $main->userdata->user . "'");
         } else {
             $temp = $db->get("users.id AS value, users.username AS output", "users_nodes, users", "users.id = users_nodes.user_id AND users_nodes.node_id = " . intval(get('node')) . " AND users_nodes.owner = 'Y'");
         }
         $form_node->db_data_pickup("user_id_owner", "users", $temp);
         $form_node->db_data_pickup("users_nodes.user_id", "users", $db->get("users.id AS value, users.username AS output", "users_nodes, users", "users.id = users_nodes.user_id AND users_nodes.node_id = " . intval(get('node')) . " AND users_nodes.owner != 'Y'"), TRUE);
         $form_node->data[9]['Null'] = 'YES';
     }
     if ($main->userdata->privileges['admin'] === true) {
         $form_node->db_data('nodes.id, nodes.name_ns');
     }
     $form_node->db_data_enum('nodes.area_id', $db->get("id AS value, name AS output", "areas", "", "", "name ASC"));
     $form_node->db_data_values("nodes", "id", intval(get('node')));
     return $form_node;
 }
예제 #13
0
 function form_node()
 {
     global $db, $main;
     $form_node = new form(array('FORM_NAME' => 'form_node'));
     $form_node->db_data('nodes.name, nodes.area_id, nodes.community_id ,nodes.com_wind_id, nodes.latitude, nodes.longitude, nodes.elevation, nodes.info,nodes.freeifs, nodes.url,  nodes.internetaccess, nodes.internetprovider, nodes.system_identity' . ($this->has_owner_access() || get('node') == 'add' ? ', users_nodes.user_id, users_nodes.user_id' : ''));
     if ($this->has_owner_access() || get('node') == 'add') {
         $form_node->data[13]['Field'] = 'user_id_owner';
         $form_node->data[13]['fullField'] = 'user_id_owner';
         if (get('node') == 'add') {
             $temp = $db->get("users.id AS value, users.username AS output", "users", "users.id = '" . $main->userdata->user . "'");
         } else {
             $temp = $db->get("users.id AS value, users.username AS output", "users_nodes, users", "users.id = users_nodes.user_id AND users_nodes.node_id = " . intval(get('node')) . " AND users_nodes.owner = 'Y'");
         }
         $form_node->db_data_pickup("user_id_owner", "users", $temp);
         #	$form_node->db_data_pickup("users_nodes.user_id", "users", $db->get("users.id AS value, users.username AS output", "users_nodes, users", "users.id = users_nodes.user_id AND users_nodes.node_id = ".intval(get('node'))." AND users_nodes.owner != 'Y'"), TRUE);
         if (get('node') != 'add') {
             $form_node->db_data_pickup("users_nodes.user_id", "users", $db->get("users.id AS value, users.username AS output", "users_nodes, users", "users.id = users_nodes.user_id AND users_nodes.node_id = " . intval(get('node')) . " AND users_nodes.owner != 'Y'"), TRUE);
         } else {
             $form_node->db_data_pickup("users_nodes.user_id", "users", null, TRUE);
         }
         #$form_node->data[1]['Null'] = 'YES';
     }
     if ($main->userdata->privileges['admin'] === TRUE) {
         $form_node->db_data('nodes.id, nodes.name_ns');
     }
     #$#
     if ($main->userdata->privileges['cadmin'] === TRUE) {
         $form_node->db_data('nodes.name_ns');
     }
     #$#
     $form_node->db_data_enum('nodes.area_id', $db->get("id AS value, name AS output", "areas", "", "", "name"));
     #@#*** // changes output
     #DOC: ($select, $from, $where, $group_by, $order_by, $limit)
     $form_node->db_data_enum('nodes.community_id', $db->get("id AS value, name AS output", "communities"));
     #@#*** // changes output
     $form_node->db_data_values("nodes", "id", intval(get('node')));
     return $form_node;
 }