Ignore:
Timestamp:
03/08/2006 10:51:16 PM (6 years ago)
Author:
Winner
Message:

Add: Services support.
Bug fix: Extra field displaying error on registration page.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/pages/nodes/nodes_view.php

    r144 r151  
    134134                return $table_nameservers; 
    135135        } 
    136  
     136         
    137137        function table_links_p2p() { 
    138138                global $db; 
     
    240240                return $table_ipaddr_subnets; 
    241241        } 
    242                  
     242 
     243        function table_services() { 
     244                global $db, $vars, $lang; 
     245                $table_services = new table(array('TABLE_NAME' => 'table_services', 'FORM_NAME' => 'table_services')); 
     246                $table_services->db_data( 
     247                        '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', 
     248                        'nodes_services 
     249                        LEFT JOIN nodes on nodes_services.node_id = nodes.id 
     250                        LEFT JOIN services on nodes_services.service_id = services.id 
     251                        LEFT JOIN ip_addresses ON ip_addresses.id = nodes_services.ip_id', 
     252                        "nodes_services.node_id = '".get('node')."'", 
     253                        '', 
     254                        "services.title ASC"); 
     255 
     256                foreach( (array) $table_services->data as $key => $value) { 
     257                        if ($key != 0) { 
     258                                if ($table_services->data[$key]['ip']) { 
     259                                        $table_services->data[$key]['ip'] = long2ip($table_services->data[$key]['ip']); 
     260                                        if ($table_services->data[$key]['protocol'] && $table_services->data[$key]['port']) { 
     261                                                $table_services->data[$key]['ip'] .= ' ('.$lang['db']['nodes_services__protocol-'.$table_services->data[$key]['protocol']].'/'.$table_services->data[$key]['port'].')'; 
     262                                        } 
     263                                } 
     264                                $table_services->info['LINK']['services__title'][$key] = $table_services->data[$key]['url']; 
     265                        } 
     266                } 
     267                $table_services->db_data_remove('id','nodes__id', 'url', 'protocol', 'port'); 
     268                $table_services->db_data_translate('nodes_services__status'); 
     269                return $table_services; 
     270        } 
     271         
    243272        function output() { 
    244273                if ($_SERVER['REQUEST_METHOD'] == 'POST' && method_exists($this, 'output_onpost_'.$_POST['form_name'])) return call_user_func(array($this, 'output_onpost_'.$_POST['form_name'])); 
     
    275304 
    276305                $this->tpl['table_ipaddr_subnets'] = $construct->table($this->table_ipaddr_subnets(), __FILE__); 
    277                  
     306                $this->tpl['table_services'] = $construct->table($this->table_services(), __FILE__); 
    278307                $t = $db->get('id, date_in, view_point, info', 'photos', "node_id = ".intval(get('node'))); 
    279308                foreach( (array) $t as $key => $value) { 
Note: See TracChangeset for help on using the changeset viewer.