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;
    }
Example #2
0
    function table_nodes()
    {
        global $construct, $db, $main;
        $form_search_nodes = $this->form_search_nodes();
        $where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with"));
        if ($main->userdata->privileges['admin'] !== TRUE) {
            $where = "users.status = 'activated'" . ($where != '' ? ' AND (' . $where . ')' : "");
        }
        $table_nodes = new table(array('TABLE_NAME' => 'table_nodes'));
        $table_nodes->db_data('nodes.id, nodes.name AS nodes__name, areas.name AS areas__name', 'nodes
			LEFT JOIN areas ON nodes.area_id = areas.id
			LEFT JOIN regions ON areas.region_id = regions.id ' . 'INNER JOIN users_nodes ON nodes.id = users_nodes.node_id ' . 'LEFT JOIN users ON users.id = users_nodes.user_id', $where != '' ? $where : "", "nodes.id", "nodes.id ASC");
        $table_nodes->db_data_search($form_search_nodes);
        for ($i = 1; $i < count($table_nodes->data); $i++) {
            if (isset($table_nodes->data[$i])) {
                $table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")";
                $table_nodes->info['PICKUP_VALUE'][$i] = $table_nodes->data[$i]['id'];
                $table_nodes->info['PICKUP_OUTPUT'][$i] = $table_nodes->data[$i]['nodes__name'];
            }
        }
        $table_nodes->info['PICKUP_COLUMN'] = 'nodes__name';
        $table_nodes->info['PICKUP_OBJECT'] = stripslashes(get('object'));
        $table_nodes->db_data_remove('id');
        return $table_nodes;
    }
Example #3
0
    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;
    }
Example #4
0
    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;
    }
    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;
    }
Example #6
0
    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;
    }
Example #7
0
    function table_nodes()
    {
        global $construct, $db, $main, $lang;
        $form_search_nodes = $this->form_search_nodes();
        $where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with", "total_active_peers" => 'exclude', "total_active_clients" => 'exclude', "has_ap" => 'exclude'));
        $having = $form_search_nodes->db_data_where(array("nodes__id" => "exclude", "nodes__name" => "exclude", "areas__id" => "exclude", "regions__id" => "exclude", "has_ap" => 'exclude'));
        if ($form_search_nodes->data[6]['value'] != '') {
            $having .= ($having != '' ? ' AND ' : '') . 'total_active_aps ' . ($form_search_nodes->data[6]['value'] == 'Y' ? '>' : '=') . ' 0';
        }
        $table_nodes = new table(array('TABLE_NAME' => 'table_nodes'));
        $table_nodes->db_data('nodes.id,
        	nodes.name AS nodes__name,
        	areas.name AS areas__name,
			communities.name AS communities__name,
        	COUNT(DISTINCT p2p.id) AS total_active_p2p,
        	COUNT(DISTINCT aps.id) AS total_active_aps,
        	COUNT(DISTINCT p2p.id)+COUNT(DISTINCT client.id) AS total_active_peers,
        	COUNT(DISTINCT cl.id) AS total_active_clients,  nodes.freeifs AS nodes__freeifs', 'nodes
			LEFT JOIN areas ON nodes.area_id = areas.id
			LEFT JOIN regions ON areas.region_id = regions.id
			LEFT JOIN communities ON nodes.community_id = communities.id
			LEFT JOIN links ON nodes.id = links.node_id AND links.status = "active"
			LEFT JOIN links AS client ON links.peer_ap_id = client.id
									  AND links.type = "client"
									  AND client.type = "ap"
									  AND client.status = "active"
			LEFT JOIN links AS p2p ON p2p.peer_node_id = links.node_id
								   AND links.peer_node_id = p2p.node_id
								   AND links.type = "p2p"
								   AND p2p.type = "p2p"
								   AND p2p.status = "active"
			LEFT JOIN links AS aps ON nodes.id = aps.node_id
								   AND aps.type = "ap"
								   AND aps.status = "active"
			LEFT JOIN links AS cl ON cl.peer_ap_id = aps.id
								  AND cl.type = "client"
								  AND cl.status = "active"
			INNER JOIN users_nodes ON nodes.id = users_nodes.node_id 
			LEFT JOIN users ON users.id = users_nodes.user_id', 'users.status = "activated"' . ($where != '' ? ' AND (' . $where . ')' : ""), 'nodes.id' . ($having != '' ? ' HAVING (' . $having . ')' : ""), "total_active_peers DESC, total_active_aps DESC, total_active_clients DESC, nodes.id");
        $table_nodes->db_data_search($form_search_nodes);
        for ($i = 1; $i < count($table_nodes->data); $i++) {
            if (isset($table_nodes->data[$i])) {
                $table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")";
                $table_nodes->data[$i]['total_active_peers'] = $table_nodes->data[$i]['total_active_peers'] . ($table_nodes->data[$i]['total_active_aps'] > 0 ? " (+" . $table_nodes->data[$i]['total_active_aps'] . " " . $lang['aps'] . ")" : "");
                $table_nodes->info['EDIT'][$i] = makelink(array("page" => "nodes", "node" => $table_nodes->data[$i]['id']));
            }
        }
        $table_nodes->info['EDIT_COLUMN'] = 'nodes__name';
        $table_nodes->db_data_remove('id', 'total_active_p2p', 'total_active_aps');
        return $table_nodes;
    }
Example #8
0
 function table_communities()
 {
     global $construct, $db, $lang;
     $form_search_communities = $this->form_search_communities();
     $where = "";
     #$form_search_communities->db_data_where();
     $table_communities = new table(array('TABLE_NAME' => 'table_communities', 'FORM_NAME' => 'table_communities'));
     $table_communities->db_data('communities.id, communities.name,communities.fullname, communities.windURL, communities.TOS, communities.dnstld, communities.ns1, communities.ns2, communities.admins', 'communities', $where, '', "communities.id ASC");
     $table_communities->db_data_search($form_search_communities);
     foreach ((array) $table_communities->data as $key => $value) {
         if ($key != 0) {
             if ($table_communities->data[$key]['ns1']) {
                 $table_communities->data[$key]['ns1'] = long2ip($table_communities->data[$key]['ns1']);
                 #if ($table_services->data[$key]['protocol'] && $table_communities->data[$key]['port']) {
                 #	$table_services->data[$key]['ip'] .= ' ('.$lang['db']['nodes_services__protocol-'.$table_communities->data[$key]['protocol']].'/'.$table_communities->data[$key]['port'].')';
                 #}
             }
             if ($table_communities->data[$key]['ns2']) {
                 $table_communities->data[$key]['ns2'] = long2ip($table_communities->data[$key]['ns2']);
             }
             $cadmins = explode(",", $table_communities->data[$key]['admins']);
             #print_r($cadmins);echo "admins<br>";
             foreach ($cadmins as $key_name => $key_value) {
                 $i++;
                 #print_r($key_value);
                 $queryusers = $db->query("SELECT\n\t\t\t\t\t\t\t\t\tusers.username\n\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\tusers\n\t\t\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t\tusers.id =  '{$key_value}'\n\t\t\t\t\t\t\t\t\t");
                 $usernames = mysql_fetch_assoc($queryusers);
                 #echo $usernames['username'];
                 $cadmins[$key_name] = $usernames['username'];
                 #echo $cadmins[$key_name];
                 #print_r($usernames);
                 #$cadmins[$key_name]=$usernames[$i];#echo "users:$key_name:$key_value<br>"; print_r($usernames);
                 #$new=implode(",",$usernames);
                 #$basket = array_replace_recursive($base, $replacements);print_r($basket);
                 #$usernames_comma_separated = implode(",", $usernames);
                 #$basket = array_combine($cadmins, $usernames);print_r($basket);
             }
             #$basket = array_combine($cadmins, $usernames);print_r($basket);
             $table_communities->data[$key]['admins'] = implode(", ", $cadmins);
             #		$cadmins->data[$k]['links__ip'] = $cadmins->data[$k]['links__ip'];#@#
             #$table_communities->data[$key]['nodes__name'] .= " (#".$table_communities->data[$key]['nodes__id'].")";
             #$table_communities->info['LINK']['nodes__name'][$key] = makelink(array("page" => "nodes", "node" => $table_communities->data[$key]['nodes__id']));
             #$table_communities->info['LINK']['services__title'][$key] = $table_communities->data[$key]['url'];
         }
     }
     #$table_communities->db_data_translate('communities__TOS');
     $table_communities->db_data_remove('TOS');
     return $table_communities;
 }
    function table_areas()
    {
        global $construct, $db;
        $table_areas = new table(array('TABLE_NAME' => 'table_areas', 'FORM_NAME' => 'table_areas'));
        $table_areas->db_data('"" AS ip_range, areas.name AS areas__name, regions.name AS regions__name, areas.ip_start, areas.ip_end', 'areas
			LEFT JOIN regions ON areas.region_id = regions.id', "", "", "areas.ip_start ASC");
        foreach ((array) $table_areas->data as $key => $value) {
            if ($key != 0) {
                $table_areas->data[$key]['ip_start'] = long2ip($table_areas->data[$key]['ip_start']);
                $table_areas->data[$key]['ip_end'] = long2ip($table_areas->data[$key]['ip_end']);
                $table_areas->data[$key]['ip_range'] = $table_areas->data[$key]['ip_start'] . " - " . $table_areas->data[$key]['ip_end'];
            }
        }
        $table_areas->db_data_remove('ip_start', 'ip_end');
        return $table_areas;
    }
Example #10
0
 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;
 }
Example #11
0
 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;
 }
 function table_actionlog()
 {
     global $construct, $db, $main;
     $table_actionlog = new table(array('FORM_NAME' => 'table_actionlog', 'TABLE_NAME' => 'table_actionlog'));
     $table_actionlog->db_data('actionlog.id, users.username,actionlog.ipaddress, actionlog.uid, actionlog.dateline AS actionlog__date, actionlog.page, actionlog.action, actionlog.data', 'actionlog ' . 'Left Join `users` ON `actionlog`.`uid` = `users`.`id`', "", "", "actionlog.id DESC");
     for ($i = 1; $i < count($table_actionlog->data); $i++) {
         if (isset($table_actionlog->data[$i])) {
             #$table_actionlog->data[$i]['ip_start'] = long2ip($table_actionlog->data[$i]['ip_start']);
             #$table_actionlog->data[$i]['ip_end'] = long2ip($table_actionlog->data[$i]['ip_end']);
             #$table_actionlog->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "actionlog", "area" => $table_actionlog->data[$i]['id']));
         }
     }
     #$table_actionlog->info['EDIT_COLUMN'] = 'actionlog__name';
     $table_actionlog->db_data_multichoice('dateline', 'id');
     $table_actionlog->info['MULTICHOICE_LABEL'] = 'delete';
     $table_actionlog->db_data_remove('id', 'uid');
     return $table_actionlog;
 }
Example #13
0
 function table_nodechangeslog()
 {
     global $construct, $db, $main;
     $table_nodechangeslog = new table(array('FORM_NAME' => 'table_nodechangeslog', 'TABLE_NAME' => 'table_nodechangeslog'));
     $table_nodechangeslog->db_data('node_settings_changes.dateline, nodes.name,  node_settings_changes.changemenu, node_settings_changes.changemade, users.username, node_settings_changes.comment', 'node_settings_changes INNER JOIN `users` ON `users`.`id` = `node_settings_changes`.`uid` INNER JOIN `nodes` ON `nodes`.`id` = `node_settings_changes`.`node_id` ', "", "", "node_settings_changes.id DESC");
     for ($i = 1; $i < count($table_nodechangeslog->data); $i++) {
         if (isset($table_nodechangeslog->data[$i])) {
             #$table_nodechangeslog->data[$i]['ip_start'] = long2ip($table_nodechangeslog->data[$i]['ip_start']);
             #$table_nodechangeslog->data[$i]['ip_end'] = long2ip($table_nodechangeslog->data[$i]['ip_end']);
             #$table_nodechangeslog->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "nodechangeslog", "area" => $table_nodechangeslog->data[$i]['id']));
         }
     }
     #$table_nodechangeslog->info['EDIT_COLUMN'] = 'nodechangeslog__name';
     $table_nodechangeslog->db_data_multichoice('dateline');
     $table_nodechangeslog->info['MULTICHOICE_LABEL'] = '';
     #$table_nodechangeslog->db_data_remove('id', 'uid');
     return $table_nodechangeslog;
 }
Example #14
0
 function table_areas()
 {
     global $construct, $db, $main;
     $table_areas = new table(array('FORM_NAME' => 'table_areas', 'TABLE_NAME' => 'table_areas'));
     $table_areas->db_data('areas.id, areas.name AS areas__name, areas.ip_start, areas.ip_end, areas.info, regions.name AS regions__name', 'areas ' . 'LEFT JOIN regions ON regions.id = areas.region_id', "", "", "areas.ip_start ASC");
     for ($i = 1; $i < count($table_areas->data); $i++) {
         if (isset($table_areas->data[$i])) {
             $table_areas->data[$i]['ip_start'] = long2ip($table_areas->data[$i]['ip_start']);
             $table_areas->data[$i]['ip_end'] = long2ip($table_areas->data[$i]['ip_end']);
             $table_areas->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "areas", "area" => $table_areas->data[$i]['id']));
         }
     }
     $table_areas->info['EDIT_COLUMN'] = 'areas__name';
     $table_areas->db_data_multichoice('region', 'id');
     $table_areas->info['MULTICHOICE_LABEL'] = 'delete';
     $table_areas->db_data_remove('id');
     return $table_areas;
 }
Example #15
0
 function table_users()
 {
     global $construct, $db, $main;
     $form_search_users = $this->form_search_users();
     $where = $form_search_users->db_data_where(array("users__username" => "starts_with"));
     $table_users = new table(array('TABLE_NAME' => 'table_users'));
     $table_users->db_data('users.id, users.username', 'users', "users.status = 'activated'" . ($where != '' ? ' AND (' . $where . ')' : ""), 'users.id', "users.username ASC");
     $table_users->db_data_search($form_search_users);
     for ($i = 1; $i < count($table_users->data); $i++) {
         if (isset($table_users->data[$i])) {
             $table_users->info['PICKUP_VALUE'][$i] = $table_users->data[$i]['id'];
             $table_users->info['PICKUP_OUTPUT'][$i] = $table_users->data[$i]['username'];
         }
     }
     $table_users->info['PICKUP_COLUMN'] = 'username';
     $table_users->info['PICKUP_OBJECT'] = stripslashes(get('object'));
     $table_users->db_data_remove('id');
     return $table_users;
 }
 function table_communities()
 {
     global $construct, $db, $main;
     $table_communities = new table(array('FORM_NAME' => 'table_communities', 'TABLE_NAME' => 'table_communities'));
     $table_communities->db_data('communities.id, communities.name, communities.windURL, communities.TOS, communities.fullname, communities.dnstld, communities.ns1, communities.ns2', 'communities', "", "", "name ASC");
     for ($i = 1; $i < count($table_communities->data); $i++) {
         if (isset($table_communities->data[$i])) {
             $table_communities->data[$i]['ns1'] = long2ip($table_communities->data[$i]['ns1']);
             $table_communities->data[$i]['ns2'] = long2ip($table_communities->data[$i]['ns2']);
             $table_communities->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "communities", "community" => $table_communities->data[$i]['id']));
         }
     }
     $table_communities->info['EDIT_COLUMN'] = 'dnstld';
     $table_communities->info['EDIT_COLUMN'] = 'name';
     $table_communities->db_data_multichoice('community', 'id');
     $table_communities->info['MULTICHOICE_LABEL'] = 'delete';
     $table_communities->db_data_remove('id', 'communities.id');
     return $table_communities;
 }
Example #17
0
 function table_regions()
 {
     global $construct, $db, $main;
     $table_regions = new table(array('FORM_NAME' => 'table_regions', 'TABLE_NAME' => 'table_regions'));
     $table_regions->db_data('regions.id, regions.name, regions.ip_start, regions.ip_end, regions.v6net, regions.v6prefix, regions.info', 'regions', "", "", "ip_start ASC");
     for ($i = 1; $i < count($table_regions->data); $i++) {
         if (isset($table_regions->data[$i])) {
             $table_regions->data[$i]['ip_start'] = long2ip($table_regions->data[$i]['ip_start']);
             $table_regions->data[$i]['ip_end'] = long2ip($table_regions->data[$i]['ip_end']);
             $table_regions->data[$i]['v6net'] = inet_ntop($table_regions->data[$i]['v6net']);
             $table_regions->info['EDIT'][$i] = make_ref('/admin/regions', array("region" => $table_regions->data[$i]['id']));
         }
     }
     $table_regions->info['EDIT_COLUMN'] = 'name';
     $table_regions->db_data_multichoice('region', 'id');
     $table_regions->info['MULTICHOICE_LABEL'] = 'delete';
     $table_regions->db_data_remove('id');
     return $table_regions;
 }
Example #18
0
 function table_users()
 {
     global $construct, $db, $main;
     $form_search_users = $this->form_search_users();
     $where = $form_search_users->db_data_where(array("users__username" => "starts_with", "users__surname" => "starts_with", "users__name" => "starts_with", "users__email" => "starts_with"));
     $table_users = new table(array('FORM_NAME' => 'table_users', 'TABLE_NAME' => 'table_users'));
     $table_users->db_data('users.id, users.username, "" AS fullname, users.surname, users.name, users.email, users.phone', 'users LEFT JOIN rights ON users.id = rights.user_id', $where, 'users.id', 'users.date_in DESC');
     $table_users->db_data_search($form_search_users);
     for ($i = 1; $i < count($table_users->data); $i++) {
         if (isset($table_users->data[$i])) {
             $table_users->data[$i]['fullname'] = $table_users->data[$i]['surname'] . " " . $table_users->data[$i]['name'];
             $table_users->info['EDIT'][$i] = makelink(array("page" => "users", "user" => $table_users->data[$i]['id']));
         }
     }
     $table_users->info['EDIT_COLUMN'] = 'username';
     $table_users->db_data_multichoice('users', 'id');
     $table_users->info['MULTICHOICE_LABEL'] = 'delete';
     $table_users->db_data_remove('id', 'surname', 'name');
     return $table_users;
 }
Example #19
0
 function table_regions()
 {
     global $construct, $db, $main;
     $table_regions = new table(array('FORM_NAME' => 'table_regions', 'TABLE_NAME' => 'table_regions'));
     $table_regions->db_data('regions.id, regions.name, regions.ip_start, regions.ip_end, regions.dns_suffix, regions.info, regions.image, regions.min_lat, regions.min_long, regions.max_lat, regions.max_long', 'regions', "", "", "ip_start ASC");
     for ($i = 1; $i < count($table_regions->data); $i++) {
         if (isset($table_regions->data[$i])) {
             $table_regions->data[$i]['ip_start'] = long2ip($table_regions->data[$i]['ip_start']);
             $table_regions->data[$i]['ip_end'] = long2ip($table_regions->data[$i]['ip_end']);
             $table_regions->info['EDIT'][$i] = makelink(array("page" => "admin", "subpage" => "regions", "region" => $table_regions->data[$i]['id']));
         }
     }
     $table_regions->info['EDIT_COLUMN'] = 'dns_suffix';
     $table_regions->info['EDIT_COLUMN'] = 'name';
     $table_regions->db_data_multichoice('region', 'id');
     $table_regions->info['MULTICHOICE_LABEL'] = 'delete';
     $table_regions->db_data_remove('id');
     $table_regions->db_data_remove('image');
     return $table_regions;
 }
Example #20
0
 function table_nodes()
 {
     global $construct, $db, $main;
     $form_search_nodes = $this->form_search_nodes();
     $where = $form_search_nodes->db_data_where(array("nodes__name" => "starts_with"));
     $table_nodes = new table(array('FORM_NAME' => 'table_nodes', 'TABLE_NAME' => 'table_nodes'));
     $table_nodes->db_data('nodes.id, nodes.name AS nodes__name, areas.name AS areas__name', 'nodes ' . 'LEFT JOIN areas ON nodes.area_id = areas.id ' . 'LEFT JOIN regions ON areas.region_id = regions.id', $where, "", "nodes.id ASC");
     $table_nodes->db_data_search($form_search_nodes);
     for ($i = 1; $i < count($table_nodes->data); $i++) {
         if (isset($table_nodes->data[$i])) {
             $table_nodes->data[$i]['nodes__name'] .= " (#" . $table_nodes->data[$i]['id'] . ")";
             $table_nodes->info['EDIT'][$i] = make_ref('/node_editor', array("node" => $table_nodes->data[$i]['id']));
         }
     }
     $table_nodes->info['EDIT_COLUMN'] = 'nodes__name';
     $table_nodes->db_data_multichoice('node', 'id');
     $table_nodes->info['MULTICHOICE_LABEL'] = 'delete';
     $table_nodes->db_data_remove('id');
     return $table_nodes;
 }
 function table_nameservers()
 {
     global $construct, $db, $main, $vars;
     $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'));
     $table_nameservers->db_data('dns_nameservers.id, dns_nameservers.name, nodes.id AS nodes__id, nodes.name AS nodes__name, nodes.name_ns AS nodes__name_ns, areas.name AS areas__name', 'dns_nameservers, nodes, areas, regions', 'dns_nameservers.node_id = nodes.id AND nodes.area_id = areas.id AND areas.region_id = regions.id' . ($where != '' ? ' AND (' . $where . ')' : ""), "", "nodes.id ASC");
     $table_nameservers->db_data_search($form_search_nameservers);
     for ($i = 1; $i < count($table_nameservers->data); $i++) {
         if (isset($table_nameservers->data[$i])) {
             $table_nameservers->data[$i]['nodes__name'] .= " (#" . $table_nameservers->data[$i]['nodes__id'] . ")";
             $table_nameservers->data[$i]['name'] .= "." . $table_nameservers->data[$i]['nodes__name_ns'] . "." . $vars['dns']['ns_zone'];
             $table_nameservers->info['PICKUP_VALUE'][$i] = $table_nameservers->data[$i]['id'];
             $table_nameservers->info['PICKUP_OUTPUT'][$i] = $table_nameservers->data[$i]['name'];
         }
     }
     $table_nameservers->info['PICKUP_COLUMN'] = 'name';
     $table_nameservers->info['PICKUP_OBJECT'] = stripslashes(get('object'));
     $table_nameservers->db_data_remove('id', 'nodes__id', 'nodes__name_ns');
     return $table_nameservers;
 }
 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;
 }
    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;
    }
 function table_links_ap()
 {
     global $construct, $db, $main, $lang;
     $form_search_links_ap = $this->form_search_links_ap();
     $where = $form_search_links_ap->db_data_where(array("links__ssid" => "starts_with", "nodes__name" => "starts_with"));
     $table_links_ap = new table(array('TABLE_NAME' => 'table_links_ap'));
     $table_links_ap->db_data('links.id AS links__id, links.ssid, nodes.id AS nodes__id, nodes.name AS nodes__name, areas.name AS areas__name', 'links ' . 'INNER JOIN nodes ON links.node_id = nodes.id ' . 'LEFT JOIN areas ON nodes.area_id = areas.id ' . 'LEFT JOIN regions ON areas.region_id = regions.id', "links.type = 'ap'" . ($where != '' ? ' AND (' . $where . ')' : ""), "", "nodes.id ASC");
     $table_links_ap->db_data_search($form_search_links_ap);
     for ($i = 1; $i < count($table_links_ap->data); $i++) {
         if (isset($table_links_ap->data[$i])) {
             if ($table_links_ap->data[$i]['ssid'] == '') {
                 $table_links_ap->data[$i]['ssid'] = $lang['null'];
             }
             $table_links_ap->data[$i]['nodes__name'] .= " (#" . $table_links_ap->data[$i]['nodes__id'] . ")";
             $table_links_ap->info['PICKUP_VALUE'][$i] = $table_links_ap->data[$i]['links__id'];
             $table_links_ap->info['PICKUP_OUTPUT'][$i] = $table_links_ap->data[$i]['nodes__name'] . " [" . $lang['db']['links__ssid'] . ": " . $table_links_ap->data[$i]['ssid'] . "]";
         }
     }
     $table_links_ap->info['PICKUP_COLUMN'] = 'ssid';
     $table_links_ap->info['PICKUP_OBJECT'] = stripslashes(get('object'));
     $table_links_ap->db_data_remove('links__id', 'nodes__id');
     return $table_links_ap;
 }
 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;
 }
 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;
 }
Example #27
0
    function table_services()
    {
        global $db, $vars, $lang;
        $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, 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', "nodes_services.node_id = '" . get('node') . "'", '', "services.title 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']);
                    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->info['LINK']['services__title'][$key] = htmlspecialchars($table_services->data[$key]['url']);
            }
        }
        $table_services->db_data_remove('id', 'nodes__id', 'url', 'protocol', 'port');
        $table_services->db_data_translate('nodes_services__status');
        return $table_services;
    }
 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;
 }
Example #29
0
 function table_photosview()
 {
     global $db, $vars;
     $table_photosview = new table(array('TABLE_NAME' => 'table_photosview', 'FORM_NAME' => 'table_photosview'));
     $table_photosview->db_data('photos.id, photos.date_in, photos.view_point, photos.info', 'photos', 'photos.node_id = ' . intval(get('node')));
     $i = 1;
     $t[0] = $table_photosview->data[0];
     $t[0]['photo'] = 'photo';
     foreach ((array) array('N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW', 'PANORAMIC') as $value) {
         foreach ((array) $table_photosview->data as $key => $valuek) {
             if ($table_photosview->data[$key]['view_point'] == $value) {
                 $p = $key;
                 break;
             }
             unset($p);
         }
         if (isset($p) && $table_photosview->data[$p]['view_point'] == $value) {
             $table_photosview->data[$p]['photo'] = $vars['folders']['photos'] . 'photo-' . $table_photosview->data[$p]['id'] . '-s.jpg';
             $t[$i] = $table_photosview->data[$p];
         } else {
             $t[$i] = array('id' => '', 'date_in' => '', 'view_point' => $value, 'info' => '', 'photo' => '');
         }
         $i++;
     }
     $table_photosview->data = $t;
     $table_photosview->db_data_multichoice('photos', 'id');
     $table_photosview->info['MULTICHOICE_LABEL'] = 'delete';
     $table_photosview->db_data_remove('id');
     return $table_photosview;
 }
Example #30
0
 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;
 }